# ackermanngue/aoe4-game-reviewer architecture

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

- Interactive diagram: https://gitdiagram.com/ackermanngue/aoe4-game-reviewer
- Repository: https://github.com/ackermanngue/aoe4-game-reviewer

## Overview

AOE4 Game Reviewer is a local browser application for gathering AoE4 match data, preparing it for a ChatGPT-assisted review, and viewing or exporting the resulting report. The main workflow runs from player and game selection through match-data collection and JSON assembly, then prompt generation, external analysis, and Markdown report import. The README documents charting, PDF, saved-report, and theme capabilities; paths for these are included, though some wiring is not shown in the sampled excerpts.

Main entry points: [`js/app.js`](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/app.js) (Application workflow), [`server.js`](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/server.js) (Local server and proxy), [`js/api.js`](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/api.js) (API client), [`js/prompts.js`](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/prompts.js) (Prompt generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Player and Match Discovery"]
  node_app["Application workflow<br/>[app.js]"]
  node_ui["Game and player views<br/>[render.js]"]
end

subgraph group_collection["Match Data and Export"]
  node_api["API client<br/>[api.js]"]
  node_build["Build-order parser<br/>[build-order.js]"]
  node_exporter["Game JSON assembly<br/>[exporter.js]"]
end

subgraph group_review["Analysis and Reports"]
  node_prompts["Prompt generation<br/>[prompts.js]"]
  node_analysisprompt["Analysis template<br/>[analysis.md]"]
  node_pdfprompt["PDF task template<br/>[pdf-task.md]"]
  node_report["Report viewer and charts<br/>[report.js]"]
  node_storage[("Saved reports<br/>[app.js]")]
end

subgraph group_runtime["Local Runtime"]
  node_server["Local server and proxy<br/>[server.js]"]
  node_theme["Theme system<br/>[theme.js]"]
end

node_player(("Player"))
node_browser(("Browser UI"))
node_aoeapi["AoE4World API"]
node_chatgpt["ChatGPT"]
node_markdown["Analysis Markdown"]
node_coolors["Coolors palette service"]

node_player -->|"searches"| node_browser
node_browser -->|"provides input"| node_app
node_app -->|"requests player and game data"| node_api
node_api -->|"fetches proxied data"| node_server
node_server -->|"proxies requests"| node_aoeapi
node_aoeapi -->|"returns match data"| node_server
node_server -->|"returns responses"| node_api
node_app -->|"renders selection"| node_ui
node_app -->|"retrieves build order"| node_build
node_build -->|"fetches game page"| node_server
node_app -->|"assembles match data"| node_exporter
node_app -->|"requests analysis prompt"| node_prompts
node_prompts -->|"loads"| node_analysisprompt
node_prompts -->|"loads"| node_pdfprompt
node_browser -->|"pastes prompt"| node_chatgpt
node_chatgpt -->|"produces analysis"| node_markdown
node_browser -->|"loads report file"| node_app
node_app -->|"renders report"| node_report
node_report -->|"fetches player profiles"| node_api
node_app -->|"saves and reloads reports"| node_storage
node_app -->|"applies themes"| node_theme
node_theme -.->|"requests palette"| node_coolors
node_chatgpt -.->|"provides PDF download"| node_browser

click node_app "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/app.js"
click node_ui "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/render.js"
click node_api "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/api.js"
click node_server "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/server.js"
click node_build "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/build-order.js"
click node_exporter "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/exporter.js"
click node_prompts "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/prompts.js"
click node_analysisprompt "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/prompts/analysis.md"
click node_pdfprompt "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/prompts/pdf-task.md"
click node_report "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/report.js"
click node_storage "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/app.js"
click node_theme "https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/theme.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_app,node_ui,node_browser toneBlue
class node_api,node_build,node_exporter toneAmber
class node_prompts,node_analysisprompt,node_pdfprompt,node_report,node_storage,node_aoeapi toneMint
class node_server,node_theme toneRose
class node_player,node_chatgpt,node_markdown,node_coolors toneIndigo
```

## Components

### Player and Match Discovery

- [Application workflow](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/app.js): `js/app.js`
- [Game and player views](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/render.js): `js/render.js`

### Match Data and Export

- [API client](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/api.js): `js/api.js`
- [Build-order parser](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/build-order.js): `js/build-order.js`
- [Game JSON assembly](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/exporter.js): `js/exporter.js`

### Analysis and Reports

- [Prompt generation](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/prompts.js): `js/prompts.js`
- [Analysis template](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/prompts/analysis.md): `prompts/analysis.md`
- [PDF task template](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/prompts/pdf-task.md): `prompts/pdf-task.md`
- [Report viewer and charts](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/report.js): `js/report.js`
- [Saved reports](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/app.js): `js/app.js`

### Local Runtime

- [Local server and proxy](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/server.js): `server.js`
- [Theme system](https://github.com/ackermanngue/aoe4-game-reviewer/blob/main/js/theme.js): `js/theme.js`

### Other components

- **Player**
- **Browser UI**
- **AoE4World API**
- **ChatGPT**
- **Analysis Markdown**
- **Coolors palette service**

## Connections

- Player → Browser UI: searches
- Browser UI → Application workflow: provides input
- Application workflow → API client: requests player and game data
- API client → Local server and proxy: fetches proxied data
- Local server and proxy → AoE4World API: proxies requests
- AoE4World API → Local server and proxy: returns match data
- Local server and proxy → API client: returns responses
- Application workflow → Game and player views: renders selection
- Application workflow → Build-order parser: retrieves build order
- Build-order parser → Local server and proxy: fetches game page
- Application workflow → Game JSON assembly: assembles match data
- Application workflow → Prompt generation: requests analysis prompt
- Prompt generation → Analysis template: loads
- Prompt generation → PDF task template: loads
- Browser UI → ChatGPT: pastes prompt
- ChatGPT → Analysis Markdown: produces analysis
- Browser UI → Application workflow: loads report file
- Application workflow → Report viewer and charts: renders report
- Report viewer and charts → API client: fetches player profiles
- Application workflow → Saved reports: saves and reloads reports
- Application workflow → Theme system: applies themes
- Theme system → Coolors palette service: requests palette
- ChatGPT → Browser UI: provides PDF download
