# yomotsuhisami/eagler-touhou architecture

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

- Interactive diagram: https://gitdiagram.com/yomotsuhisami/eagler-touhou
- Repository: https://github.com/yomotsuhisami/eagler-touhou

## Overview

Eagler Touhou is a browser launcher and multiplayer platform for Touhou games. Players select or import a game package, prepare its runtime, and launch it in the browser; the launcher also supports touch customization, saves and replays, language packs, practice tools, and multiplayer rooms with spectators. Browser storage and service workers provide installed-package persistence and offline launch. Server-side relay and thcrap services support optional network and localization capabilities. The tree and excerpts establish key boundaries, but do not expose all launcher-to-service wiring, so uncertain links are omitted.

Main entry points: [`src/launcher/app.mts`](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/app.mts) (Browser launcher), [`src/launcher/runtime-preparation.mts`](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/runtime-preparation.mts) (Runtime preparation), [`package/package-store.mjs`](https://github.com/yomotsuhisami/eagler-touhou/blob/main/package/package-store.mjs) (Package Store), [`src/launcher/room-network.mts`](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/room-network.mts) (Multiplayer UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_player["Launcher experience"]
  node_launcher["Browser launcher<br/>[app.mts]"]
  node_touch["Touch controls"]
  node_multiplayer["Multiplayer UI<br/>[room-network.mts]"]
  node_practice["Practice tools<br/>[thprac.mjs]"]
  node_languages["Language packs"]
end

subgraph group_storage["Local packages"]
  node_packageui["Package install/import"]
  node_store[("Package Store<br/>[package-store.mjs]")]
  node_generation["Package generations"]
  node_legacy["Legacy migration"]
end

subgraph group_runtime["Runtime delivery"]
  node_runtimeprep["Runtime preparation"]
  node_runtimelease["Runtime generation lease"]
  node_runtimecache[("Runtime offline cache")]
  node_appshell["App shell updates"]
end

subgraph group_online["Online services"]
  node_relay["Netplay relay<br/>[netplay-relay.mjs]"]
  node_thcrap["thcrap service<br/>[thcrap-service.mjs]"]
  node_thcrapupstream["thcrap repositories"]
end

subgraph group_deployment["Site deployment"]
  node_host["Host builder<br/>[build.mjs]"]
  node_resource["Resource routing"]
end

node_player(("Player"))
node_browser(("Browser runtime"))

node_player -->|"uses"| node_launcher
node_launcher -->|"manages packages"| node_packageui
node_packageui -->|"installs and reads"| node_store
node_launcher -->|"reads package data"| node_store
node_legacy -->|"migrates into"| node_store
node_launcher -->|"prepares launch"| node_runtimeprep
node_runtimeprep -->|"leases generation"| node_runtimelease
node_runtimeprep -->|"requests runtime"| node_runtimecache
node_runtimecache -->|"serves cached files"| node_browser
node_launcher -->|"launches game"| node_browser
node_launcher -->|"configures controls"| node_touch
node_launcher -->|"coordinates rooms"| node_multiplayer
node_multiplayer -.->|"relays messages"| node_relay
node_launcher -->|"manages language packs"| node_languages
node_thcrap -->|"downloads packs"| node_thcrapupstream
node_launcher -.->|"requests language data"| node_thcrap
node_launcher -.->|"integrates practice"| node_practice
node_browser -->|"registers updates"| node_appshell
node_host -->|"configures delivery"| node_resource

click node_launcher "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/app.mts"
click node_touch "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/touch-layout-model.mts"
click node_multiplayer "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/room-network.mts"
click node_practice "https://github.com/yomotsuhisami/eagler-touhou/blob/main/integrations/thprac.mjs"
click node_languages "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/language-pack-validation.mts"
click node_packageui "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/package-feature.mts"
click node_store "https://github.com/yomotsuhisami/eagler-touhou/blob/main/package/package-store.mjs"
click node_generation "https://github.com/yomotsuhisami/eagler-touhou/blob/main/package/package-generation.mjs"
click node_legacy "https://github.com/yomotsuhisami/eagler-touhou/blob/main/legacy/legacy-import-storage.mjs"
click node_runtimeprep "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/runtime-preparation.mts"
click node_runtimelease "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/runtime-generation-lease.mts"
click node_runtimecache "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/runtime-cache-sw.js"
click node_appshell "https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/app-shell-client.mts"
click node_relay "https://github.com/yomotsuhisami/eagler-touhou/blob/main/server/netplay-relay.mjs"
click node_thcrap "https://github.com/yomotsuhisami/eagler-touhou/blob/main/server/thcrap-service.mjs"
click node_host "https://github.com/yomotsuhisami/eagler-touhou/blob/main/host/build.mjs"
click node_resource "https://github.com/yomotsuhisami/eagler-touhou/blob/main/lib/external-resource-routing.mjs"

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_launcher,node_touch,node_multiplayer,node_practice,node_languages,node_browser toneBlue
class node_packageui,node_store,node_generation,node_legacy toneAmber
class node_runtimeprep,node_runtimelease,node_runtimecache,node_appshell toneMint
class node_relay,node_thcrap,node_thcrapupstream toneRose
class node_host,node_resource,node_player toneIndigo
```

## Components

### Launcher experience

- [Browser launcher](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/app.mts): `src/launcher/app.mts`
- [Touch controls](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/touch-layout-model.mts): `src/launcher/touch-layout-model.mts`
- [Multiplayer UI](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/room-network.mts): `src/launcher/room-network.mts`
- [Practice tools](https://github.com/yomotsuhisami/eagler-touhou/blob/main/integrations/thprac.mjs): `integrations/thprac.mjs`
- [Language packs](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/language-pack-validation.mts): `src/launcher/language-pack-validation.mts`

### Local packages

- [Package install/import](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/package-feature.mts): `src/launcher/package-feature.mts`
- [Package Store](https://github.com/yomotsuhisami/eagler-touhou/blob/main/package/package-store.mjs): `package/package-store.mjs`
- [Package generations](https://github.com/yomotsuhisami/eagler-touhou/blob/main/package/package-generation.mjs): `package/package-generation.mjs`
- [Legacy migration](https://github.com/yomotsuhisami/eagler-touhou/blob/main/legacy/legacy-import-storage.mjs): `legacy/legacy-import-storage.mjs`

### Runtime delivery

- [Runtime preparation](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/runtime-preparation.mts): `src/launcher/runtime-preparation.mts`
- [Runtime generation lease](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/runtime-generation-lease.mts): `src/launcher/runtime-generation-lease.mts`
- [Runtime offline cache](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/runtime-cache-sw.js): `src/runtime-cache-sw.js`
- [App shell updates](https://github.com/yomotsuhisami/eagler-touhou/blob/main/src/launcher/app-shell-client.mts): `src/launcher/app-shell-client.mts`

### Online services

- [Netplay relay](https://github.com/yomotsuhisami/eagler-touhou/blob/main/server/netplay-relay.mjs): `server/netplay-relay.mjs`
- [thcrap service](https://github.com/yomotsuhisami/eagler-touhou/blob/main/server/thcrap-service.mjs): `server/thcrap-service.mjs`
- **thcrap repositories**

### Site deployment

- [Host builder](https://github.com/yomotsuhisami/eagler-touhou/blob/main/host/build.mjs): `host/build.mjs`
- [Resource routing](https://github.com/yomotsuhisami/eagler-touhou/blob/main/lib/external-resource-routing.mjs): `lib/external-resource-routing.mjs`

### Other components

- **Player**
- **Browser runtime**

## Connections

- Player → Browser launcher: uses
- Browser launcher → Package install/import: manages packages
- Package install/import → Package Store: installs and reads
- Browser launcher → Package Store: reads package data
- Legacy migration → Package Store: migrates into
- Browser launcher → Runtime preparation: prepares launch
- Runtime preparation → Runtime generation lease: leases generation
- Runtime preparation → Runtime offline cache: requests runtime
- Runtime offline cache → Browser runtime: serves cached files
- Browser launcher → Browser runtime: launches game
- Browser launcher → Touch controls: configures controls
- Browser launcher → Multiplayer UI: coordinates rooms
- Multiplayer UI → Netplay relay: relays messages
- Browser launcher → Language packs: manages language packs
- thcrap service → thcrap repositories: downloads packs
- Browser launcher → thcrap service: requests language data
- Browser launcher → Practice tools: integrates practice
- Browser runtime → App shell updates: registers updates
- Host builder → Resource routing: configures delivery
