Spheres
Chartflow aligned with the implementation plan: real-time on Socket.io, Firebase for auth + sparse writes, no Firestore as game bus.
Browser · React + Vite + R3F
3D world, flight controls, HUD, Socket.io client, Zustand — no world truth in Firestore listeners
Firebase · Auth + Firestore (sparse)
Profiles, aura, core rating, reports — not positions, presence, or chat history
World server · Node + Socket.io
Token verify (Admin SDK), WorldState in memory, relay chat, AI spheres, throttle 10 Hz
Deploy & config (typical)
Web host
Vercel / Firebase Hosting
Railway
world-server · PORT + secrets
Env
VITE_* · CORS_ORIGINS · SA key
One sync path from login token to smooth remote spheres.
Auth
Firebase ID token in client
join_world
Socket + token verify (Admin)
World state
In-memory Map per worldId
update_state
10 Hz throttle per client
Broadcast
player_update to peers
Render
Interpolation + R3F
Rules from the plan — keep Firebase bills predictable and privacy intact.
onSnapshot for positions, presence, or world stateFirestore writes only: registration, debounced aura, core rating after chat, rare reports — target < 100 reads/writes per test session for two users.
pnpm workspace — shared protocol types, thin boundaries between apps.
spheres/ ├── apps/web → Vite · React · R3F · pages · stores · i18n ├── apps/world-server → Express · Socket.io · auth · world · AI └── packages/shared → types · protocol · constants
Plan phases (checklist in repo) — condensed labels for orientation.
P1
Monorepo · web + world-server + shared
P2
Auth · account · aura · R3F preview
P3
World · flight · HUD
P4
Presence · sync · AI spheres
P5
Proximity · contact handshake
P6
Chat relay · no persistence
P7
Rating · core → Firestore
P8
Deploy · Railway + hosting
Source of truth for tasks and env tables: PLAN.md in the Spheres repo.