# santiago-veloza/codesquest architecture

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

- Interactive diagram: https://gitdiagram.com/santiago-veloza/codesquest
- Repository: https://github.com/santiago-veloza/codesquest

## Overview

CODEQUEST is an educational Python-learning platform: students create accounts, explore worlds and challenges, run code locally, and submit attempts for server-side validation and rewards. The documented product also includes a Godot labyrinth, progress tracking, achievements, and account/privacy flows. The tree contains no Godot or content data directories, and most backend views and services were not sampled; those relationships are shown only where documented, or omitted when their wiring cannot be established.

Main entry points: [`frontend/src/app/router.tsx`](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/app/router.tsx) (Routes and guards), [`frontend/src/api/cliente.ts`](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/api/cliente.ts) (HTTP client), [`frontend/src/paginas/desafio/useEjecucion.ts`](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/desafio/useEjecucion.ts) (Attempt workflow), [`backend/apps/progreso/servicios.py`](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/progreso/servicios.py) (Progress services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Application shell<br/>[main.tsx]"]
  node_routing["Routes and guards<br/>[router.tsx]"]
  node_session["Session state<br/>[sesion.ts]"]
  node_api_client["HTTP client<br/>[cliente.ts]"]
  node_account_ui["Account screens<br/>[Registro.tsx]"]
end

subgraph group_learning["Learning experience"]
  node_map_ui["World map<br/>[Mapa.tsx]"]
  node_world_ui["World labyrinth<br/>[MundoLaberinto.tsx]"]
  node_challenge_ui["Challenge screen<br/>[Desafio.tsx]"]
  node_execution_flow["Attempt workflow<br/>[useEjecucion.ts]"]
  node_achievements_ui["Achievements<br/>[Logros.tsx]"]
  node_godot_game["Godot game"]
end

subgraph group_backend["Backend API"]
  node_api_routes["API routes<br/>[urls.py]"]
  node_progress_views["Progress endpoints<br/>[views.py]"]
  node_gamification_views["Gamification endpoints<br/>[views.py]"]
  node_db[("PostgreSQL")]
end

subgraph group_domain["Game domain"]
  node_content_models[("World and challenge data<br/>[models.py]")]
  node_content_loader["Content loader<br/>[carga.py]"]
  node_labyrinth_logic["Labyrinth generation<br/>[laberinto.py]"]
  node_user_domain["Accounts and security<br/>[servicios.py]"]
  node_progress_domain["Progress services<br/>[servicios.py]"]
  node_gamification_domain["Rewards and achievements<br/>[servicios.py]"]
end

subgraph group_runtime["Code runtime"]
  node_evaluator["Challenge evaluator<br/>[evaluador.ts]"]
  node_python_runner["Python runner<br/>[EjecutorPython.ts]"]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"mounts"| node_routing
node_routing -->|"routes to"| node_account_ui
node_routing -->|"routes to"| node_map_ui
node_routing -->|"routes to"| node_world_ui
node_routing -->|"routes to"| node_challenge_ui
node_account_ui -->|"starts session"| node_session
node_session -->|"provides token"| node_api_client
node_map_ui -.->|"requests worlds"| node_api_client
node_challenge_ui -.->|"runs attempt"| node_execution_flow
node_execution_flow -->|"evaluates code"| node_evaluator
node_execution_flow -->|"executes code"| node_python_runner
node_execution_flow -->|"registers attempt"| node_api_client
node_api_client -->|"calls API"| node_api_routes
node_api_routes -.->|"routes requests"| node_progress_views
node_progress_views -.->|"handles progress"| node_progress_domain
node_progress_domain -.->|"persists progress"| node_db
node_progress_domain -.->|"awards rewards"| node_gamification_domain
node_gamification_views -.->|"serves achievements"| node_gamification_domain
node_achievements_ui -.->|"loads achievements"| node_api_client
node_content_loader -->|"loads records"| node_content_models
node_content_loader -->|"builds labyrinths"| node_labyrinth_logic
node_content_models -.->|"stores content"| node_db
node_world_ui -.->|"embeds game"| node_godot_game
node_progress_domain -.->|"checks challenges"| node_content_models
node_user_domain -.->|"stores accounts"| node_db

click node_app "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/main.tsx"
click node_routing "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/app/router.tsx"
click node_session "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/estado/sesion.ts"
click node_api_client "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/api/cliente.ts"
click node_account_ui "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/Registro.tsx"
click node_map_ui "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/Mapa.tsx"
click node_world_ui "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/laberinto/MundoLaberinto.tsx"
click node_challenge_ui "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/desafio/Desafio.tsx"
click node_execution_flow "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/desafio/useEjecucion.ts"
click node_achievements_ui "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/Logros.tsx"
click node_evaluator "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/motor/evaluador.ts"
click node_python_runner "https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/motor/EjecutorPython.ts"
click node_content_models "https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/contenido/models.py"
click node_content_loader "https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/contenido/carga.py"
click node_labyrinth_logic "https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/contenido/laberinto.py"
click node_user_domain "https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/usuarios/servicios.py"
click node_progress_domain "https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/progreso/servicios.py"
click node_gamification_domain "https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/gamificacion/servicios.py"
click node_api_routes "https://github.com/santiago-veloza/codesquest/blob/main/backend/config/urls.py"
click node_progress_views "https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/progreso/views.py"
click node_gamification_views "https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/gamificacion/views.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_routing,node_session,node_api_client,node_account_ui toneBlue
class node_map_ui,node_world_ui,node_challenge_ui,node_execution_flow,node_achievements_ui,node_godot_game toneAmber
class node_api_routes,node_progress_views,node_gamification_views,node_db toneMint
class node_content_models,node_content_loader,node_labyrinth_logic,node_user_domain,node_progress_domain,node_gamification_domain toneRose
class node_evaluator,node_python_runner,node_student toneIndigo
```

## Components

### Web client

- [Application shell](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Routes and guards](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/app/router.tsx): `frontend/src/app/router.tsx`
- [Session state](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/estado/sesion.ts): `frontend/src/estado/sesion.ts`
- [HTTP client](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/api/cliente.ts): `frontend/src/api/cliente.ts`
- [Account screens](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/Registro.tsx): `frontend/src/paginas/Registro.tsx`

### Learning experience

- [World map](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/Mapa.tsx): `frontend/src/paginas/Mapa.tsx`
- [World labyrinth](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/laberinto/MundoLaberinto.tsx): `frontend/src/paginas/laberinto/MundoLaberinto.tsx`
- [Challenge screen](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/desafio/Desafio.tsx): `frontend/src/paginas/desafio/Desafio.tsx`
- [Attempt workflow](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/desafio/useEjecucion.ts): `frontend/src/paginas/desafio/useEjecucion.ts`
- [Achievements](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/paginas/Logros.tsx): `frontend/src/paginas/Logros.tsx`
- **Godot game**

### Backend API

- [API routes](https://github.com/santiago-veloza/codesquest/blob/main/backend/config/urls.py): `backend/config/urls.py`
- [Progress endpoints](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/progreso/views.py): `backend/apps/progreso/views.py`
- [Gamification endpoints](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/gamificacion/views.py): `backend/apps/gamificacion/views.py`
- **PostgreSQL**

### Game domain

- [World and challenge data](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/contenido/models.py): `backend/apps/contenido/models.py`
- [Content loader](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/contenido/carga.py): `backend/apps/contenido/carga.py`
- [Labyrinth generation](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/contenido/laberinto.py): `backend/apps/contenido/laberinto.py`
- [Accounts and security](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/usuarios/servicios.py): `backend/apps/usuarios/servicios.py`
- [Progress services](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/progreso/servicios.py): `backend/apps/progreso/servicios.py`
- [Rewards and achievements](https://github.com/santiago-veloza/codesquest/blob/main/backend/apps/gamificacion/servicios.py): `backend/apps/gamificacion/servicios.py`

### Code runtime

- [Challenge evaluator](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/motor/evaluador.ts): `frontend/src/motor/evaluador.ts`
- [Python runner](https://github.com/santiago-veloza/codesquest/blob/main/frontend/src/motor/EjecutorPython.ts): `frontend/src/motor/EjecutorPython.ts`

### Other components

- **Student**

## Connections

- Student → Application shell: uses
- Application shell → Routes and guards: mounts (evidence: `frontend/src/main.tsx`)
- Routes and guards → Account screens: routes to (evidence: `frontend/src/app/router.tsx`)
- Routes and guards → World map: routes to (evidence: `frontend/src/app/router.tsx`)
- Routes and guards → World labyrinth: routes to (evidence: `frontend/src/app/router.tsx`)
- Routes and guards → Challenge screen: routes to (evidence: `frontend/src/app/router.tsx`)
- Account screens → Session state: starts session (evidence: `frontend/src/paginas/Registro.tsx`)
- Session state → HTTP client: provides token (evidence: `frontend/src/api/cliente.ts`)
- World map → HTTP client: requests worlds
- Challenge screen → Attempt workflow: runs attempt
- Attempt workflow → Challenge evaluator: evaluates code (evidence: `frontend/src/paginas/desafio/useEjecucion.ts`)
- Attempt workflow → Python runner: executes code (evidence: `frontend/src/paginas/desafio/useEjecucion.ts`)
- Attempt workflow → HTTP client: registers attempt
- HTTP client → API routes: calls API
- API routes → Progress endpoints: routes requests
- Progress endpoints → Progress services: handles progress
- Progress services → PostgreSQL: persists progress
- Progress services → Rewards and achievements: awards rewards
- Gamification endpoints → Rewards and achievements: serves achievements
- Achievements → HTTP client: loads achievements
- Content loader → World and challenge data: loads records (evidence: `backend/apps/contenido/carga.py`)
- Content loader → Labyrinth generation: builds labyrinths (evidence: `backend/apps/contenido/carga.py`)
- World and challenge data → PostgreSQL: stores content
- World labyrinth → Godot game: embeds game
- Progress services → World and challenge data: checks challenges
- Accounts and security → PostgreSQL: stores accounts
