# goldhap/nepali-radio-player architecture

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

- Interactive diagram: https://gitdiagram.com/goldhap/nepali-radio-player
- Repository: https://github.com/goldhap/nepali-radio-player

## Overview

This is a lightweight Nepali radio web player: listeners open the page, browse or filter a catalog of stations, and select one to stream. The main runtime is a single JavaScript file that also implements playback controls, favorites and history, equalizer, sleep timer, sharing, and other listening features. A service worker caches the app shell and provides offline navigation fallback while deliberately bypassing audio. Several capabilities are documented in the script header but their implementation details are outside the excerpts, so their internal links are not inferred.

Main entry points: [`script.js`](https://github.com/goldhap/nepali-radio-player/blob/main/script.js) (Player controller), [`sw.js`](https://github.com/goldhap/nepali-radio-player/blob/main/sw.js) (Service worker), [`index.html`](https://github.com/goldhap/nepali-radio-player/blob/main/index.html) (Player page), [`radios.json`](https://github.com/goldhap/nepali-radio-player/blob/main/radios.json) (Station catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_page["Player page<br/>[index.html]"]
  node_styles["Player styling<br/>[style.css]"]
  node_controller["Player controller<br/>[script.js]"]
end

subgraph group_catalog["Station discovery"]
  node_catalog_data["Station catalog<br/>[radios.json]"]
  node_station_browsing["Browse and filter<br/>[script.js]"]
  node_favorites_history["Favorites and history<br/>[script.js]"]
end

subgraph group_listening["Listening features"]
  node_stream_playback["Stream playback<br/>[script.js]"]
  node_equalizer["Audio equalizer<br/>[script.js]"]
  node_listening_controls["Listening controls<br/>[script.js]"]
end

subgraph group_offline["Offline support"]
  node_service_worker["Service worker<br/>[sw.js]"]
  node_browser_cache[("Browser cache")]
  node_offline_page["Offline page<br/>[offline.html]"]
end

node_listener(("Listener"))
node_stream_source["Radio stream"]

node_listener -->|"opens"| node_page
node_controller -->|"fetches"| node_catalog_data
node_controller -->|"proxies stream"| node_stream_source
node_service_worker -->|"caches app files"| node_browser_cache
node_service_worker -->|"navigation fallback"| node_offline_page

click node_page "https://github.com/goldhap/nepali-radio-player/blob/main/index.html"
click node_styles "https://github.com/goldhap/nepali-radio-player/blob/main/style.css"
click node_controller "https://github.com/goldhap/nepali-radio-player/blob/main/script.js"
click node_catalog_data "https://github.com/goldhap/nepali-radio-player/blob/main/radios.json"
click node_station_browsing "https://github.com/goldhap/nepali-radio-player/blob/main/script.js"
click node_favorites_history "https://github.com/goldhap/nepali-radio-player/blob/main/script.js"
click node_stream_playback "https://github.com/goldhap/nepali-radio-player/blob/main/script.js"
click node_equalizer "https://github.com/goldhap/nepali-radio-player/blob/main/script.js"
click node_listening_controls "https://github.com/goldhap/nepali-radio-player/blob/main/script.js"
click node_service_worker "https://github.com/goldhap/nepali-radio-player/blob/main/sw.js"
click node_offline_page "https://github.com/goldhap/nepali-radio-player/blob/main/offline.html"

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_page,node_styles,node_controller toneBlue
class node_catalog_data,node_station_browsing,node_favorites_history toneAmber
class node_stream_playback,node_equalizer,node_listening_controls toneMint
class node_service_worker,node_browser_cache,node_offline_page toneRose
class node_listener,node_stream_source toneIndigo
```

## Components

### Web interface

- [Player page](https://github.com/goldhap/nepali-radio-player/blob/main/index.html): `index.html`
- [Player styling](https://github.com/goldhap/nepali-radio-player/blob/main/style.css): `style.css`
- [Player controller](https://github.com/goldhap/nepali-radio-player/blob/main/script.js): `script.js`

### Station discovery

- [Station catalog](https://github.com/goldhap/nepali-radio-player/blob/main/radios.json): `radios.json`
- [Browse and filter](https://github.com/goldhap/nepali-radio-player/blob/main/script.js): `script.js`
- [Favorites and history](https://github.com/goldhap/nepali-radio-player/blob/main/script.js): `script.js`

### Listening features

- [Stream playback](https://github.com/goldhap/nepali-radio-player/blob/main/script.js): `script.js`
- [Audio equalizer](https://github.com/goldhap/nepali-radio-player/blob/main/script.js): `script.js`
- [Listening controls](https://github.com/goldhap/nepali-radio-player/blob/main/script.js): `script.js`

### Offline support

- [Service worker](https://github.com/goldhap/nepali-radio-player/blob/main/sw.js): `sw.js`
- **Browser cache**
- [Offline page](https://github.com/goldhap/nepali-radio-player/blob/main/offline.html): `offline.html`

### Other components

- **Listener**
- **Radio stream**

## Connections

- Listener → Player page: opens (evidence: `README.md`)
- Player controller → Station catalog: fetches (evidence: `script.js`)
- Player controller → Radio stream: proxies stream (evidence: `script.js`)
- Service worker → Browser cache: caches app files (evidence: `sw.js`)
- Service worker → Offline page: navigation fallback (evidence: `sw.js`)
