# boredmayonnaise/algorithm architecture

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

- Interactive diagram: https://gitdiagram.com/boredmayonnaise/algorithm
- Repository: https://github.com/boredmayonnaise/algorithm

## Overview

Algo is an interactive maze-building and pathfinding analysis platform. A user edits a maze in the browser, runs or compares algorithms, and can inspect live frontier events and replay or step through results; maze records are also exposed through the API. The graph separates the classroom UI, HTTP/API layer, algorithm engine, and persistence. The README documents the product capabilities and endpoints; source-index references support module boundaries, but do not reveal every runtime call, so some relationships are shown only where documented.

Main entry points: [`src/api.cpp`](https://github.com/boredmayonnaise/algorithm/blob/main/src/api.cpp) (Maze API), [`public/app.js`](https://github.com/boredmayonnaise/algorithm/blob/main/public/app.js) (Maze editor), [`src/main.cpp`](https://github.com/boredmayonnaise/algorithm/blob/main/src/main.cpp) (Server entry), [`include/crow/http_connection.h`](https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/http_connection.h) (HTTP handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Classroom UI"]
  node_editor["Maze editor<br/>[app.js]"]
  node_analysis["Search analysis<br/>[analysis.js]"]
  node_playback["Run playback<br/>[playback.js]"]
end

subgraph group_service["HTTP Service"]
  node_entry["Server entry<br/>[main.cpp]"]
  node_api["Maze API<br/>[api.cpp]"]
  node_crow["HTTP routing<br/>[routing.h]"]
  node_http["HTTP handling<br/>[http_connection.h]"]
  node_request["Request parsing"]
  node_response["HTTP responses<br/>[http_response.h]"]
end

subgraph group_engine["Maze Engine"]
  node_algo["Pathfinding algorithms<br/>[algo.cpp]"]
end

subgraph group_data["Maze Persistence"]
  node_db[("Maze records<br/>[db.cpp]")]
end

node_user(("Maze user"))
node_sqlite[("SQLite")]

node_user -->|"edits maze"| node_editor
node_editor -->|"submits runs"| node_api
node_api -->|"runs search"| node_algo
node_algo -->|"emits events"| node_analysis
node_analysis -.->|"feeds replay"| node_playback
node_editor -->|"controls playback"| node_playback
node_editor -->|"compares runs"| node_api
node_entry -->|"registers API"| node_api
node_entry -.->|"initializes storage"| node_db
node_entry -.->|"starts app"| node_crow
node_crow -.->|"dispatches routes"| node_http
node_http -->|"parses requests"| node_request
node_http -->|"sends responses"| node_response
node_api -->|"manages mazes"| node_db
node_db -.->|"stores records"| node_sqlite

click node_editor "https://github.com/boredmayonnaise/algorithm/blob/main/public/app.js"
click node_analysis "https://github.com/boredmayonnaise/algorithm/blob/main/public/analysis.js"
click node_playback "https://github.com/boredmayonnaise/algorithm/blob/main/public/playback.js"
click node_entry "https://github.com/boredmayonnaise/algorithm/blob/main/src/main.cpp"
click node_api "https://github.com/boredmayonnaise/algorithm/blob/main/src/api.cpp"
click node_crow "https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/routing.h"
click node_http "https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/http_connection.h"
click node_request "https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/http_parser_merged.h"
click node_response "https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/http_response.h"
click node_algo "https://github.com/boredmayonnaise/algorithm/blob/main/src/algo.cpp"
click node_db "https://github.com/boredmayonnaise/algorithm/blob/main/src/db.cpp"

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_editor,node_analysis,node_playback,node_user toneBlue
class node_entry,node_api,node_crow,node_http,node_request,node_response,node_sqlite toneAmber
class node_algo toneMint
class node_db toneRose
```

## Components

### Classroom UI

- [Maze editor](https://github.com/boredmayonnaise/algorithm/blob/main/public/app.js): `public/app.js`
- [Search analysis](https://github.com/boredmayonnaise/algorithm/blob/main/public/analysis.js): `public/analysis.js`
- [Run playback](https://github.com/boredmayonnaise/algorithm/blob/main/public/playback.js): `public/playback.js`

### HTTP Service

- [Server entry](https://github.com/boredmayonnaise/algorithm/blob/main/src/main.cpp): `src/main.cpp`
- [Maze API](https://github.com/boredmayonnaise/algorithm/blob/main/src/api.cpp): `src/api.cpp`
- [HTTP routing](https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/routing.h): `include/crow/routing.h`
- [HTTP handling](https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/http_connection.h): `include/crow/http_connection.h`
- [Request parsing](https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/http_parser_merged.h): `include/crow/http_parser_merged.h`
- [HTTP responses](https://github.com/boredmayonnaise/algorithm/blob/main/include/crow/http_response.h): `include/crow/http_response.h`

### Maze Engine

- [Pathfinding algorithms](https://github.com/boredmayonnaise/algorithm/blob/main/src/algo.cpp): `src/algo.cpp`

### Maze Persistence

- [Maze records](https://github.com/boredmayonnaise/algorithm/blob/main/src/db.cpp): `src/db.cpp`

### Other components

- **Maze user**
- **SQLite**

## Connections

- Maze user → Maze editor: edits maze (evidence: `README.md`)
- Maze editor → Maze API: submits runs (evidence: `README.md`)
- Maze API → Pathfinding algorithms: runs search (evidence: `README.md`)
- Pathfinding algorithms → Search analysis: emits events (evidence: `README.md`)
- Search analysis → Run playback: feeds replay
- Maze editor → Run playback: controls playback (evidence: `README.md`)
- Maze editor → Maze API: compares runs (evidence: `README.md`)
- Server entry → Maze API: registers API (evidence: `src/main.cpp`)
- Server entry → Maze records: initializes storage
- Server entry → HTTP routing: starts app
- HTTP routing → HTTP handling: dispatches routes
- HTTP handling → Request parsing: parses requests (evidence: `include/crow/http_connection.h`)
- HTTP handling → HTTP responses: sends responses (evidence: `include/crow/http_connection.h`)
- Maze API → Maze records: manages mazes (evidence: `README.md`)
- Maze records → SQLite: stores records
