# bugvn/debug-escape-room architecture

> Architecture diagram of the GitHub repository bugvn/debug-escape-room, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bugvn/debug-escape-room
- Repository: https://github.com/bugvn/debug-escape-room

## Overview

REMEDIATE is a browser-based Python debugging escape-room game. Players create an account, choose a room, edit and run four buggy programs, submit fixes, and receive a score and report; saved play history informs later room difficulty and practice. The graph also includes the lesson, teacher analytics, integrity controls, and shared settings. The README documents the product flow; source-index references support only a few code-level links, so other implementation links are omitted or marked unverified rather than asserted.

Main entry points: [`game-room.html`](https://github.com/bugvn/debug-escape-room/blob/main/game-room.html) (Escape room), [`js/dashboard.js`](https://github.com/bugvn/debug-escape-room/blob/main/js/dashboard.js) (Game dashboard), [`sql/schema.sql`](https://github.com/bugvn/debug-escape-room/blob/main/sql/schema.sql) (Game history store), [`js/puzzles.js`](https://github.com/bugvn/debug-escape-room/blob/main/js/puzzles.js) (Puzzle bank)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_journey["Player journey"]
  node_landing["Landing and rules<br/>[index.html]"]
  node_lesson["Debugging lesson<br/>[lesson.html]"]
  node_dashboard["Game dashboard<br/>[dashboard.js]"]
end

subgraph group_gameplay["Puzzle gameplay"]
  node_room["Escape room<br/>[game-room.html]"]
  node_puzzles["Puzzle bank<br/>[puzzles.js]"]
  node_puzzledata["Puzzle content<br/>[puzzles.json]"]
  node_python["Browser Python<br/>[pyrunner.js]"]
  node_integrity["Fair-play controls<br/>[integrity.js]"]
  node_scoring["Scoring rules<br/>[score.js]"]
  node_adaptive["Adaptive room choice<br/>[adaptive.js]"]
end

subgraph group_records["Accounts and records"]
  node_login["Account access<br/>[login.js]"]
  node_auth[("Supabase auth")]
  node_history[("Game history store<br/>[schema.sql]")]
  node_progress["Progress tracking<br/>[progress.js]"]
  node_supabase[("Supabase service")]
end

subgraph group_insights["Reports and analytics"]
  node_summary["Game report<br/>[test-summary.html]"]
  node_analyticspage["Cohort analytics<br/>[analytics.html]"]
  node_analytics["Analytics analysis<br/>[analytics.js]"]
end

subgraph group_shared["Shared experience"]
  node_settings["Player settings<br/>[shared-settings.js]"]
  node_header["Shared navigation<br/>[site-header.js]"]
  node_music["Ambient music<br/>[ambient-music.js]"]
end

node_player(("Player"))

node_player -->|"opens"| node_landing
node_player -->|"signs in"| node_login
node_login -.->|"authenticates"| node_auth
node_player -->|"studies"| node_lesson
node_player -->|"starts game"| node_dashboard
node_dashboard -->|"opens room"| node_room
node_room -->|"loads bank"| node_puzzles
node_puzzles -->|"loads data"| node_puzzledata
node_room -.->|"runs code"| node_python
node_room -->|"enforces rules"| node_integrity
node_room -.->|"uses scoring"| node_scoring
node_dashboard -->|"calculates scores"| node_scoring
node_dashboard -->|"maps mistakes"| node_puzzles
node_room -.->|"saves game"| node_history
node_history -->|"persists to"| node_supabase
node_dashboard -.->|"reads history"| node_history
node_history -.->|"supplies outcomes"| node_adaptive
node_adaptive -->|"chooses puzzles"| node_puzzles
node_room -->|"shows results"| node_summary
node_player -->|"views cohort data"| node_analyticspage
node_analyticspage -.->|"analyzes data"| node_analytics
node_analytics -->|"uses categories"| node_puzzles
node_player -.->|"configures play"| node_settings
node_player -->|"navigates"| node_header
node_header -->|"reads mute state"| node_music
node_progress -.->|"tracks progress"| node_history

click node_landing "https://github.com/bugvn/debug-escape-room/blob/main/index.html"
click node_login "https://github.com/bugvn/debug-escape-room/blob/main/js/login.js"
click node_lesson "https://github.com/bugvn/debug-escape-room/blob/main/lesson.html"
click node_dashboard "https://github.com/bugvn/debug-escape-room/blob/main/js/dashboard.js"
click node_room "https://github.com/bugvn/debug-escape-room/blob/main/game-room.html"
click node_puzzles "https://github.com/bugvn/debug-escape-room/blob/main/js/puzzles.js"
click node_puzzledata "https://github.com/bugvn/debug-escape-room/blob/main/js/puzzles.json"
click node_python "https://github.com/bugvn/debug-escape-room/blob/main/js/pyrunner.js"
click node_integrity "https://github.com/bugvn/debug-escape-room/blob/main/js/integrity.js"
click node_scoring "https://github.com/bugvn/debug-escape-room/blob/main/js/score.js"
click node_adaptive "https://github.com/bugvn/debug-escape-room/blob/main/js/adaptive.js"
click node_history "https://github.com/bugvn/debug-escape-room/blob/main/sql/schema.sql"
click node_progress "https://github.com/bugvn/debug-escape-room/blob/main/js/progress.js"
click node_summary "https://github.com/bugvn/debug-escape-room/blob/main/test-summary.html"
click node_analyticspage "https://github.com/bugvn/debug-escape-room/blob/main/analytics.html"
click node_analytics "https://github.com/bugvn/debug-escape-room/blob/main/js/analytics.js"
click node_settings "https://github.com/bugvn/debug-escape-room/blob/main/js/shared-settings.js"
click node_header "https://github.com/bugvn/debug-escape-room/blob/main/js/site-header.js"
click node_music "https://github.com/bugvn/debug-escape-room/blob/main/js/ambient-music.js"

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_landing,node_lesson,node_dashboard toneBlue
class node_room,node_puzzles,node_puzzledata,node_python,node_integrity,node_scoring,node_adaptive toneAmber
class node_login,node_auth,node_history,node_progress,node_supabase toneMint
class node_summary,node_analyticspage,node_analytics toneRose
class node_settings,node_header,node_music,node_player toneIndigo
```

## Components

### Player journey

- [Landing and rules](https://github.com/bugvn/debug-escape-room/blob/main/index.html): `index.html`
- [Debugging lesson](https://github.com/bugvn/debug-escape-room/blob/main/lesson.html): `lesson.html`
- [Game dashboard](https://github.com/bugvn/debug-escape-room/blob/main/js/dashboard.js): `js/dashboard.js`

### Puzzle gameplay

- [Escape room](https://github.com/bugvn/debug-escape-room/blob/main/game-room.html): `game-room.html`
- [Puzzle bank](https://github.com/bugvn/debug-escape-room/blob/main/js/puzzles.js): `js/puzzles.js`
- [Puzzle content](https://github.com/bugvn/debug-escape-room/blob/main/js/puzzles.json): `js/puzzles.json`
- [Browser Python](https://github.com/bugvn/debug-escape-room/blob/main/js/pyrunner.js): `js/pyrunner.js`
- [Fair-play controls](https://github.com/bugvn/debug-escape-room/blob/main/js/integrity.js): `js/integrity.js`
- [Scoring rules](https://github.com/bugvn/debug-escape-room/blob/main/js/score.js): `js/score.js`
- [Adaptive room choice](https://github.com/bugvn/debug-escape-room/blob/main/js/adaptive.js): `js/adaptive.js`

### Accounts and records

- [Account access](https://github.com/bugvn/debug-escape-room/blob/main/js/login.js): `js/login.js`
- **Supabase auth**
- [Game history store](https://github.com/bugvn/debug-escape-room/blob/main/sql/schema.sql): `sql/schema.sql`
- [Progress tracking](https://github.com/bugvn/debug-escape-room/blob/main/js/progress.js): `js/progress.js`
- **Supabase service**

### Reports and analytics

- [Game report](https://github.com/bugvn/debug-escape-room/blob/main/test-summary.html): `test-summary.html`
- [Cohort analytics](https://github.com/bugvn/debug-escape-room/blob/main/analytics.html): `analytics.html`
- [Analytics analysis](https://github.com/bugvn/debug-escape-room/blob/main/js/analytics.js): `js/analytics.js`

### Shared experience

- [Player settings](https://github.com/bugvn/debug-escape-room/blob/main/js/shared-settings.js): `js/shared-settings.js`
- [Shared navigation](https://github.com/bugvn/debug-escape-room/blob/main/js/site-header.js): `js/site-header.js`
- [Ambient music](https://github.com/bugvn/debug-escape-room/blob/main/js/ambient-music.js): `js/ambient-music.js`

### Other components

- **Player**

## Connections

- Player → Landing and rules: opens (evidence: `README.md`)
- Player → Account access: signs in (evidence: `README.md`)
- Account access → Supabase auth: authenticates
- Player → Debugging lesson: studies (evidence: `README.md`)
- Player → Game dashboard: starts game (evidence: `README.md`)
- Game dashboard → Escape room: opens room (evidence: `README.md`)
- Escape room → Puzzle bank: loads bank (evidence: `js/puzzles.js`)
- Puzzle bank → Puzzle content: loads data (evidence: `js/puzzles.js`)
- Escape room → Browser Python: runs code
- Escape room → Fair-play controls: enforces rules (evidence: `js/integrity.js`)
- Escape room → Scoring rules: uses scoring
- Game dashboard → Scoring rules: calculates scores (evidence: `js/dashboard.js`)
- Game dashboard → Puzzle bank: maps mistakes (evidence: `js/dashboard.js`)
- Escape room → Game history store: saves game
- Game history store → Supabase service: persists to (evidence: `README.md`)
- Game dashboard → Game history store: reads history
- Game history store → Adaptive room choice: supplies outcomes
- Adaptive room choice → Puzzle bank: chooses puzzles (evidence: `js/adaptive.js`)
- Escape room → Game report: shows results (evidence: `README.md`)
- Player → Cohort analytics: views cohort data (evidence: `README.md`)
- Cohort analytics → Analytics analysis: analyzes data
- Analytics analysis → Puzzle bank: uses categories (evidence: `js/analytics.js`)
- Player → Player settings: configures play
- Player → Shared navigation: navigates (evidence: `js/site-header.js`)
- Shared navigation → Ambient music: reads mute state (evidence: `js/site-header.js`)
- Progress tracking → Game history store: tracks progress
