How suvajit324/who-is-the-imposter works
Who's the Imposter? is a browser-based, real-time social deduction game. Players create or join private rooms, configure and ready a lobby, then play server-authoritative rounds through private role reveal, clues, discussion, voting/runoffs, results, scoring, and rematches. The React client sends Socket.IO actions to the server’s room manager; shared contracts define the event and data shapes. Room state is in memory, while MongoDB optionally supplies word pairs and stores completed games. Edges reflect README statements and shown source references; unsampled capability wiring is not inferred.
Main entry points: roomManager.ts Room engine · App.tsx Game UI · registerHandlers.ts Event handlers · socket.ts Socket client
Components 17
Web client
- Game UI
apps/web/src/App.tsx - Socket client
apps/web/src/state/socket.ts - Chat sync
apps/web/src/chat/useRoomChat.ts - Chat service
apps/web/src/chat/chatService.ts - Chat UI
apps/web/src/components/chat/ChatBox.tsx
Game server
- Server entry
apps/server/src/index.ts - Event handlers
apps/server/src/socket/registerHandlers.ts - Room engine
apps/server/src/domain/roomManager.ts - Round rules
apps/server/src/domain - Room chat
apps/server/src/domain/chat.ts - Chat moderation
apps/server/src/moderation
Game content
- Word bank
apps/server/src/data/wordBank.ts
Shared contracts
- Contracts
packages/shared/src/index.ts
Persistence
- Persistence
apps/server/src/persistence/index.ts - Stored records
apps/server/src/persistence/models.ts
Other components
- Players
- MongoDB
Connections 19
- Players → Game UI: use game
README.md - Game UI → Socket client: sends actions
apps/web/src/App.tsx - Socket client → Event handlers: Socket.IO events
README.md - Server entry → Event handlers: registers
apps/server/src/index.ts - Event handlers → Room engine: dispatches actions
apps/server/src/socket/registerHandlers.ts - Room engine → Round rules: uses rules
apps/server/src/domain/roomManager.ts - Room engine → Word bank: selects words
apps/server/src/domain/roomManager.ts - Room engine → Chat moderation: creates engine
apps/server/src/domain/roomManager.ts - Room engine → Room chat: manages chat
apps/server/src/domain/roomManager.ts - Chat sync → Chat service: syncs history
apps/web/src/chat/useRoomChat.ts - Chat UI → Chat sync: renders chat
apps/web/src/components/chat/ChatBox.tsx - Game UI → Chat UI: shows chat
README.md - Chat service → Socket client: sends chat
apps/web/src/chat/chatService.ts - Event handlers → Contracts: validates events
apps/server/src/socket/registerHandlers.ts - Game UI → Contracts: uses game types
apps/web/src/App.tsx - Server entry → Persistence: initializes
apps/server/src/index.ts - Persistence → Stored records: uses models
apps/server/src/persistence/index.ts - Stored records → MongoDB: stores records
README.md - Players → MongoDB: optional storage
README.md