# clashkinginc/clashkingassets architecture

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

- Interactive diagram: https://gitdiagram.com/clashkinginc/clashkingassets
- Repository: https://github.com/clashkinginc/clashkingassets

## Overview

ClashKing Assets is a game-asset publishing and delivery repository, with a browser-based game wiki and specialized SC/3D asset tooling. A typical user requests an asset URL; the Worker routes it to storage and may transform images before responding. Wiki users can browse and search game data, reference pages, and asset galleries. The graph includes major indexed modules even where their implementation was not sampled; relationships are shown only where the excerpts, index references, or README support them.

Main entry points: [`wiki/src/main.jsx`](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/main.jsx) (Wiki application), [`wiki/src/catalog.js`](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/catalog.js) (Asset catalogue), [`worker/src/assets.ts`](https://github.com/clashkinginc/clashkingassets/blob/main/worker/src/assets.ts) (Asset serving), [`wiki/src/entity.jsx`](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/entity.jsx) (Entity pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_publishing["Asset publishing"]
  node_static_updater["Static data updater<br/>[update_static.py]"]
  node_sound_assets["Sound assets<br/>[asset_sounds.py]"]
  node_ability_generator["Ability generator"]
  node_asset_index["Asset index<br/>[scindex.py]"]
  node_sound_index["Sound index<br/>[sound_index.py]"]
end

subgraph group_delivery["Asset delivery"]
  node_worker_entry["Request router<br/>[index.ts]"]
  node_asset_service["Asset serving<br/>[assets.ts]"]
  node_static_images["Static image stream<br/>[static-image.ts]"]
  node_r2_assets[("Asset object store")]
  node_image_binding["Image transform service"]
end

subgraph group_wiki["Game wiki"]
  node_wiki_app["Wiki application<br/>[main.jsx]"]
  node_catalogue["Asset catalogue<br/>[catalog.js]"]
  node_wiki_ui["Shared UI<br/>[ui.jsx]"]
  node_entity_pages["Entity pages<br/>[entity.jsx]"]
  node_reference_pages["Reference pages<br/>[reference.jsx]"]
  node_gallery_pages["Asset galleries<br/>[gallery.jsx]"]
  node_archive_export["Asset exports<br/>[exports.js]"]
  node_archive_data["Archive data<br/>[archive.js]"]
  node_reference_data["Reference data<br/>[reference-data.js]"]
  node_wiki_locale["Wiki localization<br/>[locale.js]"]
  node_wiki_mechanics["Game mechanics<br/>[mechanics.jsx]"]
  node_wiki_upgrades["Upgrade data<br/>[upgrades.jsx]"]
end

subgraph group_formats["Asset formats"]
  node_sc_reader["SC format reader<br/>[sc2.go]"]
  node_texture_reader["Texture reader<br/>[texture.go]"]
  node_asset_exporter["Asset exporter<br/>[exporter.go]"]
  node_process_roots["Root processing<br/>[root_process.go]"]
  node_sc3d_viewer["3D asset viewer<br/>[viewer.js]"]
  node_animation_codec["Animation codec"]
  node_weight_codec["Weight codec<br/>[weight-codec.mjs]"]
end

node_asset_user(("Asset consumer"))
node_browser_user(("Wiki visitor"))
node_static_host[("Hosted asset URLs")]

node_asset_user -->|"requests assets"| node_static_host
node_browser_user -->|"browses wiki"| node_wiki_app
node_wiki_app -->|"loads catalogue"| node_catalogue
node_wiki_app -->|"renders controls"| node_wiki_ui
node_wiki_app -->|"renders references"| node_reference_pages
node_wiki_app -->|"uses locale"| node_wiki_locale
node_wiki_app -->|"renders entities"| node_entity_pages
node_wiki_app -->|"renders galleries"| node_gallery_pages
node_entity_pages -->|"reads entity data"| node_catalogue
node_entity_pages -->|"exports images"| node_archive_export
node_entity_pages -->|"uses controls"| node_wiki_ui
node_reference_pages -->|"reads reference data"| node_reference_data
node_reference_pages -->|"uses upgrade data"| node_wiki_upgrades
node_reference_pages -->|"reads catalogue"| node_catalogue
node_wiki_mechanics -->|"reads game data"| node_catalogue
node_wiki_upgrades -->|"reads game data"| node_catalogue
node_gallery_pages -->|"reads catalogue"| node_catalogue
node_gallery_pages -->|"exports assets"| node_archive_export
node_archive_export -->|"reads asset files"| node_catalogue
node_archive_export -->|"uses archive data"| node_archive_data
node_wiki_ui -->|"builds asset URLs"| node_catalogue
node_worker_entry -->|"serves asset requests"| node_asset_service
node_worker_entry -->|"routes site requests"| node_static_host
node_asset_service -->|"reads objects"| node_r2_assets
node_asset_service -->|"streams image data"| node_static_images
node_asset_service -->|"transforms images"| node_image_binding
node_sc3d_viewer -->|"decodes animation"| node_animation_codec
node_sc3d_viewer -->|"decodes weights"| node_weight_codec

click node_static_updater "https://github.com/clashkinginc/clashkingassets/blob/main/update_static.py"
click node_sound_assets "https://github.com/clashkinginc/clashkingassets/blob/main/asset_sounds.py"
click node_ability_generator "https://github.com/clashkinginc/clashkingassets/blob/main/generate_abilities.py"
click node_asset_index "https://github.com/clashkinginc/clashkingassets/blob/main/scindex.py"
click node_sound_index "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/scripts/sound_index.py"
click node_wiki_app "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/main.jsx"
click node_catalogue "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/catalog.js"
click node_wiki_ui "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/ui.jsx"
click node_entity_pages "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/entity.jsx"
click node_reference_pages "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/reference.jsx"
click node_gallery_pages "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/gallery.jsx"
click node_archive_export "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/exports.js"
click node_archive_data "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/archive.js"
click node_reference_data "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/reference-data.js"
click node_wiki_locale "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/locale.js"
click node_wiki_mechanics "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/mechanics.jsx"
click node_wiki_upgrades "https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/upgrades.jsx"
click node_worker_entry "https://github.com/clashkinginc/clashkingassets/blob/main/worker/src/index.ts"
click node_asset_service "https://github.com/clashkinginc/clashkingassets/blob/main/worker/src/assets.ts"
click node_static_images "https://github.com/clashkinginc/clashkingassets/blob/main/worker/src/static-image.ts"
click node_sc_reader "https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc/sc2.go"
click node_texture_reader "https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc/texture.go"
click node_asset_exporter "https://github.com/clashkinginc/clashkingassets/blob/main/internal/render/exporter.go"
click node_process_roots "https://github.com/clashkinginc/clashkingassets/blob/main/internal/render/root_process.go"
click node_sc3d_viewer "https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc3d/static/viewer.js"
click node_animation_codec "https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc3d/static/animation-codec.mjs"
click node_weight_codec "https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc3d/static/weight-codec.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_static_updater,node_sound_assets,node_ability_generator,node_asset_index,node_sound_index toneBlue
class node_worker_entry,node_asset_service,node_static_images,node_r2_assets,node_image_binding,node_static_host toneAmber
class node_wiki_app,node_catalogue,node_wiki_ui,node_entity_pages,node_reference_pages,node_gallery_pages,node_archive_export,node_archive_data,node_reference_data,node_wiki_locale,node_wiki_mechanics,node_wiki_upgrades toneMint
class node_sc_reader,node_texture_reader,node_asset_exporter,node_process_roots,node_sc3d_viewer,node_animation_codec,node_weight_codec toneRose
class node_asset_user,node_browser_user toneIndigo
```

## Components

### Asset publishing

- [Static data updater](https://github.com/clashkinginc/clashkingassets/blob/main/update_static.py): `update_static.py`
- [Sound assets](https://github.com/clashkinginc/clashkingassets/blob/main/asset_sounds.py): `asset_sounds.py`
- [Ability generator](https://github.com/clashkinginc/clashkingassets/blob/main/generate_abilities.py): `generate_abilities.py`
- [Asset index](https://github.com/clashkinginc/clashkingassets/blob/main/scindex.py): `scindex.py`
- [Sound index](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/scripts/sound_index.py): `wiki/scripts/sound_index.py`

### Asset delivery

- [Request router](https://github.com/clashkinginc/clashkingassets/blob/main/worker/src/index.ts): `worker/src/index.ts`
- [Asset serving](https://github.com/clashkinginc/clashkingassets/blob/main/worker/src/assets.ts): `worker/src/assets.ts`
- [Static image stream](https://github.com/clashkinginc/clashkingassets/blob/main/worker/src/static-image.ts): `worker/src/static-image.ts`
- **Asset object store**
- **Image transform service**

### Game wiki

- [Wiki application](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/main.jsx): `wiki/src/main.jsx`
- [Asset catalogue](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/catalog.js): `wiki/src/catalog.js`
- [Shared UI](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/ui.jsx): `wiki/src/ui.jsx`
- [Entity pages](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/entity.jsx): `wiki/src/entity.jsx`
- [Reference pages](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/reference.jsx): `wiki/src/reference.jsx`
- [Asset galleries](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/gallery.jsx): `wiki/src/gallery.jsx`
- [Asset exports](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/exports.js): `wiki/src/exports.js`
- [Archive data](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/archive.js): `wiki/src/archive.js`
- [Reference data](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/reference-data.js): `wiki/src/reference-data.js`
- [Wiki localization](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/locale.js): `wiki/src/locale.js`
- [Game mechanics](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/mechanics.jsx): `wiki/src/mechanics.jsx`
- [Upgrade data](https://github.com/clashkinginc/clashkingassets/blob/main/wiki/src/upgrades.jsx): `wiki/src/upgrades.jsx`

### Asset formats

- [SC format reader](https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc/sc2.go): `internal/sc/sc2.go`
- [Texture reader](https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc/texture.go): `internal/sc/texture.go`
- [Asset exporter](https://github.com/clashkinginc/clashkingassets/blob/main/internal/render/exporter.go): `internal/render/exporter.go`
- [Root processing](https://github.com/clashkinginc/clashkingassets/blob/main/internal/render/root_process.go): `internal/render/root_process.go`
- [3D asset viewer](https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc3d/static/viewer.js): `internal/sc3d/static/viewer.js`
- [Animation codec](https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc3d/static/animation-codec.mjs): `internal/sc3d/static/animation-codec.mjs`
- [Weight codec](https://github.com/clashkinginc/clashkingassets/blob/main/internal/sc3d/static/weight-codec.mjs): `internal/sc3d/static/weight-codec.mjs`

### Other components

- **Asset consumer**
- **Wiki visitor**
- **Hosted asset URLs**

## Connections

- Asset consumer → Hosted asset URLs: requests assets (evidence: `README.md`)
- Wiki visitor → Wiki application: browses wiki (evidence: `wiki/src/main.jsx`)
- Wiki application → Asset catalogue: loads catalogue (evidence: `wiki/src/main.jsx`)
- Wiki application → Shared UI: renders controls (evidence: `wiki/src/main.jsx`)
- Wiki application → Reference pages: renders references (evidence: `wiki/src/main.jsx`)
- Wiki application → Wiki localization: uses locale (evidence: `wiki/src/main.jsx`)
- Wiki application → Entity pages: renders entities (evidence: `wiki/src/main.jsx`)
- Wiki application → Asset galleries: renders galleries (evidence: `wiki/src/main.jsx`)
- Entity pages → Asset catalogue: reads entity data (evidence: `wiki/src/entity.jsx`)
- Entity pages → Asset exports: exports images (evidence: `wiki/src/entity.jsx`)
- Entity pages → Shared UI: uses controls (evidence: `wiki/src/entity.jsx`)
- Reference pages → Reference data: reads reference data (evidence: `wiki/src/reference.jsx`)
- Reference pages → Upgrade data: uses upgrade data (evidence: `wiki/src/reference.jsx`)
- Reference pages → Asset catalogue: reads catalogue (evidence: `wiki/src/reference.jsx`)
- Game mechanics → Asset catalogue: reads game data (evidence: `wiki/src/mechanics.jsx`)
- Upgrade data → Asset catalogue: reads game data (evidence: `wiki/src/upgrades.jsx`)
- Asset galleries → Asset catalogue: reads catalogue (evidence: `wiki/src/gallery.jsx`)
- Asset galleries → Asset exports: exports assets (evidence: `wiki/src/gallery.jsx`)
- Asset exports → Asset catalogue: reads asset files (evidence: `wiki/src/exports.js`)
- Asset exports → Archive data: uses archive data (evidence: `wiki/src/exports.js`)
- Shared UI → Asset catalogue: builds asset URLs (evidence: `wiki/src/ui.jsx`)
- Request router → Asset serving: serves asset requests (evidence: `worker/src/index.ts`)
- Request router → Hosted asset URLs: routes site requests (evidence: `worker/src/index.ts`)
- Asset serving → Asset object store: reads objects (evidence: `worker/src/assets.ts`)
- Asset serving → Static image stream: streams image data (evidence: `worker/src/assets.ts`)
- Asset serving → Image transform service: transforms images (evidence: `worker/src/assets.ts`)
- 3D asset viewer → Animation codec: decodes animation (evidence: `internal/sc3d/static/viewer.js`)
- 3D asset viewer → Weight codec: decodes weights (evidence: `internal/sc3d/static/viewer.js`)
