Multiplayer Three.js game where players fly planes around customizable globes.
- Node.js 20+
- PostgreSQL running locally (or via Docker)
npm install# Start Postgres (if using Docker)
docker run -d --name globefly-db -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=globefly -p 5432:5432 postgres:16
# Generate Prisma client and run migrations
cd server
npx prisma generate
npx prisma migrate dev --name init
cd ..npm run dev- Client: http://localhost:5173
- Server: http://localhost:3001
- Open the client in your browser
- Create a world (give it a name and pick a texture)
- Copy the world code
- Open another tab, paste the code, and join with a different name
- Fly around together!
| Key | Action |
|---|---|
| W / S | Pitch down / up |
| A / D | Turn left / right |
| Shift | Speed up |
| Ctrl | Slow down |
| Arrow Up | Fly upwards (altitude) |
| Space | Fire paintball |
Production URLs:
- Client: https://tinyskies.vercel.app (Vercel)
- Server API: Railway (or any Docker host)
Deploy both server (Railway) and client (Vercel) in one shot:
npm run deployThis runs railway up then vercel deploy --prod sequentially so the API is live before the new frontend goes out.
Deploy individually when you only changed one side:
npm run deploy:server # Railway only
npm run deploy:client # Vercel only
npm run deploy:preview # Vercel preview (non-production)1. Railway CLI
npm i -g @railway/cli
railway login
railway link # select the globefly-server project2. Vercel CLI
npx vercel login
npx vercel link # select the tinyskies project3. Server URL for the client
Edit client/.env.production and set VITE_SERVER_URL to your Railway API URL:
VITE_SERVER_URL=https://globefly-api-production.up.railway.app
Commit the file. Vite reads it on every production build so Vercel picks it up automatically -- no Vercel dashboard env setup needed for the API URL.
Alternatively, set SERVER_URL in Vercel environment variables -- the client fetches it at runtime via /api/server-url (no rebuild needed when the URL changes).
Server (Railway dashboard or railway variables)
| Variable | Value |
|---|---|
DATABASE_URL |
PostgreSQL connection string |
CLIENT_URL |
https://tinyskies.vercel.app (for CORS; comma-separated for extras) |
PORT |
3001 (or Railway's assigned port) |
Client (committed in repo -- no dashboard needed)
| File | Variable | Purpose |
|---|---|---|
client/.env.production |
VITE_SERVER_URL |
Baked into the bundle at build time |
Local dev keeps defaults: client http://localhost:5173, server http://localhost:3001.
- Client: Vite, TypeScript, Three.js, Socket.io
- Server: Node.js, Express, Socket.io, Prisma
- Database: PostgreSQL
- Architecture: Quaternion-based spherical math for singularity-free globe flight, relay server with client-side prediction and slerp interpolation