# amll-dev/amll-ttml-db architecture

> Architecture diagram of the GitHub repository amll-dev/amll-ttml-db, 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/amll-dev/amll-ttml-db
- Repository: https://github.com/amll-dev/amll-ttml-db

## Overview

AMLL TTML DataBase is both a curated, multi-format lyric corpus and a GitHub-based contribution workflow. Contributors submit TTML through Issues or Pull Requests; the checker processes submissions, validates and normalizes lyric data, and coordinates feedback and repository changes. A separate rebuild tool parses the raw corpus and regenerates platform-specific files and metadata indexes. The README also documents downstream player/editor use. The source excerpts show only parts of the automation and rebuild logic, so unsampled subsystem links are omitted where their wiring is not explicit.

Main entry points: [`scripts/rebuild-folder/src/main.rs`](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/rebuild-folder/src/main.rs) (Corpus Rebuilder), [`scripts/lyric_checker_bot/src/main.rs`](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/main.rs) (Submission Checker), [`ncm-lyrics`](https://github.com/amll-dev/amll-ttml-db/tree/main/ncm-lyrics) (Platform Lyric Files), [`raw-lyrics`](https://github.com/amll-dev/amll-ttml-db/tree/main/raw-lyrics) (Raw Lyrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_contribution["Contribution Workflow"]
  node_checker["Submission Checker<br/>[main.rs]"]
  node_github_api["GitHub API Client<br/>[github_api.rs]"]
  node_git_ops["Git Operations<br/>[git_utils.rs]"]
end

subgraph group_processing["Lyric Processing"]
  node_validator["TTML Validator<br/>[validator.rs]"]
  node_error_snippets["Parse Diagnostics<br/>[snippet_helper.rs]"]
end

subgraph group_corpus["Lyric Corpus"]
  node_raw_lyrics[("Raw Lyrics")]
  node_rebuild["Corpus Rebuilder<br/>[main.rs]"]
  node_platform_lyrics[("Platform Lyric Files")]
  node_am_lyrics[("AM Lyric Files")]
  node_qq_lyrics[("QQ Lyric Files")]
  node_spotify_lyrics[("Spotify Lyric Files")]
  node_metadata[("Indexes and Contributors")]
end

subgraph group_maintenance["Repository Maintenance"]
  node_stale_prs["Stale PR Closure<br/>[index.ts]"]
end

node_contributors(("Contributors"))
node_github["GitHub Issues and PRs"]
node_downstream_apps["AMLL Player and Apps"]

node_contributors -->|"submit lyrics"| node_github
node_github -->|"deliver events"| node_checker
node_checker -->|"requests actions"| node_github_api
node_checker -->|"validates lyrics"| node_validator
node_checker -->|"uses git"| node_git_ops
node_checker -.->|"renders errors"| node_error_snippets
node_raw_lyrics -->|"provides source files"| node_rebuild
node_rebuild -->|"generates files"| node_platform_lyrics
node_rebuild -->|"generates files"| node_am_lyrics
node_rebuild -->|"generates files"| node_qq_lyrics
node_rebuild -->|"generates files"| node_spotify_lyrics
node_rebuild -->|"writes indexes"| node_metadata
node_downstream_apps -->|"search and import"| node_platform_lyrics
node_github -->|"lists open PRs"| node_stale_prs

click node_checker "https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/main.rs"
click node_github_api "https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/github_api.rs"
click node_validator "https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/validator.rs"
click node_error_snippets "https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/snippet_helper.rs"
click node_git_ops "https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/git_utils.rs"
click node_raw_lyrics "https://github.com/amll-dev/amll-ttml-db/tree/main/raw-lyrics"
click node_rebuild "https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/rebuild-folder/src/main.rs"
click node_platform_lyrics "https://github.com/amll-dev/amll-ttml-db/tree/main/ncm-lyrics"
click node_am_lyrics "https://github.com/amll-dev/amll-ttml-db/tree/main/am-lyrics"
click node_qq_lyrics "https://github.com/amll-dev/amll-ttml-db/tree/main/qq-lyrics"
click node_spotify_lyrics "https://github.com/amll-dev/amll-ttml-db/tree/main/spotify-lyrics"
click node_metadata "https://github.com/amll-dev/amll-ttml-db/tree/main/metadata"
click node_stale_prs "https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/close-stale-prs/index.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_checker,node_github_api,node_git_ops toneBlue
class node_validator,node_error_snippets toneAmber
class node_raw_lyrics,node_rebuild,node_platform_lyrics,node_am_lyrics,node_qq_lyrics,node_spotify_lyrics,node_metadata toneMint
class node_stale_prs toneRose
class node_contributors,node_github,node_downstream_apps toneIndigo
```

## Components

### Contribution Workflow

- [Submission Checker](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/main.rs): `scripts/lyric_checker_bot/src/main.rs`
- [GitHub API Client](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/github_api.rs): `scripts/lyric_checker_bot/src/github_api.rs`
- [Git Operations](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/git_utils.rs): `scripts/lyric_checker_bot/src/git_utils.rs`

### Lyric Processing

- [TTML Validator](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/validator.rs): `scripts/lyric_checker_bot/src/validator.rs`
- [Parse Diagnostics](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/lyric_checker_bot/src/snippet_helper.rs): `scripts/lyric_checker_bot/src/snippet_helper.rs`

### Lyric Corpus

- [Raw Lyrics](https://github.com/amll-dev/amll-ttml-db/tree/main/raw-lyrics): `raw-lyrics`
- [Corpus Rebuilder](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/rebuild-folder/src/main.rs): `scripts/rebuild-folder/src/main.rs`
- [Platform Lyric Files](https://github.com/amll-dev/amll-ttml-db/tree/main/ncm-lyrics): `ncm-lyrics`
- [AM Lyric Files](https://github.com/amll-dev/amll-ttml-db/tree/main/am-lyrics): `am-lyrics`
- [QQ Lyric Files](https://github.com/amll-dev/amll-ttml-db/tree/main/qq-lyrics): `qq-lyrics`
- [Spotify Lyric Files](https://github.com/amll-dev/amll-ttml-db/tree/main/spotify-lyrics): `spotify-lyrics`
- [Indexes and Contributors](https://github.com/amll-dev/amll-ttml-db/tree/main/metadata): `metadata`

### Repository Maintenance

- [Stale PR Closure](https://github.com/amll-dev/amll-ttml-db/blob/main/scripts/close-stale-prs/index.ts): `scripts/close-stale-prs/index.ts`

### Other components

- **Contributors**
- **GitHub Issues and PRs**
- **AMLL Player and Apps**

## Connections

- Contributors → GitHub Issues and PRs: submit lyrics (evidence: `README.md`)
- GitHub Issues and PRs → Submission Checker: deliver events (evidence: `scripts/lyric_checker_bot/src/main.rs`)
- Submission Checker → GitHub API Client: requests actions (evidence: `scripts/lyric_checker_bot/src/main.rs`)
- Submission Checker → TTML Validator: validates lyrics (evidence: `scripts/lyric_checker_bot/src/main.rs`)
- Submission Checker → Git Operations: uses git (evidence: `scripts/lyric_checker_bot/src/main.rs`)
- Submission Checker → Parse Diagnostics: renders errors (evidence: `scripts/lyric_checker_bot/src/main.rs`)
- Raw Lyrics → Corpus Rebuilder: provides source files (evidence: `scripts/rebuild-folder/src/main.rs`)
- Corpus Rebuilder → Platform Lyric Files: generates files (evidence: `scripts/rebuild-folder/src/main.rs`)
- Corpus Rebuilder → AM Lyric Files: generates files (evidence: `scripts/rebuild-folder/src/main.rs`)
- Corpus Rebuilder → QQ Lyric Files: generates files (evidence: `scripts/rebuild-folder/src/main.rs`)
- Corpus Rebuilder → Spotify Lyric Files: generates files (evidence: `scripts/rebuild-folder/src/main.rs`)
- Corpus Rebuilder → Indexes and Contributors: writes indexes (evidence: `scripts/rebuild-folder/src/main.rs`)
- AMLL Player and Apps → Platform Lyric Files: search and import (evidence: `README.md`)
- GitHub Issues and PRs → Stale PR Closure: lists open PRs (evidence: `scripts/close-stale-prs/index.ts`)
