# sajeetharan/name-race-agent-workshop architecture

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

- Interactive diagram: https://gitdiagram.com/sajeetharan/name-race-agent-workshop
- Repository: https://github.com/sajeetharan/name-race-agent-workshop

## Overview

Name Race is a live, nickname-based quiz with host controls, participant play, a ranked leaderboard and podium. Participants join a room, answer three questions, and see their cars advance; the host reviews entries, starts and advances the quiz, then reveals results or resets/deletes the room. The HTTP server connects the browser UI to MCP-backed race rules and file persistence. MCP also exposes runtime tools and a static development guide; an optional Gemini commentator reads anonymous race summaries. Some route and UI details are unsampled, so those links rely on README documentation.

Main entry points: [`public/app.js`](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/public/app.js) (Game UI), [`src/server.ts`](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/server.ts) (HTTP API), [`src/agent.ts`](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/agent.ts) (AI Commentator), [`src/race.ts`](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/race.ts) (Race Rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Browser Experience"]
  node_browser["Game UI<br/>[app.js]"]
  node_host_controls["Host Controls<br/>[app.js]"]
  node_race_display["Race Display<br/>[app.js]"]
end

subgraph group_http["HTTP Host"]
  node_http_server["HTTP API<br/>[server.ts]"]
  node_mcp_connection["MCP Client<br/>[connection.ts]"]
  node_commentator["AI Commentator<br/>[agent.ts]"]
end

subgraph group_mcp["MCP Runtime"]
  node_runtime_tools["Runtime Tools<br/>[mcp.ts]"]
  node_guide_tools["Guide Tools<br/>[mcp.ts]"]
end

subgraph group_domain["Race Domain"]
  node_race_rules["Race Rules<br/>[race.ts]"]
  node_question_bank["Question Bank<br/>[questions.ts]"]
  node_room_files[("Room Storage<br/>[race.ts]")]
end

node_host(("Host"))
node_participants(("Participants"))
node_gemini["Gemini API"]

node_host -->|"controls"| node_host_controls
node_participants -->|"join and answer"| node_browser
node_host_controls -->|"uses"| node_browser
node_browser -->|"requests"| node_http_server
node_http_server -->|"serves assets"| node_browser
node_http_server -->|"dispatches calls"| node_mcp_connection
node_http_server -->|"requests commentary"| node_commentator
node_commentator -->|"reads summary"| node_mcp_connection
node_commentator -->|"requests style"| node_gemini
node_mcp_connection -->|"calls over stdio"| node_runtime_tools
node_runtime_tools -->|"dispatches actions"| node_race_rules
node_guide_tools -->|"provides game guidance"| node_host
node_race_rules -->|"uses questions"| node_question_bank
node_race_rules -->|"reads and writes"| node_room_files
node_race_display -->|"renders state"| node_browser
node_browser -->|"shows rankings"| node_race_display

click node_browser "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/public/app.js"
click node_host_controls "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/public/app.js"
click node_race_display "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/public/app.js"
click node_http_server "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/server.ts"
click node_mcp_connection "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/connection.ts"
click node_commentator "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/agent.ts"
click node_runtime_tools "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/mcp.ts"
click node_guide_tools "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/mcp.ts"
click node_race_rules "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/race.ts"
click node_question_bank "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/questions.ts"
click node_room_files "https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/race.ts"

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_browser,node_host_controls,node_race_display toneBlue
class node_http_server,node_mcp_connection,node_commentator toneAmber
class node_runtime_tools,node_guide_tools,node_gemini toneMint
class node_race_rules,node_question_bank,node_room_files toneRose
class node_host,node_participants toneIndigo
```

## Components

### Browser Experience

- [Game UI](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/public/app.js): `public/app.js`
- [Host Controls](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/public/app.js): `public/app.js`
- [Race Display](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/public/app.js): `public/app.js`

### HTTP Host

- [HTTP API](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/server.ts): `src/server.ts`
- [MCP Client](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/connection.ts): `src/connection.ts`
- [AI Commentator](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/agent.ts): `src/agent.ts`

### MCP Runtime

- [Runtime Tools](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/mcp.ts): `src/mcp.ts`
- [Guide Tools](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/mcp.ts): `src/mcp.ts`

### Race Domain

- [Race Rules](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/race.ts): `src/race.ts`
- [Question Bank](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/questions.ts): `src/questions.ts`
- [Room Storage](https://github.com/sajeetharan/name-race-agent-workshop/blob/main/src/race.ts): `src/race.ts`

### Other components

- **Host**
- **Participants**
- **Gemini API**

## Connections

- Host → Host Controls: controls (evidence: `README.md`)
- Participants → Game UI: join and answer (evidence: `README.md`)
- Host Controls → Game UI: uses (evidence: `public/app.js`)
- Game UI → HTTP API: requests (evidence: `public/app.js`)
- HTTP API → Game UI: serves assets (evidence: `src/server.ts`)
- HTTP API → MCP Client: dispatches calls (evidence: `src/server.ts`)
- HTTP API → AI Commentator: requests commentary (evidence: `src/server.ts`)
- AI Commentator → MCP Client: reads summary (evidence: `src/agent.ts`)
- AI Commentator → Gemini API: requests style (evidence: `src/agent.ts`)
- MCP Client → Runtime Tools: calls over stdio (evidence: `src/connection.ts`)
- Runtime Tools → Race Rules: dispatches actions (evidence: `src/mcp.ts`)
- Guide Tools → Host: provides game guidance (evidence: `README.md`)
- Race Rules → Question Bank: uses questions (evidence: `src/race.ts`)
- Race Rules → Room Storage: reads and writes (evidence: `src/race.ts`)
- Race Display → Game UI: renders state (evidence: `public/app.js`)
- Game UI → Race Display: shows rankings (evidence: `README.md`)
