# leegunwoooo/nikke-api architecture

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

- Interactive diagram: https://gitdiagram.com/leegunwoooo/nikke-api
- Repository: https://github.com/leegunwoooo/nikke-api

## Overview

nikke-api is a Cloudflare-served REST and MCP API for NIKKE game data, story scripts, burst cutscenes, and BlablaLink account features. Users request REST resources or MCP tools; the Worker dispatches requests into the shared app, which reads normalized static data or queries BlablaLink for live account and leaderboard results. Supporting branches enrich cutscenes and expose API guidance. The README documents broad endpoint coverage, but sampled factory excerpts show only selected routes, so the graph avoids claims about unsampled route internals.

Main entry points: [`src/factory.ts`](https://github.com/leegunwoooo/nikke-api/blob/main/src/factory.ts) (Route Application), [`worker/index.ts`](https://github.com/leegunwoooo/nikke-api/blob/main/worker/index.ts) (Cloudflare Worker), [`src/storage.ts`](https://github.com/leegunwoooo/nikke-api/blob/main/src/storage.ts) (Data Storage), [`src/burst.ts`](https://github.com/leegunwoooo/nikke-api/blob/main/src/burst.ts) (Cutscene Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API Runtime"]
  node_worker["Cloudflare Worker<br/>[index.ts]"]
  node_factory["Route Application<br/>[factory.ts]"]
  node_storage["Data Storage<br/>[storage.ts]"]
end

subgraph group_data["Game Data"]
  node_staticdata[("Static Game Data")]
  node_cdn["CDN Data Sync<br/>[cdn.ts]"]
  node_storyevents["Story Events<br/>[events.ts]"]
  node_family["Character Families<br/>[family.ts]"]
  node_storyroute["Story Ordering<br/>[story-route.ts]"]
  node_library["Library Stories<br/>[library-stories.ts]"]
end

subgraph group_burst["Burst Cutscenes"]
  node_cutscene["Cutscene Catalog<br/>[burst.ts]"]
  node_playback["Playback Composer<br/>[burst-playback.ts]"]
  node_viewer["Cutscene Viewer<br/>[burst-viewer.ts]"]
  node_scene["Spine Scene<br/>[burst-scene.ts]"]
  node_player["Spine Player<br/>[player.ts]"]
end

subgraph group_interfaces["API Interfaces"]
  node_mcp["MCP Tools<br/>[mcp.ts]"]
  node_openapi["OpenAPI Schema<br/>[openapi.ts]"]
  node_guides["LLM Guides<br/>[llms.ts]"]
end

subgraph group_external["External Data"]
  node_blabla["BlablaLink Client<br/>[blabla.ts]"]
end

node_consumer(("API Consumer"))
node_blablaservice(("BlablaLink Service"))

node_consumer -->|"requests API"| node_worker
node_worker -->|"dispatches to"| node_factory
node_worker -->|"configures"| node_storage
node_factory -->|"reads data"| node_storage
node_storage -->|"fetches files"| node_staticdata
node_factory -->|"groups scenes"| node_storyevents
node_factory -->|"builds families"| node_family
node_factory -->|"queries service"| node_blabla
node_blabla -->|"calls API"| node_blablaservice
node_factory -->|"enriches bursts"| node_cutscene
node_cutscene -->|"composes tracks"| node_playback
node_viewer -->|"loads cutscenes"| node_cutscene
node_player -->|"renders scene"| node_scene
node_scene -.->|"uses playback"| node_playback
node_mcp -->|"wraps routes"| node_factory
node_factory -.->|"serves story order"| node_storyroute
node_factory -.->|"serves library scripts"| node_library
node_factory -.->|"serves schema"| node_openapi
node_factory -.->|"serves guides"| node_guides
node_consumer -.->|"uses tools"| node_mcp

click node_worker "https://github.com/leegunwoooo/nikke-api/blob/main/worker/index.ts"
click node_factory "https://github.com/leegunwoooo/nikke-api/blob/main/src/factory.ts"
click node_storage "https://github.com/leegunwoooo/nikke-api/blob/main/src/storage.ts"
click node_cdn "https://github.com/leegunwoooo/nikke-api/blob/main/src/cdn.ts"
click node_storyevents "https://github.com/leegunwoooo/nikke-api/blob/main/src/events.ts"
click node_family "https://github.com/leegunwoooo/nikke-api/blob/main/src/family.ts"
click node_storyroute "https://github.com/leegunwoooo/nikke-api/blob/main/src/story-route.ts"
click node_library "https://github.com/leegunwoooo/nikke-api/blob/main/scripts/library-stories.ts"
click node_cutscene "https://github.com/leegunwoooo/nikke-api/blob/main/src/burst.ts"
click node_playback "https://github.com/leegunwoooo/nikke-api/blob/main/src/burst-playback.ts"
click node_viewer "https://github.com/leegunwoooo/nikke-api/blob/main/src/burst-viewer.ts"
click node_scene "https://github.com/leegunwoooo/nikke-api/blob/main/viewer/burst-scene.ts"
click node_player "https://github.com/leegunwoooo/nikke-api/blob/main/viewer/player.ts"
click node_mcp "https://github.com/leegunwoooo/nikke-api/blob/main/src/mcp.ts"
click node_openapi "https://github.com/leegunwoooo/nikke-api/blob/main/src/openapi.ts"
click node_guides "https://github.com/leegunwoooo/nikke-api/blob/main/src/llms.ts"
click node_blabla "https://github.com/leegunwoooo/nikke-api/blob/main/src/blabla.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_worker,node_factory,node_storage toneBlue
class node_staticdata,node_cdn,node_storyevents,node_family,node_storyroute,node_library toneAmber
class node_cutscene,node_playback,node_viewer,node_scene,node_player,node_consumer toneMint
class node_mcp,node_openapi,node_guides toneRose
class node_blabla,node_blablaservice toneIndigo
```

## Components

### API Runtime

- [Cloudflare Worker](https://github.com/leegunwoooo/nikke-api/blob/main/worker/index.ts): `worker/index.ts`
- [Route Application](https://github.com/leegunwoooo/nikke-api/blob/main/src/factory.ts): `src/factory.ts`
- [Data Storage](https://github.com/leegunwoooo/nikke-api/blob/main/src/storage.ts): `src/storage.ts`

### Game Data

- **Static Game Data**
- [CDN Data Sync](https://github.com/leegunwoooo/nikke-api/blob/main/src/cdn.ts): `src/cdn.ts`
- [Story Events](https://github.com/leegunwoooo/nikke-api/blob/main/src/events.ts): `src/events.ts`
- [Character Families](https://github.com/leegunwoooo/nikke-api/blob/main/src/family.ts): `src/family.ts`
- [Story Ordering](https://github.com/leegunwoooo/nikke-api/blob/main/src/story-route.ts): `src/story-route.ts`
- [Library Stories](https://github.com/leegunwoooo/nikke-api/blob/main/scripts/library-stories.ts): `scripts/library-stories.ts`

### Burst Cutscenes

- [Cutscene Catalog](https://github.com/leegunwoooo/nikke-api/blob/main/src/burst.ts): `src/burst.ts`
- [Playback Composer](https://github.com/leegunwoooo/nikke-api/blob/main/src/burst-playback.ts): `src/burst-playback.ts`
- [Cutscene Viewer](https://github.com/leegunwoooo/nikke-api/blob/main/src/burst-viewer.ts): `src/burst-viewer.ts`
- [Spine Scene](https://github.com/leegunwoooo/nikke-api/blob/main/viewer/burst-scene.ts): `viewer/burst-scene.ts`
- [Spine Player](https://github.com/leegunwoooo/nikke-api/blob/main/viewer/player.ts): `viewer/player.ts`

### API Interfaces

- [MCP Tools](https://github.com/leegunwoooo/nikke-api/blob/main/src/mcp.ts): `src/mcp.ts`
- [OpenAPI Schema](https://github.com/leegunwoooo/nikke-api/blob/main/src/openapi.ts): `src/openapi.ts`
- [LLM Guides](https://github.com/leegunwoooo/nikke-api/blob/main/src/llms.ts): `src/llms.ts`

### External Data

- [BlablaLink Client](https://github.com/leegunwoooo/nikke-api/blob/main/src/blabla.ts): `src/blabla.ts`

### Other components

- **API Consumer**
- **BlablaLink Service**

## Connections

- API Consumer → Cloudflare Worker: requests API (evidence: `worker/index.ts`)
- Cloudflare Worker → Route Application: dispatches to (evidence: `worker/index.ts`)
- Cloudflare Worker → Data Storage: configures (evidence: `worker/index.ts`)
- Route Application → Data Storage: reads data (evidence: `src/factory.ts`)
- Data Storage → Static Game Data: fetches files (evidence: `src/storage.ts`)
- Route Application → Story Events: groups scenes (evidence: `src/factory.ts`)
- Route Application → Character Families: builds families (evidence: `src/factory.ts`)
- Route Application → BlablaLink Client: queries service (evidence: `src/factory.ts`)
- BlablaLink Client → BlablaLink Service: calls API
- Route Application → Cutscene Catalog: enriches bursts (evidence: `src/factory.ts`)
- Cutscene Catalog → Playback Composer: composes tracks (evidence: `src/burst.ts`)
- Cutscene Viewer → Cutscene Catalog: loads cutscenes (evidence: `src/burst-viewer.ts`)
- Spine Player → Spine Scene: renders scene (evidence: `viewer/player.ts`)
- Spine Scene → Playback Composer: uses playback
- MCP Tools → Route Application: wraps routes (evidence: `src/mcp.ts`)
- Route Application → Story Ordering: serves story order (evidence: `src/factory.ts`)
- Route Application → Library Stories: serves library scripts
- Route Application → OpenAPI Schema: serves schema (evidence: `src/factory.ts`)
- Route Application → LLM Guides: serves guides (evidence: `src/factory.ts`)
- API Consumer → MCP Tools: uses tools
