DEV Community

Cover image for How I Built a Living 3D Galaxy with Three.js and Laravel
Nerijus Bartoševičius
Nerijus Bartoševičius

Posted on

How I Built a Living 3D Galaxy with Three.js and Laravel

The Idea

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.

The result: Galaxianahttps://galaxiana.com

Tech Stack

  • Three.js — 3D rendering with instanced meshes (50k+ stars at 60fps)
  • Laravel — backend, API, Stripe webhooks
  • Stripe — payments via Checkout Sessions
  • MySQL — star data, purchases

The Hardest Part

Rendering 50,000+ stars smoothly required instanced meshes in Three.js. Instead of 50k individual objects, one draw call handles everything.

const geometry = new THREE.SphereGeometry(1, 4, 4);
const material = new THREE.MeshBasicMaterial();
const mesh = new THREE.InstancedMesh(geometry, material, STAR_COUNT);
Enter fullscreen mode Exit fullscreen mode

Stripe Integration

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

What's Live

  • 1,000,000+ stars, each claimable
  • Real-time updates — when someone buys a star, everyone sees it
  • Custom star colors, names, messages

Check it out: https://galaxiana.com
Happy to answer questions about the tech!

Top comments (0)