<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nerijus Bartoševičius</title>
    <description>The latest articles on Forem by Nerijus Bartoševičius (@nerijus_bartoeviius_cda).</description>
    <link>https://forem.com/nerijus_bartoeviius_cda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3944159%2F109210d8-3406-4826-ab4b-4fb4eaf7fe4c.jpg</url>
      <title>Forem: Nerijus Bartoševičius</title>
      <link>https://forem.com/nerijus_bartoeviius_cda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nerijus_bartoeviius_cda"/>
    <language>en</language>
    <item>
      <title>How I Built a Living 3D Galaxy with Three.js and Laravel</title>
      <dc:creator>Nerijus Bartoševičius</dc:creator>
      <pubDate>Thu, 21 May 2026 13:29:11 +0000</pubDate>
      <link>https://forem.com/nerijus_bartoeviius_cda/how-i-built-a-living-3d-galaxy-with-threejs-and-laravel-1ogh</link>
      <guid>https://forem.com/nerijus_bartoeviius_cda/how-i-built-a-living-3d-galaxy-with-threejs-and-laravel-1ogh</guid>
      <description>&lt;h2&gt;
  
  
  The Idea
&lt;/h2&gt;

&lt;p&gt;I wanted to build something that feels magical — a 3D galaxy where every star can be dedicated to someone special. A gift, a memory, or just a message that lasts forever.&lt;/p&gt;

&lt;p&gt;The result: &lt;strong&gt;Galaxiana&lt;/strong&gt; — &lt;a href="https://galaxiana.com" rel="noopener noreferrer"&gt;https://galaxiana.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Three.js&lt;/strong&gt; — 3D rendering with instanced meshes (50k+ stars at 60fps)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Laravel&lt;/strong&gt; — backend, API, Stripe webhooks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stripe&lt;/strong&gt; — payments via Checkout Sessions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MySQL&lt;/strong&gt; — star data, purchases&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Hardest Part
&lt;/h2&gt;

&lt;p&gt;Rendering 50,000+ stars smoothly required instanced meshes in Three.js. Instead of 50k individual objects, one draw call handles everything.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;geometry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;THREE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SphereGeometry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;material&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;THREE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MeshBasicMaterial&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mesh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;THREE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;InstancedMesh&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;geometry&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;material&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;STAR_COUNT&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Stripe Integration
&lt;/h2&gt;

&lt;p&gt;I went with Checkout Sessions instead of custom payment forms — faster to build and Stripe handles all the edge cases.&lt;br&gt;
The key insight: store all star data in &lt;code&gt;payment_intent.metadata&lt;/code&gt;, not in your DB before payment. This way you never have orphaned records.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Live
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;1,000,000+ stars, each claimable&lt;/li&gt;
&lt;li&gt;Real-time updates — when someone buys a star, everyone sees it&lt;/li&gt;
&lt;li&gt;Custom star colors, names, messages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check it out: &lt;a href="https://galaxiana.com" rel="noopener noreferrer"&gt;https://galaxiana.com&lt;/a&gt;&lt;br&gt;
Happy to answer questions about the tech!&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>threejs</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
