# avedtek/cheetcode architecture

> Architecture diagram of the GitHub repository avedtek/cheetcode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/avedtek/cheetcode
- Repository: https://github.com/avedtek/cheetcode

## Overview

CheetCode is a real-time multiplayer coding party game. A player creates a room, others join its lobby, then the server runs briefing, turn-based coding and test execution, voting, and result/rematch stages while broadcasting updates to clients. The frontend separates room and game state from its WebSocket transport. The graph includes documented gameplay branches and the indexed core modules; some backend handlers and test-runner internals were not excerpted, so uncertain links are omitted.

Main entry points: [`frontend/src/pages/Game.tsx`](https://github.com/avedtek/cheetcode/blob/main/frontend/src/pages/Game.tsx) (Game page), [`frontend/src/contexts/SocketContext.tsx`](https://github.com/avedtek/cheetcode/blob/main/frontend/src/contexts/SocketContext.tsx) (WebSocket client), [`frontend/src/pages/Welcome.tsx`](https://github.com/avedtek/cheetcode/blob/main/frontend/src/pages/Welcome.tsx) (Welcome page), [`backend/models/game.py`](https://github.com/avedtek/cheetcode/blob/main/backend/models/game.py) (Game rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Frontend experience"]
  node_app["App routing<br/>[App.tsx]"]
  node_welcome["Welcome page<br/>[Welcome.tsx]"]
  node_create["Create room<br/>[CreateForm.tsx]"]
  node_join["Join room<br/>[JoinForm.tsx]"]
  node_info["Game info<br/>[Info.tsx]"]
  node_lobby["Lobby page<br/>[Lobby.tsx]"]
  node_lobby_game["Lobby platformer"]
  node_game_page["Game page<br/>[Game.tsx]"]
  node_briefing["Briefing panel<br/>[BriefingPanel.tsx]"]
  node_problem_panel["Problem panel<br/>[ProblemPanel.tsx]"]
  node_editor["Code editor<br/>[EditorPanel.tsx]"]
  node_console["Test console<br/>[ConsolePanel.tsx]"]
  node_commit_panel["Commit panel<br/>[CommitPanel.tsx]"]
  node_voting["Voting panel<br/>[VoteSideBar.tsx]"]
  node_results["Results panel<br/>[ResultsPanel.tsx]"]
  node_room_context["Room state<br/>[RoomContext.tsx]"]
  node_game_context["Game state<br/>[GameContext.tsx]"]
end

subgraph group_transport["Realtime transport"]
  node_socket_context["WebSocket client<br/>[SocketContext.tsx]"]
  node_server["WebSocket server<br/>[server.py]"]
end

subgraph group_rooms["Rooms and players"]
  node_room_manager["Room registry<br/>[roomManager.py]"]
  node_room["Room state<br/>[room.py]"]
  node_player_model["Player model<br/>[player.py]"]
end

subgraph group_gameplay["Game lifecycle"]
  node_game["Game rules<br/>[game.py]"]
  node_time_manager["Phase timers<br/>[timeManager.py]"]
end

subgraph group_execution["Problem and testing"]
  node_problem_data["Problem catalog<br/>[problems.json]"]
  node_test_runner["Test runner<br/>[testRunner.py]"]
end

node_player_actor(("Player"))

node_player_actor -->|"creates or joins"| node_welcome
node_app -->|"routes to"| node_welcome
node_app -->|"routes to"| node_lobby
node_app -->|"routes to"| node_game_page
node_welcome -->|"renders"| node_create
node_welcome -->|"renders"| node_join
node_welcome -->|"renders"| node_info
node_create -->|"sends requests"| node_socket_context
node_join -->|"sends requests"| node_socket_context
node_lobby -->|"renders"| node_lobby_game
node_lobby -->|"reads and updates"| node_room_context
node_lobby_game -->|"exchanges updates"| node_socket_context
node_lobby_game -->|"reads room state"| node_room_context
node_game_page -->|"renders"| node_briefing
node_game_page -->|"renders"| node_problem_panel
node_game_page -->|"renders"| node_editor
node_game_page -->|"renders"| node_commit_panel
node_game_page -->|"renders"| node_voting
node_game_page -->|"renders"| node_results
node_editor -->|"renders"| node_console
node_editor -->|"sends requests"| node_socket_context
node_console -->|"sends requests"| node_socket_context
node_game_page -->|"reads game state"| node_game_context
node_room_context -->|"subscribes to messages"| node_socket_context
node_game_context -->|"sends and subscribes"| node_socket_context
node_socket_context -->|"exchanges messages"| node_server
node_server -->|"manages rooms"| node_room_manager
node_room_manager -->|"creates and stores"| node_room
node_room -->|"creates players"| node_player_model
node_room -->|"creates game"| node_game
node_game -->|"starts phase timers"| node_time_manager
node_game -->|"runs tests"| node_test_runner
node_game -.->|"loads problem data"| node_problem_data
node_time_manager -->|"broadcasts timer updates"| node_room

click node_app "https://github.com/avedtek/cheetcode/blob/main/frontend/src/App.tsx"
click node_welcome "https://github.com/avedtek/cheetcode/blob/main/frontend/src/pages/Welcome.tsx"
click node_create "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/CreateForm.tsx"
click node_join "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/JoinForm.tsx"
click node_info "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/Info.tsx"
click node_lobby "https://github.com/avedtek/cheetcode/blob/main/frontend/src/pages/Lobby.tsx"
click node_lobby_game "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/LobbyPlatformer.tsx"
click node_game_page "https://github.com/avedtek/cheetcode/blob/main/frontend/src/pages/Game.tsx"
click node_briefing "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/BriefingPanel.tsx"
click node_problem_panel "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/ProblemPanel.tsx"
click node_editor "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/EditorPanel.tsx"
click node_console "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/ConsolePanel.tsx"
click node_commit_panel "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/CommitPanel.tsx"
click node_voting "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/VoteSideBar.tsx"
click node_results "https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/ResultsPanel.tsx"
click node_room_context "https://github.com/avedtek/cheetcode/blob/main/frontend/src/contexts/RoomContext.tsx"
click node_game_context "https://github.com/avedtek/cheetcode/blob/main/frontend/src/contexts/GameContext.tsx"
click node_socket_context "https://github.com/avedtek/cheetcode/blob/main/frontend/src/contexts/SocketContext.tsx"
click node_server "https://github.com/avedtek/cheetcode/blob/main/backend/server.py"
click node_room_manager "https://github.com/avedtek/cheetcode/blob/main/backend/managers/roomManager.py"
click node_room "https://github.com/avedtek/cheetcode/blob/main/backend/models/room.py"
click node_player_model "https://github.com/avedtek/cheetcode/blob/main/backend/models/player.py"
click node_game "https://github.com/avedtek/cheetcode/blob/main/backend/models/game.py"
click node_time_manager "https://github.com/avedtek/cheetcode/blob/main/backend/managers/timeManager.py"
click node_problem_data "https://github.com/avedtek/cheetcode/blob/main/backend/data/problems.json"
click node_test_runner "https://github.com/avedtek/cheetcode/blob/main/backend/managers/testRunner.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_welcome,node_create,node_join,node_info,node_lobby,node_lobby_game,node_game_page,node_briefing,node_problem_panel,node_editor,node_console,node_commit_panel,node_voting,node_results,node_room_context,node_game_context toneBlue
class node_socket_context,node_server toneAmber
class node_room_manager,node_room,node_player_model toneMint
class node_game,node_time_manager toneRose
class node_problem_data,node_test_runner,node_player_actor toneIndigo
```

## Components

### Frontend experience

- [App routing](https://github.com/avedtek/cheetcode/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Welcome page](https://github.com/avedtek/cheetcode/blob/main/frontend/src/pages/Welcome.tsx): `frontend/src/pages/Welcome.tsx`
- [Create room](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/CreateForm.tsx): `frontend/src/components/CreateForm.tsx`
- [Join room](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/JoinForm.tsx): `frontend/src/components/JoinForm.tsx`
- [Game info](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/Info.tsx): `frontend/src/components/Info.tsx`
- [Lobby page](https://github.com/avedtek/cheetcode/blob/main/frontend/src/pages/Lobby.tsx): `frontend/src/pages/Lobby.tsx`
- [Lobby platformer](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/LobbyPlatformer.tsx): `frontend/src/components/LobbyPlatformer.tsx`
- [Game page](https://github.com/avedtek/cheetcode/blob/main/frontend/src/pages/Game.tsx): `frontend/src/pages/Game.tsx`
- [Briefing panel](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/BriefingPanel.tsx): `frontend/src/components/BriefingPanel.tsx`
- [Problem panel](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/ProblemPanel.tsx): `frontend/src/components/ProblemPanel.tsx`
- [Code editor](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/EditorPanel.tsx): `frontend/src/components/EditorPanel.tsx`
- [Test console](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/ConsolePanel.tsx): `frontend/src/components/ConsolePanel.tsx`
- [Commit panel](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/CommitPanel.tsx): `frontend/src/components/CommitPanel.tsx`
- [Voting panel](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/VoteSideBar.tsx): `frontend/src/components/VoteSideBar.tsx`
- [Results panel](https://github.com/avedtek/cheetcode/blob/main/frontend/src/components/ResultsPanel.tsx): `frontend/src/components/ResultsPanel.tsx`
- [Room state](https://github.com/avedtek/cheetcode/blob/main/frontend/src/contexts/RoomContext.tsx): `frontend/src/contexts/RoomContext.tsx`
- [Game state](https://github.com/avedtek/cheetcode/blob/main/frontend/src/contexts/GameContext.tsx): `frontend/src/contexts/GameContext.tsx`

### Realtime transport

- [WebSocket client](https://github.com/avedtek/cheetcode/blob/main/frontend/src/contexts/SocketContext.tsx): `frontend/src/contexts/SocketContext.tsx`
- [WebSocket server](https://github.com/avedtek/cheetcode/blob/main/backend/server.py): `backend/server.py`

### Rooms and players

- [Room registry](https://github.com/avedtek/cheetcode/blob/main/backend/managers/roomManager.py): `backend/managers/roomManager.py`
- [Room state](https://github.com/avedtek/cheetcode/blob/main/backend/models/room.py): `backend/models/room.py`
- [Player model](https://github.com/avedtek/cheetcode/blob/main/backend/models/player.py): `backend/models/player.py`

### Game lifecycle

- [Game rules](https://github.com/avedtek/cheetcode/blob/main/backend/models/game.py): `backend/models/game.py`
- [Phase timers](https://github.com/avedtek/cheetcode/blob/main/backend/managers/timeManager.py): `backend/managers/timeManager.py`

### Problem and testing

- [Problem catalog](https://github.com/avedtek/cheetcode/blob/main/backend/data/problems.json): `backend/data/problems.json`
- [Test runner](https://github.com/avedtek/cheetcode/blob/main/backend/managers/testRunner.py): `backend/managers/testRunner.py`

### Other components

- **Player**

## Connections

- Player → Welcome page: creates or joins (evidence: `README.md`)
- App routing → Welcome page: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Lobby page: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Game page: routes to (evidence: `frontend/src/App.tsx`)
- Welcome page → Create room: renders (evidence: `frontend/src/pages/Welcome.tsx`)
- Welcome page → Join room: renders (evidence: `frontend/src/pages/Welcome.tsx`)
- Welcome page → Game info: renders (evidence: `frontend/src/pages/Welcome.tsx`)
- Create room → WebSocket client: sends requests (evidence: `frontend/src/components/CreateForm.tsx`)
- Join room → WebSocket client: sends requests (evidence: `frontend/src/components/JoinForm.tsx`)
- Lobby page → Lobby platformer: renders (evidence: `frontend/src/pages/Lobby.tsx`)
- Lobby page → Room state: reads and updates (evidence: `frontend/src/pages/Lobby.tsx`)
- Lobby platformer → WebSocket client: exchanges updates (evidence: `frontend/src/components/LobbyPlatformer.tsx`)
- Lobby platformer → Room state: reads room state (evidence: `frontend/src/components/LobbyPlatformer.tsx`)
- Game page → Briefing panel: renders (evidence: `frontend/src/pages/Game.tsx`)
- Game page → Problem panel: renders (evidence: `frontend/src/pages/Game.tsx`)
- Game page → Code editor: renders (evidence: `frontend/src/pages/Game.tsx`)
- Game page → Commit panel: renders (evidence: `frontend/src/pages/Game.tsx`)
- Game page → Voting panel: renders (evidence: `frontend/src/pages/Game.tsx`)
- Game page → Results panel: renders (evidence: `frontend/src/pages/Game.tsx`)
- Code editor → Test console: renders (evidence: `frontend/src/components/EditorPanel.tsx`)
- Code editor → WebSocket client: sends requests (evidence: `frontend/src/components/EditorPanel.tsx`)
- Test console → WebSocket client: sends requests (evidence: `frontend/src/components/ConsolePanel.tsx`)
- Game page → Game state: reads game state (evidence: `frontend/src/pages/Game.tsx`)
- Room state → WebSocket client: subscribes to messages (evidence: `frontend/src/contexts/RoomContext.tsx`)
- Game state → WebSocket client: sends and subscribes (evidence: `frontend/src/contexts/GameContext.tsx`)
- WebSocket client → WebSocket server: exchanges messages (evidence: `README.md`)
- WebSocket server → Room registry: manages rooms (evidence: `backend/server.py`)
- Room registry → Room state: creates and stores (evidence: `backend/managers/roomManager.py`)
- Room state → Player model: creates players (evidence: `backend/models/room.py`)
- Room state → Game rules: creates game (evidence: `backend/models/room.py`)
- Game rules → Phase timers: starts phase timers (evidence: `backend/models/game.py`)
- Game rules → Test runner: runs tests (evidence: `backend/models/game.py`)
- Game rules → Problem catalog: loads problem data
- Phase timers → Room state: broadcasts timer updates (evidence: `backend/managers/timeManager.py`)
