# arooshdatta/escapethecompiler architecture

> Architecture diagram of the GitHub repository arooshdatta/escapethecompiler, 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/arooshdatta/escapethecompiler
- Repository: https://github.com/arooshdatta/escapethecompiler

## Overview

Escape the Compiler is a team-based coding escape-room tournament. Teams register or sign in, progress through five timed rooms by submitting code, earn hints and scores, then assemble the vault code and word to escape; standings and organizer tools expose tournament progress. The frontend presents play, team, leaderboard, login, and admin experiences through the API. Backend routes delegate game rules to services, which use room content, execution runners, scoring/timers, and repository persistence. README documents cloud runner fallback and legacy mode; their precise wiring is not fully shown in the excerpts.

Main entry points: [`frontend/src/routes.tsx`](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/routes.tsx) (App routes), [`backend/app/main.py`](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/main.py) (FastAPI app), [`frontend/src/lib/api.ts`](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/lib/api.ts) (API client), [`backend/app/services/game.py`](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/game.py) (Game rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Player and Organizer UI"]
  node_routes["App routes<br/>[routes.tsx]"]
  node_play["Room play UI<br/>[PlayPage.tsx]"]
  node_game_widgets["Game controls"]
  node_game_hooks["Game state hooks<br/>[useGameState.ts]"]
  node_login["Team sign-in<br/>[LoginPage.tsx]"]
  node_auth_ui["Auth context<br/>[auth.tsx]"]
  node_teams_ui["Team directory<br/>[TeamsPage.tsx]"]
  node_team_detail["Team details<br/>[TeamDetailPage.tsx]"]
  node_leaderboard_ui["Leaderboard"]
  node_admin_ui["Admin console<br/>[AdminPage.tsx]"]
  node_legacy["Legacy game<br/>[LegacyPage.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API and Identity"]
  node_auth_routes["Auth routes<br/>[auth.py]"]
  node_game_routes["Game routes<br/>[game.py]"]
  node_room_routes["Room catalog route<br/>[rooms.py]"]
  node_team_routes["Team routes<br/>[teams.py]"]
  node_leaderboard_routes["Leaderboard route<br/>[leaderboard.py]"]
  node_admin_routes["Admin routes<br/>[admin.py]"]
  node_app["FastAPI app<br/>[main.py]"]
  node_identity["Auth and tokens<br/>[security.py]"]
end

subgraph group_game["Escape Game"]
  node_game_service["Game rules<br/>[game.py]"]
  node_room_content["Five room puzzles<br/>[rooms.py]"]
  node_scoring["Score calculation<br/>[scoring.py]"]
  node_timers["Room timers<br/>[timers.py]"]
  node_standings["Standings builder<br/>[standings.py]"]
end

subgraph group_execution["Code Execution"]
  node_runner_dispatch["Runner dispatch<br/>[code_runner.py]"]
  node_js_runner["JavaScript sandbox<br/>[js_runner.py]"]
  node_cpp_runner["C++ sandbox<br/>[cpp_runner.py]"]
  node_java_runner["Java sandbox<br/>[java_runner.py]"]
  node_python_runner["Python sandbox<br/>[python_runner.py]"]
end

subgraph group_state["Tournament State"]
end

node_teams(("Players"))
node_organizer(("Organizer"))
node_node["Node.js runtime"]
node_cloud_runner["Cloud compiler"]

node_teams -->|"use"| node_routes
node_organizer -->|"use"| node_routes
node_routes -->|"routes to"| node_play
node_routes -->|"routes to"| node_login
node_routes -->|"routes to"| node_teams_ui
node_routes -->|"routes to"| node_team_detail
node_routes -->|"routes to"| node_leaderboard_ui
node_routes -->|"routes to"| node_admin_ui
node_routes -->|"routes to"| node_legacy
node_login -->|"authenticates via"| node_auth_ui
node_play -->|"reads state"| node_game_hooks
node_play -.->|"renders"| node_game_widgets
node_game_hooks -.->|"requests state"| node_api_client
node_login -.->|"submits credentials"| node_api_client
node_teams_ui -.->|"requests teams"| node_api_client
node_team_detail -.->|"requests detail"| node_api_client
node_leaderboard_ui -.->|"requests standings"| node_api_client
node_admin_ui -.->|"admin requests"| node_api_client
node_api_client -.->|"HTTP API"| node_app
node_app -->|"registers"| node_auth_routes
node_app -->|"registers"| node_game_routes
node_app -->|"registers"| node_room_routes
node_app -->|"registers"| node_team_routes
node_app -->|"registers"| node_leaderboard_routes
node_app -->|"registers"| node_admin_routes
node_auth_routes -->|"checks and issues tokens"| node_identity
node_auth_routes -->|"calculates team score"| node_scoring
node_game_routes -->|"delegates game actions"| node_game_service
node_room_routes -->|"serves rooms"| node_room_content
node_leaderboard_routes -->|"builds standings"| node_standings
node_team_routes -->|"builds team summaries"| node_standings
node_admin_routes -->|"summarizes teams"| node_standings
node_game_service -->|"runs submissions"| node_runner_dispatch
node_game_service -->|"loads puzzle data"| node_room_content
node_game_service -->|"scores progress"| node_scoring
node_game_service -->|"checks deadlines"| node_timers
node_standings -->|"calculates scores"| node_scoring
node_standings -->|"derives room status"| node_timers
node_runner_dispatch -->|"dispatches JS"| node_js_runner
node_runner_dispatch -->|"dispatches C++"| node_cpp_runner
node_runner_dispatch -->|"dispatches Java"| node_java_runner
node_runner_dispatch -->|"dispatches Python"| node_python_runner
node_js_runner -->|"runs locally"| node_node
node_js_runner -.->|"fallback"| node_cloud_runner
node_cpp_runner -.->|"fallback"| node_cloud_runner
node_java_runner -.->|"fallback"| node_cloud_runner

click node_routes "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/routes.tsx"
click node_play "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/PlayPage.tsx"
click node_game_widgets "https://github.com/arooshdatta/escapethecompiler/tree/main/frontend/src/components/game"
click node_game_hooks "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/hooks/useGameState.ts"
click node_login "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/LoginPage.tsx"
click node_auth_ui "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/lib/auth.tsx"
click node_teams_ui "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/TeamsPage.tsx"
click node_team_detail "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/TeamDetailPage.tsx"
click node_leaderboard_ui "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/LeaderboardPage.tsx"
click node_admin_ui "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/AdminPage.tsx"
click node_legacy "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/LegacyPage.tsx"
click node_api_client "https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/lib/api.ts"
click node_auth_routes "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/auth.py"
click node_game_routes "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/game.py"
click node_room_routes "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/rooms.py"
click node_team_routes "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/teams.py"
click node_leaderboard_routes "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/leaderboard.py"
click node_admin_routes "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/admin.py"
click node_app "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/main.py"
click node_identity "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/security.py"
click node_game_service "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/game.py"
click node_room_content "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/content/rooms.py"
click node_scoring "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/scoring.py"
click node_timers "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/timers.py"
click node_standings "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/standings.py"
click node_runner_dispatch "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/code_runner.py"
click node_js_runner "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/js_runner.py"
click node_cpp_runner "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/runners/cpp_runner.py"
click node_java_runner "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/runners/java_runner.py"
click node_python_runner "https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/runners/python_runner.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_routes,node_play,node_game_widgets,node_game_hooks,node_login,node_auth_ui,node_teams_ui,node_team_detail,node_leaderboard_ui,node_admin_ui,node_legacy,node_api_client toneBlue
class node_auth_routes,node_game_routes,node_room_routes,node_team_routes,node_leaderboard_routes,node_admin_routes,node_app,node_identity toneAmber
class node_game_service,node_room_content,node_scoring,node_timers,node_standings toneMint
class node_runner_dispatch,node_js_runner,node_cpp_runner,node_java_runner,node_python_runner toneRose
class node_teams,node_organizer,node_node,node_cloud_runner toneIndigo
```

## Components

### Player and Organizer UI

- [App routes](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/routes.tsx): `frontend/src/routes.tsx`
- [Room play UI](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/PlayPage.tsx): `frontend/src/pages/PlayPage.tsx`
- [Game controls](https://github.com/arooshdatta/escapethecompiler/tree/main/frontend/src/components/game): `frontend/src/components/game`
- [Game state hooks](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/hooks/useGameState.ts): `frontend/src/hooks/useGameState.ts`
- [Team sign-in](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [Auth context](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/lib/auth.tsx): `frontend/src/lib/auth.tsx`
- [Team directory](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/TeamsPage.tsx): `frontend/src/pages/TeamsPage.tsx`
- [Team details](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/TeamDetailPage.tsx): `frontend/src/pages/TeamDetailPage.tsx`
- [Leaderboard](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/LeaderboardPage.tsx): `frontend/src/pages/LeaderboardPage.tsx`
- [Admin console](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/AdminPage.tsx): `frontend/src/pages/AdminPage.tsx`
- [Legacy game](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/pages/LegacyPage.tsx): `frontend/src/pages/LegacyPage.tsx`
- [API client](https://github.com/arooshdatta/escapethecompiler/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### API and Identity

- [Auth routes](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Game routes](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/game.py): `backend/app/routers/game.py`
- [Room catalog route](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/rooms.py): `backend/app/routers/rooms.py`
- [Team routes](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/teams.py): `backend/app/routers/teams.py`
- [Leaderboard route](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/leaderboard.py): `backend/app/routers/leaderboard.py`
- [Admin routes](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/routers/admin.py): `backend/app/routers/admin.py`
- [FastAPI app](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/main.py): `backend/app/main.py`
- [Auth and tokens](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/security.py): `backend/app/security.py`

### Escape Game

- [Game rules](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/game.py): `backend/app/services/game.py`
- [Five room puzzles](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/content/rooms.py): `backend/app/content/rooms.py`
- [Score calculation](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/scoring.py): `backend/app/services/scoring.py`
- [Room timers](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/timers.py): `backend/app/services/timers.py`
- [Standings builder](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/standings.py): `backend/app/services/standings.py`

### Code Execution

- [Runner dispatch](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/code_runner.py): `backend/app/services/code_runner.py`
- [JavaScript sandbox](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/js_runner.py): `backend/app/services/js_runner.py`
- [C++ sandbox](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/runners/cpp_runner.py): `backend/app/services/runners/cpp_runner.py`
- [Java sandbox](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/runners/java_runner.py): `backend/app/services/runners/java_runner.py`
- [Python sandbox](https://github.com/arooshdatta/escapethecompiler/blob/main/backend/app/services/runners/python_runner.py): `backend/app/services/runners/python_runner.py`

### Other components

- **Players**
- **Organizer**
- **Node.js runtime**
- **Cloud compiler**

## Connections

- Players → App routes: use
- Organizer → App routes: use
- App routes → Room play UI: routes to (evidence: `frontend/src/routes.tsx`)
- App routes → Team sign-in: routes to (evidence: `frontend/src/routes.tsx`)
- App routes → Team directory: routes to (evidence: `frontend/src/routes.tsx`)
- App routes → Team details: routes to (evidence: `frontend/src/routes.tsx`)
- App routes → Leaderboard: routes to (evidence: `frontend/src/routes.tsx`)
- App routes → Admin console: routes to (evidence: `frontend/src/routes.tsx`)
- App routes → Legacy game: routes to
- Team sign-in → Auth context: authenticates via (evidence: `frontend/src/lib/auth.tsx`)
- Room play UI → Game state hooks: reads state (evidence: `frontend/src/hooks/useGameState.ts`)
- Room play UI → Game controls: renders
- Game state hooks → API client: requests state
- Team sign-in → API client: submits credentials
- Team directory → API client: requests teams
- Team details → API client: requests detail
- Leaderboard → API client: requests standings
- Admin console → API client: admin requests
- API client → FastAPI app: HTTP API
- FastAPI app → Auth routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Game routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Room catalog route: registers (evidence: `backend/app/main.py`)
- FastAPI app → Team routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Leaderboard route: registers (evidence: `backend/app/main.py`)
- FastAPI app → Admin routes: registers (evidence: `backend/app/main.py`)
- Auth routes → Auth and tokens: checks and issues tokens (evidence: `backend/app/routers/auth.py`)
- Auth routes → Score calculation: calculates team score (evidence: `backend/app/routers/auth.py`)
- Game routes → Game rules: delegates game actions (evidence: `backend/app/routers/game.py`)
- Room catalog route → Five room puzzles: serves rooms (evidence: `backend/app/routers/rooms.py`)
- Leaderboard route → Standings builder: builds standings (evidence: `backend/app/routers/leaderboard.py`)
- Team routes → Standings builder: builds team summaries (evidence: `backend/app/routers/teams.py`)
- Admin routes → Standings builder: summarizes teams (evidence: `backend/app/routers/admin.py`)
- Game rules → Runner dispatch: runs submissions (evidence: `backend/app/services/game.py`)
- Game rules → Five room puzzles: loads puzzle data (evidence: `backend/app/services/game.py`)
- Game rules → Score calculation: scores progress (evidence: `backend/app/services/game.py`)
- Game rules → Room timers: checks deadlines (evidence: `backend/app/services/game.py`)
- Standings builder → Score calculation: calculates scores (evidence: `backend/app/services/standings.py`)
- Standings builder → Room timers: derives room status (evidence: `backend/app/services/standings.py`)
- Runner dispatch → JavaScript sandbox: dispatches JS (evidence: `backend/app/services/code_runner.py`)
- Runner dispatch → C++ sandbox: dispatches C++ (evidence: `backend/app/services/code_runner.py`)
- Runner dispatch → Java sandbox: dispatches Java (evidence: `backend/app/services/code_runner.py`)
- Runner dispatch → Python sandbox: dispatches Python (evidence: `backend/app/services/code_runner.py`)
- JavaScript sandbox → Node.js runtime: runs locally (evidence: `backend/app/services/js_runner.py`)
- JavaScript sandbox → Cloud compiler: fallback
- C++ sandbox → Cloud compiler: fallback
- Java sandbox → Cloud compiler: fallback
