# saltcute/maidraw architecture

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

- Interactive diagram: https://gitdiagram.com/saltcute/maidraw
- Repository: https://github.com/saltcute/maidraw
- Video tour (about a minute): https://gitdiagram.com/saltcute/maidraw/video

## Overview

maidraw is a TypeScript image-rendering library for maimai DX, CHUNITHM, and O.N.G.E.K.I. Its user-facing workflow accepts score/profile data—either supplied directly or obtained through a score-tracker adapter—then renders best-score or chart-detail images using game-specific painter modules and shared theme/layout/canvas infrastructure. The README also documents maimai Level 50 and folder images. Some subsystem relationships are included from explicit README statements or SOURCE INDEX references; unsampled implementation details and integrations are not assumed.

Main entry points: [`src/common/painter/painter.ts`](https://github.com/saltcute/maidraw/blob/main/src/common/painter/painter.ts) (Canvas renderer), [`src/ongeki/painter/chart.ts`](https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/chart.ts) (Chart detail), [`src/chunithm/painter/chart.ts`](https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/chart.ts) (Chart detail), [`src/maimai/painter/best50.ts`](https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/best50.ts) (Best 50)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mai["maimai DX"]
  node_mai_adapter["Score adapter<br/>[adapter.ts]"]
  node_mai_best["Best 50<br/>[best50.ts]"]
  node_mai_level["Level 50<br/>[level50.ts]"]
  node_mai_folder["Folder image<br/>[folder.ts]"]
  node_mai_chart["Chart detail<br/>[chart.ts]"]
  node_mai_scoregrid["Score grid<br/>[scoreGrid.ts]"]
  node_mai_chartgrid["Chart grid<br/>[chartGrid.ts]"]
end

subgraph group_chn["CHUNITHM"]
  node_chn_adapter["Score adapter<br/>[adapter.ts]"]
  node_chn_best["Best images<br/>[best.ts]"]
  node_chn_chart["Chart detail<br/>[chart.ts]"]
  node_chn_scoregrid["Score grid<br/>[scoreGrid.ts]"]
  node_chn_chartgrid["Chart grid<br/>[chartGrid.ts]"]
  node_chn_profile["Profile panel<br/>[profile.ts]"]
  node_chn_rating["Rating calculation"]
end

subgraph group_ong["O.N.G.E.K.I."]
  node_ong_adapter["Score adapter<br/>[adapter.ts]"]
  node_ong_best["Best images<br/>[best.ts]"]
  node_ong_chart["Chart detail<br/>[chart.ts]"]
  node_ong_scoregrid["Score grid<br/>[scoreGrid.ts]"]
  node_ong_chartgrid["Chart grid<br/>[chartGrid.ts]"]
  node_ong_profile["Profile panel<br/>[profile.ts]"]
  node_ong_character["Character panel<br/>[characterInfo.ts]"]
end

subgraph group_render["Shared rendering"]
  node_common_painter["Canvas renderer<br/>[painter.ts]"]
  node_layout["Layout resolver<br/>[layout.ts]"]
  node_theme["Theme manager<br/>[theme.ts]"]
end

node_tracker(("Score trackers"))

node_tracker -.->|"provides scores"| node_mai_adapter
node_tracker -.->|"provides scores"| node_chn_adapter
node_tracker -.->|"provides scores"| node_ong_adapter
node_mai_best -->|"fetches scores"| node_mai_adapter
node_mai_best -->|"uses"| node_mai_scoregrid
node_mai_best -.->|"renders with"| node_common_painter
node_mai_chart -->|"fetches scores"| node_mai_adapter
node_mai_chart -->|"uses"| node_mai_chartgrid
node_mai_chart -.->|"renders with"| node_common_painter
node_chn_best -->|"fetches scores"| node_chn_adapter
node_chn_best -->|"uses"| node_chn_scoregrid
node_chn_chart -->|"fetches scores"| node_chn_adapter
node_chn_chart -->|"uses"| node_chn_chartgrid
node_chn_chart -->|"uses"| node_chn_profile
node_chn_chart -->|"renders with"| node_common_painter
node_ong_best -->|"fetches scores"| node_ong_adapter
node_ong_best -->|"uses"| node_ong_scoregrid
node_ong_best -->|"uses"| node_ong_profile
node_ong_chart -->|"fetches scores"| node_ong_adapter
node_ong_chart -->|"uses"| node_ong_chartgrid
node_ong_chart -->|"uses"| node_ong_character
node_ong_chart -->|"uses"| node_ong_profile
node_ong_chart -->|"renders with"| node_common_painter
node_common_painter -->|"resolves layout"| node_layout
node_common_painter -->|"selects theme"| node_theme

click node_mai_adapter "https://github.com/saltcute/maidraw/blob/main/src/maimai/lib/adapter.ts"
click node_mai_best "https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/best50.ts"
click node_mai_level "https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/level50.ts"
click node_mai_folder "https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/folder.ts"
click node_mai_chart "https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/chart.ts"
click node_mai_scoregrid "https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/modules/scoreGrid.ts"
click node_mai_chartgrid "https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/modules/chartGrid.ts"
click node_chn_adapter "https://github.com/saltcute/maidraw/blob/main/src/chunithm/lib/adapter.ts"
click node_chn_best "https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/best.ts"
click node_chn_chart "https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/chart.ts"
click node_chn_scoregrid "https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/modules/scoreGrid.ts"
click node_chn_chartgrid "https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/modules/chartGrid.ts"
click node_chn_profile "https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/modules/profile.ts"
click node_chn_rating "https://github.com/saltcute/maidraw/blob/main/src/chunithm/lib/calculateParadiseLostRating.ts"
click node_ong_adapter "https://github.com/saltcute/maidraw/blob/main/src/ongeki/lib/adapter.ts"
click node_ong_best "https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/best.ts"
click node_ong_chart "https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/chart.ts"
click node_ong_scoregrid "https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/modules/scoreGrid.ts"
click node_ong_chartgrid "https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/modules/chartGrid.ts"
click node_ong_profile "https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/modules/profile.ts"
click node_ong_character "https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/modules/characterInfo.ts"
click node_common_painter "https://github.com/saltcute/maidraw/blob/main/src/common/painter/painter.ts"
click node_layout "https://github.com/saltcute/maidraw/blob/main/src/common/painter/layout.ts"
click node_theme "https://github.com/saltcute/maidraw/blob/main/src/common/painter/theme.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_mai_adapter,node_mai_best,node_mai_level,node_mai_folder,node_mai_chart,node_mai_scoregrid,node_mai_chartgrid toneBlue
class node_chn_adapter,node_chn_best,node_chn_chart,node_chn_scoregrid,node_chn_chartgrid,node_chn_profile,node_chn_rating toneAmber
class node_ong_adapter,node_ong_best,node_ong_chart,node_ong_scoregrid,node_ong_chartgrid,node_ong_profile,node_ong_character toneMint
class node_common_painter,node_layout,node_theme toneRose
class node_tracker toneIndigo
```

## Components

### maimai DX

- [Score adapter](https://github.com/saltcute/maidraw/blob/main/src/maimai/lib/adapter.ts): `src/maimai/lib/adapter.ts`
- [Best 50](https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/best50.ts): `src/maimai/painter/best50.ts`
- [Level 50](https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/level50.ts): `src/maimai/painter/level50.ts`
- [Folder image](https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/folder.ts): `src/maimai/painter/folder.ts`
- [Chart detail](https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/chart.ts): `src/maimai/painter/chart.ts`
- [Score grid](https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/modules/scoreGrid.ts): `src/maimai/painter/modules/scoreGrid.ts`
- [Chart grid](https://github.com/saltcute/maidraw/blob/main/src/maimai/painter/modules/chartGrid.ts): `src/maimai/painter/modules/chartGrid.ts`

### CHUNITHM

- [Score adapter](https://github.com/saltcute/maidraw/blob/main/src/chunithm/lib/adapter.ts): `src/chunithm/lib/adapter.ts`
- [Best images](https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/best.ts): `src/chunithm/painter/best.ts`
- [Chart detail](https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/chart.ts): `src/chunithm/painter/chart.ts`
- [Score grid](https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/modules/scoreGrid.ts): `src/chunithm/painter/modules/scoreGrid.ts`
- [Chart grid](https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/modules/chartGrid.ts): `src/chunithm/painter/modules/chartGrid.ts`
- [Profile panel](https://github.com/saltcute/maidraw/blob/main/src/chunithm/painter/modules/profile.ts): `src/chunithm/painter/modules/profile.ts`
- [Rating calculation](https://github.com/saltcute/maidraw/blob/main/src/chunithm/lib/calculateParadiseLostRating.ts): `src/chunithm/lib/calculateParadiseLostRating.ts`

### O.N.G.E.K.I.

- [Score adapter](https://github.com/saltcute/maidraw/blob/main/src/ongeki/lib/adapter.ts): `src/ongeki/lib/adapter.ts`
- [Best images](https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/best.ts): `src/ongeki/painter/best.ts`
- [Chart detail](https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/chart.ts): `src/ongeki/painter/chart.ts`
- [Score grid](https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/modules/scoreGrid.ts): `src/ongeki/painter/modules/scoreGrid.ts`
- [Chart grid](https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/modules/chartGrid.ts): `src/ongeki/painter/modules/chartGrid.ts`
- [Profile panel](https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/modules/profile.ts): `src/ongeki/painter/modules/profile.ts`
- [Character panel](https://github.com/saltcute/maidraw/blob/main/src/ongeki/painter/modules/characterInfo.ts): `src/ongeki/painter/modules/characterInfo.ts`

### Shared rendering

- [Canvas renderer](https://github.com/saltcute/maidraw/blob/main/src/common/painter/painter.ts): `src/common/painter/painter.ts`
- [Layout resolver](https://github.com/saltcute/maidraw/blob/main/src/common/painter/layout.ts): `src/common/painter/layout.ts`
- [Theme manager](https://github.com/saltcute/maidraw/blob/main/src/common/painter/theme.ts): `src/common/painter/theme.ts`

### Other components

- **Score trackers**

## Connections

- Score trackers → Score adapter: provides scores (evidence: `README.md`)
- Score trackers → Score adapter: provides scores (evidence: `README.md`)
- Score trackers → Score adapter: provides scores (evidence: `README.md`)
- Best 50 → Score adapter: fetches scores (evidence: `src/maimai/painter/best50.ts`)
- Best 50 → Score grid: uses (evidence: `src/maimai/painter/best50.ts`)
- Best 50 → Canvas renderer: renders with
- Chart detail → Score adapter: fetches scores (evidence: `src/maimai/painter/chart.ts`)
- Chart detail → Chart grid: uses (evidence: `src/maimai/painter/chart.ts`)
- Chart detail → Canvas renderer: renders with
- Best images → Score adapter: fetches scores (evidence: `src/chunithm/painter/best.ts`)
- Best images → Score grid: uses (evidence: `src/chunithm/painter/best.ts`)
- Chart detail → Score adapter: fetches scores (evidence: `src/chunithm/painter/chart.ts`)
- Chart detail → Chart grid: uses (evidence: `src/chunithm/painter/chart.ts`)
- Chart detail → Profile panel: uses (evidence: `src/chunithm/painter/chart.ts`)
- Chart detail → Canvas renderer: renders with (evidence: `src/chunithm/painter/chart.ts`)
- Best images → Score adapter: fetches scores (evidence: `src/ongeki/painter/best.ts`)
- Best images → Score grid: uses (evidence: `src/ongeki/painter/best.ts`)
- Best images → Profile panel: uses (evidence: `src/ongeki/painter/best.ts`)
- Chart detail → Score adapter: fetches scores (evidence: `src/ongeki/painter/chart.ts`)
- Chart detail → Chart grid: uses (evidence: `src/ongeki/painter/chart.ts`)
- Chart detail → Character panel: uses (evidence: `src/ongeki/painter/chart.ts`)
- Chart detail → Profile panel: uses (evidence: `src/ongeki/painter/chart.ts`)
- Chart detail → Canvas renderer: renders with (evidence: `src/ongeki/painter/chart.ts`)
- Canvas renderer → Layout resolver: resolves layout (evidence: `src/common/painter/painter.ts`)
- Canvas renderer → Theme manager: selects theme (evidence: `src/common/painter/painter.ts`)
