# theplaceoftangerine/ottv2 architecture

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

- Interactive diagram: https://gitdiagram.com/theplaceoftangerine/ottv2
- Repository: https://github.com/theplaceoftangerine/ottv2

## Overview

OTTv2 is a local bot competition platform: contestants submit Python/C++ bots, which are validated and exercised in Docker before organizers snapshot eligible bots into seeded scoring rounds, inspect replays and export Elo standings. The graph separates submission handling, game/rules, sandbox execution, operations/scoring and persistent data. README describes several web capabilities, but excerpts do not expose all route-to-service wiring; documented relationships are cited to README and uncertain links are omitted.

Main entry points: [`src/app.js`](https://github.com/theplaceoftangerine/ottv2/blob/main/src/app.js) (HTTP Application), [`src/submissions/service.js`](https://github.com/theplaceoftangerine/ottv2/blob/main/src/submissions/service.js) (Submission Workflow), [`src/sandbox/match-service.js`](https://github.com/theplaceoftangerine/ottv2/blob/main/src/sandbox/match-service.js) (Practice Matches), [`src/game/match.js`](https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/match.js) (Match Runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_submission["Bot Submissions"]
  node_submissions["Submission Workflow<br/>[service.js]"]
  node_source["Source Intake<br/>[source.js]"]
  node_samples["Sample Bots<br/>[samples.js]"]
end

subgraph group_game["Game and Rules"]
  node_engine["Game Engine<br/>[engine.js]"]
  node_registry["Engine Registry<br/>[registry.js]"]
  node_protocol["Bot Protocol<br/>[protocol.js]"]
  node_match["Match Runner<br/>[match.js]"]
  node_rules["Rule Sets<br/>[rule-sets.js]"]
  node_legacy["Live Manual Game<br/>[legacy.js]"]
end

subgraph group_sandbox["Isolated Execution"]
  node_docker["Docker Sandbox<br/>[docker.js]"]
  node_practice["Practice Matches<br/>[match-service.js]"]
end

subgraph group_competition["Tournament Operations"]
  node_server["HTTP Application<br/>[app.js]"]
  node_admin["Admin Operations<br/>[admin.js]"]
  node_users["Accounts<br/>[users.js]"]
  node_scoring["Round Scoring<br/>[scoring.js]"]
end

subgraph group_persistence["Persistent State"]
  node_database[("SQLite Database<br/>[db.js]")]
end

node_contestant(("Contestant"))
node_organizer(("Organizer"))

node_contestant -->|"submits bots"| node_server
node_organizer -->|"operates tournament"| node_server
node_server -->|"routes submissions"| node_submissions
node_server -->|"routes practice"| node_practice
node_server -->|"routes scoring"| node_scoring
node_server -->|"routes rules"| node_rules
node_server -->|"uses administration"| node_admin
node_submissions -->|"extracts and scans"| node_source
node_submissions -->|"prepares and tests"| node_docker
node_submissions -->|"runs test matches"| node_match
node_submissions -->|"uses sample source"| node_samples
node_practice -->|"runs bot sessions"| node_docker
node_practice -->|"executes matches"| node_match
node_practice -->|"selects rule version"| node_rules
node_practice -->|"offers sample bots"| node_samples
node_scoring -->|"runs bot sessions"| node_docker
node_scoring -->|"executes matches"| node_match
node_match -->|"creates engine"| node_registry
node_registry -->|"instantiates"| node_engine
node_match -->|"builds and parses turns"| node_protocol
node_docker -->|"classifies execution faults"| node_protocol
node_rules -->|"validates rules"| node_engine
node_rules -->|"registers engines"| node_registry
node_server -->|"persists application state"| node_database
node_legacy -->|"stores live matches"| node_database
node_contestant -->|"plays manual game"| node_legacy
node_organizer -->|"creates and monitors rounds"| node_scoring

click node_server "https://github.com/theplaceoftangerine/ottv2/blob/main/src/app.js"
click node_admin "https://github.com/theplaceoftangerine/ottv2/blob/main/src/admin.js"
click node_users "https://github.com/theplaceoftangerine/ottv2/blob/main/src/users.js"
click node_submissions "https://github.com/theplaceoftangerine/ottv2/blob/main/src/submissions/service.js"
click node_source "https://github.com/theplaceoftangerine/ottv2/blob/main/src/submissions/source.js"
click node_samples "https://github.com/theplaceoftangerine/ottv2/blob/main/src/sandbox/samples.js"
click node_engine "https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/engine.js"
click node_registry "https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/registry.js"
click node_protocol "https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/protocol.js"
click node_match "https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/match.js"
click node_rules "https://github.com/theplaceoftangerine/ottv2/blob/main/src/rule-sets.js"
click node_docker "https://github.com/theplaceoftangerine/ottv2/blob/main/src/sandbox/docker.js"
click node_practice "https://github.com/theplaceoftangerine/ottv2/blob/main/src/sandbox/match-service.js"
click node_scoring "https://github.com/theplaceoftangerine/ottv2/blob/main/src/scoring.js"
click node_database "https://github.com/theplaceoftangerine/ottv2/blob/main/src/db.js"
click node_legacy "https://github.com/theplaceoftangerine/ottv2/blob/main/src/legacy.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_submissions,node_source,node_samples toneBlue
class node_engine,node_registry,node_protocol,node_match,node_rules,node_legacy toneAmber
class node_docker,node_practice toneMint
class node_server,node_admin,node_users,node_scoring toneRose
class node_database,node_contestant,node_organizer toneIndigo
```

## Components

### Bot Submissions

- [Submission Workflow](https://github.com/theplaceoftangerine/ottv2/blob/main/src/submissions/service.js): `src/submissions/service.js`
- [Source Intake](https://github.com/theplaceoftangerine/ottv2/blob/main/src/submissions/source.js): `src/submissions/source.js`
- [Sample Bots](https://github.com/theplaceoftangerine/ottv2/blob/main/src/sandbox/samples.js): `src/sandbox/samples.js`

### Game and Rules

- [Game Engine](https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/engine.js): `src/game/engine.js`
- [Engine Registry](https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/registry.js): `src/game/registry.js`
- [Bot Protocol](https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/protocol.js): `src/game/protocol.js`
- [Match Runner](https://github.com/theplaceoftangerine/ottv2/blob/main/src/game/match.js): `src/game/match.js`
- [Rule Sets](https://github.com/theplaceoftangerine/ottv2/blob/main/src/rule-sets.js): `src/rule-sets.js`
- [Live Manual Game](https://github.com/theplaceoftangerine/ottv2/blob/main/src/legacy.js): `src/legacy.js`

### Isolated Execution

- [Docker Sandbox](https://github.com/theplaceoftangerine/ottv2/blob/main/src/sandbox/docker.js): `src/sandbox/docker.js`
- [Practice Matches](https://github.com/theplaceoftangerine/ottv2/blob/main/src/sandbox/match-service.js): `src/sandbox/match-service.js`

### Tournament Operations

- [HTTP Application](https://github.com/theplaceoftangerine/ottv2/blob/main/src/app.js): `src/app.js`
- [Admin Operations](https://github.com/theplaceoftangerine/ottv2/blob/main/src/admin.js): `src/admin.js`
- [Accounts](https://github.com/theplaceoftangerine/ottv2/blob/main/src/users.js): `src/users.js`
- [Round Scoring](https://github.com/theplaceoftangerine/ottv2/blob/main/src/scoring.js): `src/scoring.js`

### Persistent State

- [SQLite Database](https://github.com/theplaceoftangerine/ottv2/blob/main/src/db.js): `src/db.js`

### Other components

- **Contestant**
- **Organizer**

## Connections

- Contestant → HTTP Application: submits bots (evidence: `README.md`)
- Organizer → HTTP Application: operates tournament (evidence: `README.md`)
- HTTP Application → Submission Workflow: routes submissions (evidence: `src/app.js`)
- HTTP Application → Practice Matches: routes practice (evidence: `src/app.js`)
- HTTP Application → Round Scoring: routes scoring (evidence: `src/app.js`)
- HTTP Application → Rule Sets: routes rules (evidence: `src/app.js`)
- HTTP Application → Admin Operations: uses administration (evidence: `src/app.js`)
- Submission Workflow → Source Intake: extracts and scans (evidence: `src/submissions/service.js`)
- Submission Workflow → Docker Sandbox: prepares and tests (evidence: `src/submissions/service.js`)
- Submission Workflow → Match Runner: runs test matches (evidence: `src/submissions/service.js`)
- Submission Workflow → Sample Bots: uses sample source (evidence: `src/submissions/service.js`)
- Practice Matches → Docker Sandbox: runs bot sessions (evidence: `src/sandbox/match-service.js`)
- Practice Matches → Match Runner: executes matches (evidence: `src/sandbox/match-service.js`)
- Practice Matches → Rule Sets: selects rule version (evidence: `src/sandbox/match-service.js`)
- Practice Matches → Sample Bots: offers sample bots (evidence: `src/sandbox/match-service.js`)
- Round Scoring → Docker Sandbox: runs bot sessions (evidence: `src/scoring.js`)
- Round Scoring → Match Runner: executes matches (evidence: `src/scoring.js`)
- Match Runner → Engine Registry: creates engine (evidence: `src/game/match.js`)
- Engine Registry → Game Engine: instantiates (evidence: `src/game/registry.js`)
- Match Runner → Bot Protocol: builds and parses turns (evidence: `src/game/match.js`)
- Docker Sandbox → Bot Protocol: classifies execution faults (evidence: `src/sandbox/docker.js`)
- Rule Sets → Game Engine: validates rules (evidence: `src/rule-sets.js`)
- Rule Sets → Engine Registry: registers engines (evidence: `src/rule-sets.js`)
- HTTP Application → SQLite Database: persists application state (evidence: `src/app.js`)
- Live Manual Game → SQLite Database: stores live matches (evidence: `src/db.js`)
- Contestant → Live Manual Game: plays manual game (evidence: `README.md`)
- Organizer → Round Scoring: creates and monitors rounds (evidence: `README.md`)
