How genarossi19/character-us-front works
CharacterUs is a React frontend for a social impostor game. The principal flow is: a player authenticates or joins by room code, configures or enters a room, waits for the lobby to start, then participates in server-authoritative word, debate, voting, and results stages. Socket hooks and Zustand stores form the key internal layer for commands and synchronized room/game state; HTTP handles authentication and category data. The README documents additional recovery, invitations, inactivity, and in-person play. Some page and event-handler implementations were not sampled, so links for those capabilities are shown only where the README documents them.
Main entry points: App.tsx Route shell · GameScreenV2.tsx Game screen · useSocketRoom.ts Room commands · useSocketGame.ts Game commands and events
Components 25
Entry and identity
- Route shell
src/App.tsx - Login and signup
src/pages - Identity state
src/store/useUserStore.ts - Auth API
src/services/api/auth.ts - Home and menu
src/pages
Room lifecycle
- Room creation
src/pages/CreateRoomPageV2.tsx - Category API
src/services/api/category.ts - Join by code
src/pages/QuickJoinScreenV2.tsx - Waiting room
src/pages/WaitingRoomV2.tsx - Room commands
src/hooks/useSocketRoom.ts - Room recovery
src/services/socket/roomRecovery.ts
Game experience
- Game screen
src/pages/GameScreenV2.tsx - Word turns
src/components/game/WordSubmission.tsx - Debate and chat
src/components/game/DebateChat.tsx - Voting
src/components/game/VotingPhase.tsx - Round and game results
src/components/game/RoundResults.tsx - Game commands and events
src/hooks/useSocketGame.ts
Client runtime
- HTTP client
src/services/api/client.ts - Room state
src/store/useRoomStore.ts - Recovery session
src/store/useRoomSessionStore.ts - Game state
src/store/useGameStore.ts - Socket facade
src/services/socket/index.ts - Socket connection
src/services/socket/socket.ts
Other components
- Player
- CharacterUs backend
Connections 35
- Player → Route shell: opens
src/App.tsx - Route shell → Login and signup: routes to
src/App.tsx - Route shell → Home and menu: routes to
src/App.tsx - Route shell → Room creation: routes to
src/App.tsx - Route shell → Join by code: routes to
src/App.tsx - Route shell → Waiting room: routes to
src/App.tsx - Route shell → Game screen: routes to
src/App.tsx - Login and signup → Identity state: updates
src/pages/SignupScreenV2.tsx - Identity state → Auth API: requests
src/store/useUserStore.ts - Auth API → HTTP client: uses
src/services/api/auth.ts - HTTP client → CharacterUs backend: HTTP requests
README.md - Room creation → Category API: loads categories
src/pages/CreateRoomPageV2.tsx - Room creation → Room commands: creates room
src/pages/CreateRoomPageV2.tsx - Join by code → Room commands: joins room
src/pages/QuickJoinScreenV2.tsx - Waiting room → Room commands: manages room
src/pages/WaitingRoomV2.tsx - Room commands → Socket facade: emits commands
src/hooks/useSocketRoom.ts - Socket facade → Socket connection: uses connection
src/services/socket/index.ts - Socket connection → CharacterUs backend: Socket.IO
README.md - Room commands → Room state: updates
src/hooks/useSocketRoom.ts - Waiting room → CharacterUs backend: server lobby contract
README.md - Game screen → Game commands and events: uses
README.md - Game commands and events → Socket facade: emits and listens
src/hooks/useSocketGame.ts - Game commands and events → Game state: updates
src/hooks/useSocketGame.ts - Game commands and events → Room state: reads room
src/hooks/useSocketGame.ts - Game screen → Word turns: presents
README.md - Game screen → Debate and chat: presents
README.md - Game screen → Voting: presents
README.md - Game screen → Round and game results: presents
README.md - Player → Word turns: submits clue
README.md - Player → Debate and chat: debates
README.md - Player → Voting: votes
README.md - Room recovery → Recovery session: reads credential
src/services/socket/roomRecovery.ts - Player → Room recovery: restores room
README.md - CharacterUs backend → Room state: room updates
README.md - CharacterUs backend → Game state: game events
README.md