# vvin-vv/korea-karaoke-songbook architecture

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

- Interactive diagram: https://gitdiagram.com/vvin-vv/korea-karaoke-songbook
- Repository: https://github.com/vvin-vv/korea-karaoke-songbook

## Overview

This is an installable karaoke-song-number book PWA. A user searches TJ or KY by title, singer, or number, then saves results with a genre and optional favorite status; saved songs can be searched, edited, and browsed offline. The main client script also manages IndexedDB persistence and JSON backup/restore. Search can pass through the same-origin serverless relay to Manana, while the service worker caches the app shell. Some UI and backup details are documented in the README but their implementation excerpts were not sampled.

Main entry points: [`public/app.js`](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js) (Library management), [`public/index.html`](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/index.html) (App interface), [`public/sw.js`](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/sw.js) (Cache worker), [`api/search.js`](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/api/search.js) (Search relay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Songbook client"]
  node_ui["App interface<br/>[index.html]"]
  node_app["App workflow<br/>[app.js]"]
  node_styles["Mobile styling<br/>[styles.css]"]
end

subgraph group_library["Saved library"]
  node_libraryflow["Library management<br/>[app.js]"]
  node_genre["Genre and favorites<br/>[app.js]"]
  node_backup["JSON backup<br/>[app.js]"]
  node_songdb[("Song database")]
end

subgraph group_search["Online search"]
  node_searchflow["Song search<br/>[app.js]"]
  node_results["Result processing<br/>[app.js]"]
  node_relay["Search relay<br/>[search.js]"]
end

subgraph group_offline["Offline app"]
  node_worker["Cache worker<br/>[sw.js]"]
  node_manifest["Install metadata"]
end

node_user(("Songbook user"))
node_manana["Manana API"]

node_user -->|"uses"| node_ui
node_ui -->|"provides interface"| node_app
node_app -->|"starts search"| node_searchflow
node_searchflow -->|"requests results"| node_relay
node_relay -->|"queries"| node_manana
node_searchflow -.->|"can query directly"| node_manana
node_searchflow -.->|"returns results"| node_results
node_results -->|"assigns on save"| node_genre
node_results -->|"saves songs"| node_libraryflow
node_app -->|"manages songs"| node_libraryflow
node_libraryflow -->|"reads and writes"| node_songdb
node_libraryflow -->|"filters and counts"| node_genre
node_libraryflow -->|"backs up and restores"| node_backup
node_worker -->|"caches shell"| node_ui
node_worker -->|"caches script"| node_app
node_manifest -.->|"configures install"| node_ui
node_ui -.->|"uses styles"| node_styles

click node_ui "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/index.html"
click node_app "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js"
click node_styles "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/styles.css"
click node_searchflow "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js"
click node_results "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js"
click node_relay "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/api/search.js"
click node_libraryflow "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js"
click node_genre "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js"
click node_backup "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js"
click node_worker "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/sw.js"
click node_manifest "https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/manifest.webmanifest"

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_ui,node_app,node_styles,node_user toneBlue
class node_libraryflow,node_genre,node_backup,node_songdb toneAmber
class node_searchflow,node_results,node_relay,node_manana toneMint
class node_worker,node_manifest toneRose
```

## Components

### Songbook client

- [App interface](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/index.html): `public/index.html`
- [App workflow](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js): `public/app.js`
- [Mobile styling](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/styles.css): `public/styles.css`

### Saved library

- [Library management](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js): `public/app.js`
- [Genre and favorites](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js): `public/app.js`
- [JSON backup](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js): `public/app.js`
- **Song database**

### Online search

- [Song search](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js): `public/app.js`
- [Result processing](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/app.js): `public/app.js`
- [Search relay](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/api/search.js): `api/search.js`

### Offline app

- [Cache worker](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/sw.js): `public/sw.js`
- [Install metadata](https://github.com/vvin-vv/korea-karaoke-songbook/blob/main/public/manifest.webmanifest): `public/manifest.webmanifest`

### Other components

- **Songbook user**
- **Manana API**

## Connections

- Songbook user → App interface: uses (evidence: `README.md`)
- App interface → App workflow: provides interface (evidence: `README.md`)
- App workflow → Song search: starts search (evidence: `public/app.js`)
- Song search → Search relay: requests results (evidence: `README.md`)
- Search relay → Manana API: queries (evidence: `api/search.js`)
- Song search → Manana API: can query directly
- Song search → Result processing: returns results (evidence: `public/app.js`)
- Result processing → Genre and favorites: assigns on save (evidence: `public/app.js`)
- Result processing → Library management: saves songs (evidence: `public/app.js`)
- App workflow → Library management: manages songs (evidence: `README.md`)
- Library management → Song database: reads and writes (evidence: `public/app.js`)
- Library management → Genre and favorites: filters and counts (evidence: `public/app.js`)
- Library management → JSON backup: backs up and restores (evidence: `README.md`)
- Cache worker → App interface: caches shell (evidence: `public/sw.js`)
- Cache worker → App workflow: caches script (evidence: `public/sw.js`)
- Install metadata → App interface: configures install
- App interface → Mobile styling: uses styles
