# neocheetahlee-coder/nctdiscography-sub-unit_explorer architecture

> Architecture diagram of the GitHub repository neocheetahlee-coder/nctdiscography-sub-unit_explorer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer
- Repository: https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer

## Overview

This is a small NCT song-discovery web app. On startup, the server fetches Apple Music results for several NCT units and storefronts, combines and deduplicates them, and builds a search index. A browser can request songs with optional search, unit filtering, and sorting; the API returns the matching songs and a top-three subset. The server also serves the files in `public/`. The README is empty, and the HTML and CSS contents were not sampled, so their specific UI behavior is unknown.

Main entry points: [`server.js`](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js) (Songs API), [`public/index.html`](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/public/index.html) (Web page), [`public/style.css`](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/public/style.css) (Page styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Catalog acquisition"]
  node_ingest["Catalog loader<br/>[server.js]"]
  node_songs[("Song collection<br/>[server.js]")]
end

subgraph group_query["Song queries"]
  node_index["Search hash table<br/>[server.js]"]
  node_endpoint["Songs API<br/>[server.js]"]
  node_unitfilter["Unit filtering<br/>[server.js]"]
  node_sorting["Custom sorting<br/>[server.js]"]
  node_topthree["Top-three selection<br/>[server.js]"]
end

subgraph group_delivery["Web delivery"]
  node_server["Express server<br/>[server.js]"]
  node_html["Web page<br/>[index.html]"]
  node_css["Page styles<br/>[style.css]"]
end

node_browser(("Browser user"))
node_apple["Apple Music API"]

node_server -->|"starts loading"| node_ingest
node_ingest -->|"requests songs"| node_apple
node_apple -->|"returns results"| node_ingest
node_ingest -->|"stores deduplicated songs"| node_songs
node_ingest -->|"builds index"| node_index
node_browser -->|"requests page or API"| node_server
node_server -->|"serves static file"| node_html
node_server -->|"serves static file"| node_css
node_server -->|"routes songs request"| node_endpoint
node_endpoint -->|"reads songs"| node_songs
node_endpoint -->|"searches keyword"| node_index
node_endpoint -->|"filters by unit"| node_unitfilter
node_endpoint -->|"sorts results"| node_sorting
node_endpoint -->|"selects first three"| node_topthree
node_endpoint -->|"returns JSON"| node_browser

click node_server "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js"
click node_ingest "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js"
click node_songs "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js"
click node_index "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js"
click node_endpoint "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js"
click node_unitfilter "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js"
click node_sorting "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js"
click node_topthree "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js"
click node_html "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/public/index.html"
click node_css "https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/public/style.css"

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_ingest,node_songs,node_browser toneBlue
class node_index,node_endpoint,node_unitfilter,node_sorting,node_topthree toneAmber
class node_server,node_html,node_css,node_apple toneMint
```

## Components

### Catalog acquisition

- [Catalog loader](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js): `server.js`
- [Song collection](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js): `server.js`

### Song queries

- [Search hash table](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js): `server.js`
- [Songs API](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js): `server.js`
- [Unit filtering](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js): `server.js`
- [Custom sorting](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js): `server.js`
- [Top-three selection](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js): `server.js`

### Web delivery

- [Express server](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/server.js): `server.js`
- [Web page](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/public/index.html): `public/index.html`
- [Page styles](https://github.com/neocheetahlee-coder/nctdiscography-sub-unit_explorer/blob/main/public/style.css): `public/style.css`

### Other components

- **Browser user**
- **Apple Music API**

## Connections

- Express server → Catalog loader: starts loading
- Catalog loader → Apple Music API: requests songs
- Apple Music API → Catalog loader: returns results
- Catalog loader → Song collection: stores deduplicated songs
- Catalog loader → Search hash table: builds index
- Browser user → Express server: requests page or API
- Express server → Web page: serves static file
- Express server → Page styles: serves static file
- Express server → Songs API: routes songs request
- Songs API → Song collection: reads songs
- Songs API → Search hash table: searches keyword
- Songs API → Unit filtering: filters by unit
- Songs API → Custom sorting: sorts results
- Songs API → Top-three selection: selects first three
- Songs API → Browser user: returns JSON
