How jirattong/xor-bomb-game works
XOR Bomb Defusal Workshop is a browser-based, two-role game: an operator configures a secret and key, creates a room, and a defuser joins to solve the XOR cipher under a timer. The main client syncs room state through Firebase Realtime Database and presents gameplay and results. A separate room API route implements its own room actions using an in-memory fallback and a remote relay; the sampled client excerpt does not show it being used. The page is a large, partially excerpted module, so its internal stages are grouped by evidenced responsibilities.
Main entry points: page.tsx Game screens · firebase.ts Firebase client · route.ts Room endpoint
Components 16
Game client
- Game screens
app/page.tsx - Operator setup
app/page.tsx - Room creation
app/page.tsx - Room joining
app/page.tsx - Cipher setup
app/page.tsx - Defuser controls
app/page.tsx - Bit decoding
app/page.tsx - Game state
app/page.tsx - Timer and results
app/page.tsx - Sound effects
app/page.tsx
Room synchronization
- Firebase client
lib/firebase.ts - Realtime Database
Room API
- Room endpoint
app/api/room/route.ts - Room cache
app/api/room/route.ts
Other components
- Players
- Global relay
Connections 18
- Players → Game screens: uses
app/page.tsx - Game screens → Operator setup: shows
app/page.tsx - Game screens → Defuser controls: shows
app/page.tsx - Operator setup → Cipher setup: configures
app/page.tsx - Operator setup → Room creation: creates
app/page.tsx - Room creation → Firebase client: writes room
app/page.tsx - Room joining → Firebase client: updates room
app/page.tsx - Defuser controls → Room joining: joins room
app/page.tsx - Defuser controls → Bit decoding: edits bits
app/page.tsx - Bit decoding → Game state: submits word
app/page.tsx - Game state → Firebase client: updates status
app/page.tsx - Firebase client → Realtime Database: reads and writes
- Realtime Database → Game state: streams updates
app/page.tsx - Game state → Timer and results: drives results
app/page.tsx - Game screens → Sound effects: plays effects
app/page.tsx - Players → Room endpoint: requests room
app/api/room/route.ts - Room endpoint → Room cache: falls back to
app/api/room/route.ts - Room endpoint → Global relay: fetches and saves
app/api/room/route.ts