How xingjianwang001/coup_online works
Coup Online is a browser-based multiplayer Coup game. Players create or join a room, then send intents over Socket.IO; the server manages room membership and online-play concerns, while the pure engine validates and advances the authoritative game. Public state, private hands, and events return to each browser, where the client maintains session state and renders the table, rules, and localized narration. The README also documents computer players and temporary Cloudflare invite tunnels. Some client and server wiring is unsampled, so the graph omits uncertain links rather than inferring them.
Main entry points: App.tsx Game interface · index.ts Socket server · room.ts Room lifecycle · socket.ts Socket client
Components 21
Browser client
- Game interface
packages/client/src/App.tsx - Socket client
packages/client/src/socket.ts - Session state
packages/client/src/session.ts - Rules display
packages/client/src/rules.ts - Localization
packages/client/src/localization.ts - Game narration
packages/client/src/narration.ts - Invite copying
packages/client/src/clipboard.ts - Table animations
packages/client/src/motion.ts - Seat layout
packages/client/src/seating.ts
Room server
- Socket server
packages/server/src/index.ts - Room lifecycle
packages/server/src/room.ts - Game repository
packages/server/src/repository.ts - Computer players
packages/server/src/computer.ts - Room limits
packages/server/src/room-limits.ts - Client errors
packages/server/src/errors.ts - Invite tunnel
packages/server/src/tunnel.ts
Game domain
- Game rules engine
packages/engine/src/game.ts - Game state types
packages/engine/src/types.ts
Shared contract
- Intent and message protocol
packages/shared/src/protocol.ts
Other components
- Player
- Cloudflare Tunnel
Connections 24
- Player → Game interface: plays through
README.md - Game interface → Socket client: sends intents
packages/client/src/App.tsx - Game interface → Session state: rejoins with
packages/client/src/App.tsx - Game interface → Rules display: renders rules
packages/client/src/App.tsx - Game interface → Game narration: uses narration
packages/client/src/App.tsx - Game interface → Invite copying: uses copying
packages/client/src/App.tsx - Game interface → Table animations: uses animations
packages/client/src/App.tsx - Game interface → Seat layout: uses seat layout
packages/client/src/App.tsx - Game interface → Localization: renders localized text
packages/client/src/App.tsx - Game narration → Localization: translates events
packages/client/src/narration.ts - Game narration → Rules display: names actions
packages/client/src/narration.ts - Socket client → Socket server: connects by Socket.IO
README.md - Socket server → Room lifecycle: routes intents
packages/server/src/index.ts - Socket server → Game repository: creates repository
packages/server/src/index.ts - Socket server → Invite tunnel: starts tunnel
packages/server/src/index.ts - Socket server → Room limits: checks limits
packages/server/src/index.ts - Socket server → Client errors: converts errors
packages/server/src/index.ts - Room lifecycle → Game rules engine: applies game actions
packages/server/src/room.ts - Room lifecycle → Game repository: saves game state
packages/server/src/room.ts - Room lifecycle → Computer players: delegates decisions
packages/server/src/room.ts - Invite tunnel → Cloudflare Tunnel: starts Quick Tunnel
README.md - Game rules engine → Game state types: uses state types
packages/engine/src/game.ts - Session state → Intent and message protocol: reduces server messages
packages/client/src/session.ts - Socket client → Intent and message protocol: uses shared protocol
packages/client/src/socket.ts