# yodak025/chomp-crawler architecture

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

- Interactive diagram: https://gitdiagram.com/yodak025/chomp-crawler
- Repository: https://github.com/yodak025/chomp-crawler

## Overview

Chomp Crawler is a browser-based 3D roguelike maze game. The intended play flow loads Pyodide, initializes the engine, generates a maze, and runs ECS simulation; synchronized state then feeds rendering and HUD presentation. The graph includes the documented procedural-generation, ECS, Zustand, and 3D-rendering layers, plus the app and configuration surfaces. Some unsampled wiring is represented only where the README or source index supports it; absent evidence limits several connections.

Main entry points: [`src/core/engine.ts`](https://github.com/yodak025/chomp-crawler/blob/main/src/core/engine.ts) (ECS Engine), [`src/scenes/Game.tsx`](https://github.com/yodak025/chomp-crawler/blob/main/src/scenes/Game.tsx) (Game Scene), [`src/core/hooks/useGameEngine.ts`](https://github.com/yodak025/chomp-crawler/blob/main/src/core/hooks/useGameEngine.ts) (Engine Hook), [`src/ui/pages/GameApp.tsx`](https://github.com/yodak025/chomp-crawler/blob/main/src/ui/pages/GameApp.tsx) (Game App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and UI"]
  node_landing["Landing Page<br/>[page.tsx]"]
  node_game_route["Game Route<br/>[page.tsx]"]
  node_game_app["Game App<br/>[GameApp.tsx]"]
  node_ui_screens["Game Screens"]
  node_hud["HUD and Menus"]
  node_ui_common["HUD Widgets"]
  node_config_api["Config Endpoints"]
  node_maze_api["Maze Endpoint<br/>[route.ts]"]
end

subgraph group_runtime["Game Runtime"]
  node_pyodide_hook["Pyodide Loader<br/>[usePyodide.ts]"]
  node_engine_hook["Engine Hook<br/>[useGameEngine.ts]"]
  node_engine["ECS Engine<br/>[engine.ts]"]
  node_world["Game World<br/>[GameWorld.ts]"]
  node_entity_factory["Entity Factory<br/>[entityFactory.ts]"]
  node_ecs_systems["Simulation Systems"]
  node_world_loader["World Config Loader"]
end

subgraph group_generation["Maze Generation"]
  node_maze_runtime["Maze Bridge<br/>[mazeGen.ts]"]
  node_python_generator["Python Generator"]
  node_maze_graph["MST Connectivity<br/>[graph_mst.py]"]
end

subgraph group_presentation["3D Presentation"]
  node_scene["Game Scene<br/>[Game.tsx]"]
  node_render_hooks["Render State Hooks"]
  node_maze_meshes["Maze Meshes"]
  node_entity_meshes["Entity Meshes"]
end

subgraph group_state["State and Types"]
  node_hot_state[("Hot State<br/>[useHotState.ts]")]
  node_app_state[("App State")]
  node_game_types["Game Components<br/>[gameComponents.ts]"]
end

node_player(("Player"))

node_player -->|"opens"| node_landing
node_game_route -->|"renders"| node_game_app
node_engine_hook -->|"initializes"| node_engine
node_game_app -.->|"uses"| node_engine_hook
node_engine -->|"creates"| node_world
node_engine -->|"generates maze"| node_maze_runtime
node_engine -->|"creates echoes"| node_entity_factory
node_engine -.->|"runs systems"| node_ecs_systems
node_engine -->|"syncs snapshots"| node_hot_state
node_engine -->|"preloads configs"| node_world_loader
node_pyodide_hook -->|"provides runtime"| node_engine_hook
node_maze_runtime -->|"executes generation"| node_python_generator
node_python_generator -.->|"connects rooms"| node_maze_graph
node_engine_hook -->|"sets transitions"| node_app_state
node_ecs_systems -.->|"updates entities"| node_world
node_scene -.->|"reads snapshots"| node_hot_state
node_render_hooks -->|"uses types"| node_game_types
node_scene -.->|"uses"| node_render_hooks
node_scene -.->|"renders maze"| node_maze_meshes
node_scene -.->|"renders actors"| node_entity_meshes
node_hud -.->|"composes"| node_ui_common
node_game_app -.->|"selects screens"| node_ui_screens
node_config_api -.->|"serves config"| node_world_loader
node_maze_api -.->|"exposes generation"| node_python_generator

click node_landing "https://github.com/yodak025/chomp-crawler/blob/main/src/app/page.tsx"
click node_game_route "https://github.com/yodak025/chomp-crawler/blob/main/src/app/game/page.tsx"
click node_game_app "https://github.com/yodak025/chomp-crawler/blob/main/src/ui/pages/GameApp.tsx"
click node_ui_screens "https://github.com/yodak025/chomp-crawler/tree/main/src/ui/pages"
click node_hud "https://github.com/yodak025/chomp-crawler/tree/main/src/ui/layout"
click node_ui_common "https://github.com/yodak025/chomp-crawler/tree/main/src/ui/common"
click node_config_api "https://github.com/yodak025/chomp-crawler/tree/main/src/app/api/config"
click node_maze_api "https://github.com/yodak025/chomp-crawler/blob/main/src/app/api/maze-gen/%5B...path%5D/route.ts"
click node_pyodide_hook "https://github.com/yodak025/chomp-crawler/blob/main/src/core/hooks/usePyodide.ts"
click node_engine_hook "https://github.com/yodak025/chomp-crawler/blob/main/src/core/hooks/useGameEngine.ts"
click node_engine "https://github.com/yodak025/chomp-crawler/blob/main/src/core/engine.ts"
click node_world "https://github.com/yodak025/chomp-crawler/blob/main/src/core/GameWorld.ts"
click node_entity_factory "https://github.com/yodak025/chomp-crawler/blob/main/src/core/entityFactory.ts"
click node_ecs_systems "https://github.com/yodak025/chomp-crawler/tree/main/src/core/systems"
click node_world_loader "https://github.com/yodak025/chomp-crawler/blob/main/src/core/worldConfigLoader.ts"
click node_maze_runtime "https://github.com/yodak025/chomp-crawler/blob/main/src/core/mazeGen.ts"
click node_python_generator "https://github.com/yodak025/chomp-crawler/tree/main/src/maze-gen"
click node_maze_graph "https://github.com/yodak025/chomp-crawler/blob/main/src/maze-gen/graph_mst.py"
click node_hot_state "https://github.com/yodak025/chomp-crawler/blob/main/src/state/useHotState.ts"
click node_app_state "https://github.com/yodak025/chomp-crawler/blob/main/src/state/useAppStateStore.ts"
click node_game_types "https://github.com/yodak025/chomp-crawler/blob/main/src/types/gameComponents.ts"
click node_scene "https://github.com/yodak025/chomp-crawler/blob/main/src/scenes/Game.tsx"
click node_render_hooks "https://github.com/yodak025/chomp-crawler/tree/main/src/scenes/hooks"
click node_maze_meshes "https://github.com/yodak025/chomp-crawler/tree/main/src/scenes/meshes/maze"
click node_entity_meshes "https://github.com/yodak025/chomp-crawler/tree/main/src/scenes/meshes/entities"

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_game_route,node_game_app,node_ui_screens,node_hud,node_ui_common,node_config_api,node_maze_api toneBlue
class node_pyodide_hook,node_engine_hook,node_engine,node_world,node_entity_factory,node_ecs_systems,node_world_loader toneAmber
class node_maze_runtime,node_python_generator,node_maze_graph toneMint
class node_scene,node_render_hooks,node_maze_meshes,node_entity_meshes toneRose
class node_hot_state,node_app_state,node_game_types,node_player toneIndigo
```

## Components

### App and UI

- [Landing Page](https://github.com/yodak025/chomp-crawler/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Game Route](https://github.com/yodak025/chomp-crawler/blob/main/src/app/game/page.tsx): `src/app/game/page.tsx`
- [Game App](https://github.com/yodak025/chomp-crawler/blob/main/src/ui/pages/GameApp.tsx): `src/ui/pages/GameApp.tsx`
- [Game Screens](https://github.com/yodak025/chomp-crawler/tree/main/src/ui/pages): `src/ui/pages`
- [HUD and Menus](https://github.com/yodak025/chomp-crawler/tree/main/src/ui/layout): `src/ui/layout`
- [HUD Widgets](https://github.com/yodak025/chomp-crawler/tree/main/src/ui/common): `src/ui/common`
- [Config Endpoints](https://github.com/yodak025/chomp-crawler/tree/main/src/app/api/config): `src/app/api/config`
- [Maze Endpoint](https://github.com/yodak025/chomp-crawler/blob/main/src/app/api/maze-gen/%5B...path%5D/route.ts): `src/app/api/maze-gen/[...path]/route.ts`

### Game Runtime

- [Pyodide Loader](https://github.com/yodak025/chomp-crawler/blob/main/src/core/hooks/usePyodide.ts): `src/core/hooks/usePyodide.ts`
- [Engine Hook](https://github.com/yodak025/chomp-crawler/blob/main/src/core/hooks/useGameEngine.ts): `src/core/hooks/useGameEngine.ts`
- [ECS Engine](https://github.com/yodak025/chomp-crawler/blob/main/src/core/engine.ts): `src/core/engine.ts`
- [Game World](https://github.com/yodak025/chomp-crawler/blob/main/src/core/GameWorld.ts): `src/core/GameWorld.ts`
- [Entity Factory](https://github.com/yodak025/chomp-crawler/blob/main/src/core/entityFactory.ts): `src/core/entityFactory.ts`
- [Simulation Systems](https://github.com/yodak025/chomp-crawler/tree/main/src/core/systems): `src/core/systems`
- [World Config Loader](https://github.com/yodak025/chomp-crawler/blob/main/src/core/worldConfigLoader.ts): `src/core/worldConfigLoader.ts`

### Maze Generation

- [Maze Bridge](https://github.com/yodak025/chomp-crawler/blob/main/src/core/mazeGen.ts): `src/core/mazeGen.ts`
- [Python Generator](https://github.com/yodak025/chomp-crawler/tree/main/src/maze-gen): `src/maze-gen`
- [MST Connectivity](https://github.com/yodak025/chomp-crawler/blob/main/src/maze-gen/graph_mst.py): `src/maze-gen/graph_mst.py`

### 3D Presentation

- [Game Scene](https://github.com/yodak025/chomp-crawler/blob/main/src/scenes/Game.tsx): `src/scenes/Game.tsx`
- [Render State Hooks](https://github.com/yodak025/chomp-crawler/tree/main/src/scenes/hooks): `src/scenes/hooks`
- [Maze Meshes](https://github.com/yodak025/chomp-crawler/tree/main/src/scenes/meshes/maze): `src/scenes/meshes/maze`
- [Entity Meshes](https://github.com/yodak025/chomp-crawler/tree/main/src/scenes/meshes/entities): `src/scenes/meshes/entities`

### State and Types

- [Hot State](https://github.com/yodak025/chomp-crawler/blob/main/src/state/useHotState.ts): `src/state/useHotState.ts`
- [App State](https://github.com/yodak025/chomp-crawler/blob/main/src/state/useAppStateStore.ts): `src/state/useAppStateStore.ts`
- [Game Components](https://github.com/yodak025/chomp-crawler/blob/main/src/types/gameComponents.ts): `src/types/gameComponents.ts`

### Other components

- **Player**

## Connections

- Player → Landing Page: opens (evidence: `README.md`)
- Game Route → Game App: renders (evidence: `src/app/game/page.tsx`)
- Engine Hook → ECS Engine: initializes (evidence: `src/core/hooks/useGameEngine.ts`)
- Game App → Engine Hook: uses
- ECS Engine → Game World: creates (evidence: `src/core/engine.ts`)
- ECS Engine → Maze Bridge: generates maze (evidence: `src/core/engine.ts`)
- ECS Engine → Entity Factory: creates echoes (evidence: `src/core/engine.ts`)
- ECS Engine → Simulation Systems: runs systems (evidence: `src/core/engine.ts`)
- ECS Engine → Hot State: syncs snapshots (evidence: `src/core/engine.ts`)
- ECS Engine → World Config Loader: preloads configs (evidence: `src/core/engine.ts`)
- Pyodide Loader → Engine Hook: provides runtime (evidence: `src/core/hooks/useGameEngine.ts`)
- Maze Bridge → Python Generator: executes generation (evidence: `README.md`)
- Python Generator → MST Connectivity: connects rooms (evidence: `src/maze-gen/graph_mst.py`)
- Engine Hook → App State: sets transitions (evidence: `src/core/hooks/useGameEngine.ts`)
- Simulation Systems → Game World: updates entities (evidence: `src/core/systems/cleanupEventsSystem.ts`)
- Game Scene → Hot State: reads snapshots
- Render State Hooks → Game Components: uses types (evidence: `src/scenes/hooks/useEchoRenderState.tsx`)
- Game Scene → Render State Hooks: uses
- Game Scene → Maze Meshes: renders maze
- Game Scene → Entity Meshes: renders actors
- HUD and Menus → HUD Widgets: composes
- Game App → Game Screens: selects screens
- Config Endpoints → World Config Loader: serves config
- Maze Endpoint → Python Generator: exposes generation
