# asef69/wave_bakery architecture

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

- Interactive diagram: https://gitdiagram.com/asef69/wave_bakery
- Repository: https://github.com/asef69/wave_bakery

## Overview

WaveBakery is an educational signals-and-systems cooking game: players select recipes, process ingredient signals through kitchen stations, correct cooking and delivery distortions, then serve a dish for authoritative server scoring. The graph includes the documented account, recipe, leaderboard and sandbox features alongside the main run. Backend links are grounded in excerpts and SOURCE INDEX references; frontend stage and HTTP links rely on README documentation where route or API implementation was not sampled.

Main entry points: [`backend/app/main.py`](https://github.com/asef69/wave_bakery/blob/main/backend/app/main.py) (FastAPI app), [`frontend/src/routes`](https://github.com/asef69/wave_bakery/tree/main/frontend/src/routes) (Game screens), [`backend/app/gameplay.py`](https://github.com/asef69/wave_bakery/blob/main/backend/app/gameplay.py) (Dish rebuild and score), [`backend/app/database.py`](https://github.com/asef69/wave_bakery/blob/main/backend/app/database.py) (SQL database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Game experience"]
  node_routes["Game screens"]
  node_recipes["Recipe catalog<br/>[recipes.ts]"]
  node_labs["Signal playground<br/>[labs.tsx]"]
  node_api["API client<br/>[api.ts]"]
end

subgraph group_processing["Signal processing"]
  node_pipeline_ui["Station pipeline<br/>[pipeline.ts]"]
  node_oven_ui["Precision oven<br/>[filtering.tsx]"]
  node_delivery_ui["System delivery<br/>[beam-delivery.tsx]"]
  node_dsp_core["DSP core<br/>[core.py]"]
  node_instruments["Ingredient signals<br/>[instruments.py]"]
  node_contamination["Signal contamination<br/>[contamination.py]"]
  node_dsp_pipeline["Canonical pipeline<br/>[pipeline.py]"]
  node_appliances["Appliance systems<br/>[systems.py]"]
  node_metrics["Scoring metrics<br/>[metrics.py]"]
  node_delivery["Delivery effects<br/>[delivery.py]"]
end

subgraph group_service["Game services"]
  node_api_server["FastAPI app<br/>[main.py]"]
  node_catalogue["Recipe catalogue<br/>[catalogue.py]"]
  node_sessions["Game sessions<br/>[sessions.py]"]
  node_gameplay["Dish rebuild and score<br/>[gameplay.py]"]
  node_dsp_routes["DSP endpoints<br/>[dsp.py]"]
  node_players["Player accounts<br/>[players.py]"]
  node_leaderboard["Leaderboard<br/>[leaderboard.py]"]
end

subgraph group_state["Persistent state"]
  node_database[("SQL database<br/>[database.py]")]
  node_models["Game records<br/>[models.py]"]
  node_seed["Initial game data<br/>[seed.py]"]
end

node_player(("Player"))

node_player -->|"plays"| node_routes
node_routes -.->|"selects recipe"| node_recipes
node_routes -.->|"operates stations"| node_pipeline_ui
node_pipeline_ui -->|"loads recipe signals"| node_recipes
node_routes -.->|"corrects cooking"| node_oven_ui
node_routes -.->|"cancels vibration"| node_delivery_ui
node_routes -.->|"opens sandbox"| node_labs
node_routes -.->|"requests game data"| node_api
node_api -.->|"calls API"| node_api_server
node_api_server -->|"registers router"| node_catalogue
node_api_server -->|"registers router"| node_sessions
node_api_server -->|"registers router"| node_players
node_api_server -->|"registers router"| node_leaderboard
node_api_server -->|"registers router"| node_dsp_routes
node_sessions -->|"rebuilds and scores"| node_gameplay
node_gameplay -->|"generates signals"| node_instruments
node_gameplay -->|"contaminates signals"| node_contamination
node_gameplay -->|"runs pipeline"| node_dsp_pipeline
node_gameplay -->|"applies delivery effects"| node_delivery
node_gameplay -->|"measures dish"| node_metrics
node_dsp_pipeline -->|"uses DSP operations"| node_dsp_core
node_dsp_pipeline -->|"applies appliances"| node_appliances
node_instruments -->|"uses signal functions"| node_dsp_core
node_contamination -->|"uses signal functions"| node_dsp_core
node_metrics -->|"uses signal functions"| node_dsp_core
node_delivery -->|"uses signal functions"| node_dsp_core
node_dsp_routes -.->|"serves DSP tools"| node_dsp_core
node_sessions -->|"reads and writes"| node_database
node_players -->|"reads and writes"| node_database
node_leaderboard -->|"queries rankings"| node_database
node_catalogue -->|"queries catalogue"| node_database
node_database -->|"registers mappings"| node_models
node_api_server -->|"initializes store"| node_database
node_api_server -->|"seeds records"| node_seed
node_seed -->|"writes initial data"| node_database
node_sessions -->|"computes stage views"| node_gameplay
node_player -.->|"manages account"| node_players
node_player -.->|"views rankings"| node_leaderboard

click node_routes "https://github.com/asef69/wave_bakery/tree/main/frontend/src/routes"
click node_recipes "https://github.com/asef69/wave_bakery/blob/main/frontend/src/lib/recipes.ts"
click node_pipeline_ui "https://github.com/asef69/wave_bakery/blob/main/frontend/src/lib/pipeline.ts"
click node_oven_ui "https://github.com/asef69/wave_bakery/blob/main/frontend/src/routes/filtering.tsx"
click node_delivery_ui "https://github.com/asef69/wave_bakery/blob/main/frontend/src/routes/beam-delivery.tsx"
click node_labs "https://github.com/asef69/wave_bakery/blob/main/frontend/src/routes/labs.tsx"
click node_api "https://github.com/asef69/wave_bakery/blob/main/frontend/src/lib/api.ts"
click node_api_server "https://github.com/asef69/wave_bakery/blob/main/backend/app/main.py"
click node_catalogue "https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/catalogue.py"
click node_sessions "https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/sessions.py"
click node_gameplay "https://github.com/asef69/wave_bakery/blob/main/backend/app/gameplay.py"
click node_dsp_routes "https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/dsp.py"
click node_dsp_core "https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/core.py"
click node_instruments "https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/instruments.py"
click node_contamination "https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/contamination.py"
click node_dsp_pipeline "https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/pipeline.py"
click node_appliances "https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/systems.py"
click node_metrics "https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/metrics.py"
click node_delivery "https://github.com/asef69/wave_bakery/blob/main/backend/app/delivery.py"
click node_players "https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/players.py"
click node_leaderboard "https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/leaderboard.py"
click node_database "https://github.com/asef69/wave_bakery/blob/main/backend/app/database.py"
click node_models "https://github.com/asef69/wave_bakery/blob/main/backend/app/models.py"
click node_seed "https://github.com/asef69/wave_bakery/blob/main/backend/app/seed.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_recipes,node_labs,node_api toneBlue
class node_pipeline_ui,node_oven_ui,node_delivery_ui,node_dsp_core,node_instruments,node_contamination,node_dsp_pipeline,node_appliances,node_metrics,node_delivery toneAmber
class node_api_server,node_catalogue,node_sessions,node_gameplay,node_dsp_routes,node_players,node_leaderboard toneMint
class node_database,node_models,node_seed toneRose
class node_player toneIndigo
```

## Components

### Game experience

- [Game screens](https://github.com/asef69/wave_bakery/tree/main/frontend/src/routes): `frontend/src/routes`
- [Recipe catalog](https://github.com/asef69/wave_bakery/blob/main/frontend/src/lib/recipes.ts): `frontend/src/lib/recipes.ts`
- [Signal playground](https://github.com/asef69/wave_bakery/blob/main/frontend/src/routes/labs.tsx): `frontend/src/routes/labs.tsx`
- [API client](https://github.com/asef69/wave_bakery/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Signal processing

- [Station pipeline](https://github.com/asef69/wave_bakery/blob/main/frontend/src/lib/pipeline.ts): `frontend/src/lib/pipeline.ts`
- [Precision oven](https://github.com/asef69/wave_bakery/blob/main/frontend/src/routes/filtering.tsx): `frontend/src/routes/filtering.tsx`
- [System delivery](https://github.com/asef69/wave_bakery/blob/main/frontend/src/routes/beam-delivery.tsx): `frontend/src/routes/beam-delivery.tsx`
- [DSP core](https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/core.py): `backend/app/dsp/core.py`
- [Ingredient signals](https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/instruments.py): `backend/app/dsp/instruments.py`
- [Signal contamination](https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/contamination.py): `backend/app/dsp/contamination.py`
- [Canonical pipeline](https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/pipeline.py): `backend/app/dsp/pipeline.py`
- [Appliance systems](https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/systems.py): `backend/app/dsp/systems.py`
- [Scoring metrics](https://github.com/asef69/wave_bakery/blob/main/backend/app/dsp/metrics.py): `backend/app/dsp/metrics.py`
- [Delivery effects](https://github.com/asef69/wave_bakery/blob/main/backend/app/delivery.py): `backend/app/delivery.py`

### Game services

- [FastAPI app](https://github.com/asef69/wave_bakery/blob/main/backend/app/main.py): `backend/app/main.py`
- [Recipe catalogue](https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/catalogue.py): `backend/app/routers/catalogue.py`
- [Game sessions](https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/sessions.py): `backend/app/routers/sessions.py`
- [Dish rebuild and score](https://github.com/asef69/wave_bakery/blob/main/backend/app/gameplay.py): `backend/app/gameplay.py`
- [DSP endpoints](https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/dsp.py): `backend/app/routers/dsp.py`
- [Player accounts](https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/players.py): `backend/app/routers/players.py`
- [Leaderboard](https://github.com/asef69/wave_bakery/blob/main/backend/app/routers/leaderboard.py): `backend/app/routers/leaderboard.py`

### Persistent state

- [SQL database](https://github.com/asef69/wave_bakery/blob/main/backend/app/database.py): `backend/app/database.py`
- [Game records](https://github.com/asef69/wave_bakery/blob/main/backend/app/models.py): `backend/app/models.py`
- [Initial game data](https://github.com/asef69/wave_bakery/blob/main/backend/app/seed.py): `backend/app/seed.py`

### Other components

- **Player**

## Connections

- Player → Game screens: plays
- Game screens → Recipe catalog: selects recipe
- Game screens → Station pipeline: operates stations
- Station pipeline → Recipe catalog: loads recipe signals (evidence: `frontend/src/lib/pipeline.ts`)
- Game screens → Precision oven: corrects cooking
- Game screens → System delivery: cancels vibration
- Game screens → Signal playground: opens sandbox
- Game screens → API client: requests game data
- API client → FastAPI app: calls API
- FastAPI app → Recipe catalogue: registers router (evidence: `backend/app/main.py`)
- FastAPI app → Game sessions: registers router (evidence: `backend/app/main.py`)
- FastAPI app → Player accounts: registers router (evidence: `backend/app/main.py`)
- FastAPI app → Leaderboard: registers router (evidence: `backend/app/main.py`)
- FastAPI app → DSP endpoints: registers router (evidence: `backend/app/main.py`)
- Game sessions → Dish rebuild and score: rebuilds and scores (evidence: `backend/app/routers/sessions.py`)
- Dish rebuild and score → Ingredient signals: generates signals (evidence: `backend/app/gameplay.py`)
- Dish rebuild and score → Signal contamination: contaminates signals (evidence: `backend/app/gameplay.py`)
- Dish rebuild and score → Canonical pipeline: runs pipeline (evidence: `backend/app/gameplay.py`)
- Dish rebuild and score → Delivery effects: applies delivery effects (evidence: `backend/app/gameplay.py`)
- Dish rebuild and score → Scoring metrics: measures dish (evidence: `backend/app/gameplay.py`)
- Canonical pipeline → DSP core: uses DSP operations (evidence: `backend/app/dsp/pipeline.py`)
- Canonical pipeline → Appliance systems: applies appliances (evidence: `backend/app/dsp/pipeline.py`)
- Ingredient signals → DSP core: uses signal functions (evidence: `backend/app/dsp/instruments.py`)
- Signal contamination → DSP core: uses signal functions (evidence: `backend/app/dsp/contamination.py`)
- Scoring metrics → DSP core: uses signal functions (evidence: `backend/app/dsp/metrics.py`)
- Delivery effects → DSP core: uses signal functions (evidence: `backend/app/delivery.py`)
- DSP endpoints → DSP core: serves DSP tools (evidence: `backend/app/routers/dsp.py`)
- Game sessions → SQL database: reads and writes (evidence: `backend/app/routers/sessions.py`)
- Player accounts → SQL database: reads and writes (evidence: `backend/app/routers/players.py`)
- Leaderboard → SQL database: queries rankings (evidence: `backend/app/routers/leaderboard.py`)
- Recipe catalogue → SQL database: queries catalogue (evidence: `backend/app/routers/catalogue.py`)
- SQL database → Game records: registers mappings (evidence: `backend/app/database.py`)
- FastAPI app → SQL database: initializes store (evidence: `backend/app/main.py`)
- FastAPI app → Initial game data: seeds records (evidence: `backend/app/main.py`)
- Initial game data → SQL database: writes initial data (evidence: `backend/app/seed.py`)
- Game sessions → Dish rebuild and score: computes stage views (evidence: `backend/app/routers/sessions.py`)
- Player → Player accounts: manages account
- Player → Leaderboard: views rankings
