How 0pingdev/twopia works
Twopia is a private social space for two, with a current runtime centered on sign-in, a solo lobby, and duo invitations and pairing. The home page selects the signed-in or signed-out experience and mounts a 3D scene. Auth state comes from Supabase; lobby and invite actions read and update Supabase data. The README also describes games, stories, and a shared home, but the supplied tree and excerpts do not show their implementation, so they are not represented as runtime components.
Main entry points: page.tsx Home router · supabase.ts Supabase client · Landing.tsx Sign-in landing · DevOverlay.tsx Dev overlay
Components 15
App entry
- Home router
app/page.tsx - Sign-in landing
src/components/Landing.tsx
Identity and pairing
- Solo lobby
src/components/Dashboard.tsx - Join invite
app/join/page.tsx - Auth state hook
src/lib/useAuth.ts - Supabase client
src/lib/supabase.ts
Scene and controls
- 3D scene
src/components/Scene.tsx - Pointer-lock sync
src/state/pointer-lock.ts
Client state
- Mode store
src/state/mode.ts - Settings store
src/lib/settings.ts - Dev overlay
src/components/DevOverlay.tsx
Other components
- Visitor
- Supabase service
- Google OAuth
- Browser storage
Connections 19
- Visitor → Home router: opens
app/page.tsx - Home router → Auth state hook: reads auth
app/page.tsx - Home router → 3D scene: mounts
app/page.tsx - Home router → Sign-in landing: shows signed out
app/page.tsx - Home router → Solo lobby: shows signed in
app/page.tsx - Home router → Dev overlay: mounts
app/page.tsx - Sign-in landing → Supabase client: starts OAuth
src/components/Landing.tsx - Sign-in landing → Google OAuth: selects provider
src/components/Landing.tsx - Auth state hook → Supabase client: reads session
src/lib/useAuth.ts - Solo lobby → Supabase client: reads and updates
src/components/Dashboard.tsx - Join invite → Auth state hook: checks user
app/join/page.tsx - Join invite → Supabase client: claims invite
app/join/page.tsx - Supabase client → Supabase service: connects to
src/lib/supabase.ts - 3D scene → Pointer-lock sync: syncs lock
src/components/Scene.tsx - Pointer-lock sync → Mode store: subscribes to
src/state/pointer-lock.ts - Dev overlay → Mode store: reads state
src/components/DevOverlay.tsx - Dev overlay → Settings store: reads visibility
src/components/DevOverlay.tsx - Sign-in landing → Settings store: enables overlay
src/components/Landing.tsx - Settings store → Browser storage: persists settings
src/lib/settings.ts