# xxhuberrr/mineradio architecture

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

- Interactive diagram: https://gitdiagram.com/xxhuberrr/mineradio
- Repository: https://github.com/xxhuberrr/mineradio

## Overview

#### Purpose and runtime
Mineradio is a Windows Electron immersive music player combining multi-provider playback, local music, beat-aware visuals, lyrics, 3D playlist shelf, fullscreen desktop, and Wallpaper Engine modes. Electron launches a local service and renderer UI; Windows NSIS packaging is defined under `build/`.
- `desktop/main.js`
- `server.js`
- `build/installer.nsh`

#### Process boundaries and entry points
The Electron main process owns windows, native desktop/fullscreen behavior, system integration, and local-library access. Preload scripts expose controlled renderer-to-main capabilities; the renderer starts from static HTML and a modular browser-side bootstrap.
- `desktop/main.js`
- `desktop/preload.js`
- `desktop/overlay-preload.js`
- `public/index.html`
- `public/js/index-loader.js`

#### Renderer state, scheduling, and scene runtime
The renderer is organized as ordered ES-module domains. Core stores hold application, preferences, playback, FX, and desktop power state; frame scheduling and performance probing govern visual workload. The main loop coordinates scene updates, UI, and playback-driven rendering.
- `public/js/modules/00-state/00-core-stores.js`
- `public/js/modules/00-state/10-frame-scheduler.js`
- `public/js/modules/11-main-loop.js`
- `public/js/modules/01-scene/00-renderer-quality.js`

#### Playback, providers, and entitlement boundary
Playback orchestration selects sources, starts audio, maintains queue/autoplay state, exposes audio-graph controls, and falls back across providers. Provider adapters sit outside the renderer module tree and include Kugou, QQ VIP, Spotify, and Qishui authentication/decryption integrations; account and paid-rights behavior must remain provider-boundary controlled.
- `public/js/modules/05-playback/11-provider-fallback.js`
- `public/js/modules/05-playback/12-playback-switch-core.js`
- `public/js/modules/05-playback/13-playback-start-audio.js`
- `kugou-api.js`
- `qq-vip-api.js`
- `qishui-auth-v6.js`

#### Content, lyrics, beat analysis, and automix
Search, playlists, track details, lyric retrieval/parsing, uploads, and timed lyric offsets feed playback and the visual stage. Beat analysis builds or retrieves tempo/beat maps, including DJ/podcast-specific analysis. Cuefield is a separate planning/evaluation subsystem that derives transition recipes and executes automated mixes through renderer integration.
- `public/js/modules/06-lyrics/00-lyrics-fetch-parse.js`
- `public/js/modules/03-beat/01-audio-beat-analysis.js`
- `public/js/modules/03-beat/04-beat-map-runtime.js`
- `cuefield/recipe-planner.js`
- `public/js/modules/05-playback/18-cuefield-automix-integration.js`

#### Visual presentation and desktop modes
Visual modules render particles, cover-driven scenes, lyrics meshes/shaders, palettes, and FX presets in response to playback and beat state. A 3D shelf provides playlist/queue interaction. Desktop runtimes support full-desktop, wallpaper, native icon layer, and Wallpaper Engine integration; these are native-window lifecycle concerns rather than ordinary web-page modes.
- `public/js/modules/02-visual/14-stage-lyrics-rendering.js`
- `public/js/modules/02-visual/11-lyrics-shaders.js`
- `public/js/modules/04-shelf/01-manager-core.js`
- `desktop/full-desktop-mode-runtime.js`
- `desktop/wallpaper-engine-runtime.js`
- `desktop/desktop-native-icon-layer-runtime.js`

#### Persistence, external services, and distribution
User-local state includes preferences, custom visual archives, covers, lyrics, local-library metadata, login state, and beat caches. The app uses GitHub Releases only for version detection and opens external download routes rather than self-updating binaries. Packaging targets Windows through electron-builder and NSIS.
- `desktop/local-music-library.js`
- `public/js/modules/07-fx/08-cache-storage-settings.js`
- `public/default-user-fx-archive.json`
- `electron-builder.internal-beta.json`
- `build/after-pack.js`

Main entry points: [`public/js/modules/05-playback/12-playback-switch-core.js`](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/05-playback/12-playback-switch-core.js) (Playback orchestration), [`desktop/main.js`](https://github.com/xxhuberrr/mineradio/blob/main/desktop/main.js) (Electron main), [`public/js/modules/11-main-loop.js`](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/11-main-loop.js) (Main loop), [`public/js/modules/02-visual/14-stage-lyrics-rendering.js`](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/02-visual/14-stage-lyrics-rendering.js) (Visual stage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Electron desktop"]
  node_electron_main["Electron main<br/>main process<br/>[main.js]"]
  node_preload["Renderer preload<br/>IPC bridge<br/>[preload.js]"]
  node_overlay_preload["Overlay preload<br/>IPC bridge<br/>[overlay-preload.js]"]
  node_desktop_modes["Desktop mode runtimes<br/>native window modes"]
  node_wallpaper_engine["Wallpaper Engine runtime<br/>desktop integration"]
end

subgraph group_renderer["Renderer runtime"]
  node_renderer_entry["Renderer bootstrap<br/>HTML module entry<br/>[index.html]"]
  node_module_loader["Module loader<br/>browser bootstrap<br/>[index-loader.js]"]
  node_state_scheduler["State &amp; frame scheduling<br/>renderer core"]
  node_main_loop["Main loop<br/>renderer coordinator<br/>[11-main-loop.js]"]
  node_playback["Playback orchestration<br/>playback core"]
  node_lyrics["Lyrics pipeline<br/>content runtime"]
  node_beat_runtime["Beat analysis &amp; maps<br/>audio analysis"]
  node_automix["Cuefield automix<br/>mix integration"]
  node_visual_stage["Visual stage<br/>scene rendering"]
  node_playlist_shelf["3D playlist shelf<br/>scene interaction<br/>[01-manager-core.js]"]
end

subgraph group_services["Local services &amp; providers"]
  node_cuefield["Cuefield planner<br/>transition planner<br/>[recipe-planner.js]"]
  node_local_service["Local service<br/>Node service<br/>[server.js]"]
  node_provider_adapters{{"Provider adapters<br/>provider boundary<br/>[kugou-api.js]"}}
end

subgraph group_data["User data &amp; distribution"]
  node_local_library[("Local music library<br/>local library access")]
  node_cache_storage[("User cache storage<br/>persistence")]
  node_windows_packaging["Windows packaging<br/>electron-builder / NSIS"]
end

node_electron_main -->|"loads"| node_preload
node_electron_main -->|"loads overlay bridge"| node_overlay_preload
node_electron_main -->|"owns lifecycle"| node_desktop_modes
node_desktop_modes -->|"integrates"| node_wallpaper_engine
node_electron_main -->|"accesses"| node_local_library
node_renderer_entry -->|"starts"| node_module_loader
node_module_loader -->|"initializes"| node_state_scheduler
node_module_loader -->|"starts"| node_main_loop
node_preload -->|"exposes native capabilities"| node_main_loop
node_main_loop -->|"coordinates"| node_playback
node_main_loop -->|"updates"| node_visual_stage
node_state_scheduler -->|"budgets frames"| node_visual_stage
node_playback -->|"requests sources / fallback"| node_provider_adapters
node_playback -->|"requests timed lyrics"| node_lyrics
node_playback -->|"supplies audio"| node_beat_runtime
node_beat_runtime -->|"drives beat-aware visuals"| node_visual_stage
node_lyrics -->|"renders lyric data"| node_visual_stage
node_playlist_shelf -->|"controls queue"| node_playback
node_cuefield -->|"provides recipes"| node_automix
node_automix -->|"executes transitions"| node_playback
node_playback -->|"persists state and caches"| node_cache_storage
node_beat_runtime -->|"caches beat maps"| node_cache_storage
node_electron_main -.->|"packaged as"| node_windows_packaging

click node_electron_main "https://github.com/xxhuberrr/mineradio/blob/main/desktop/main.js"
click node_preload "https://github.com/xxhuberrr/mineradio/blob/main/desktop/preload.js"
click node_overlay_preload "https://github.com/xxhuberrr/mineradio/blob/main/desktop/overlay-preload.js"
click node_desktop_modes "https://github.com/xxhuberrr/mineradio/blob/main/desktop/full-desktop-mode-runtime.js"
click node_wallpaper_engine "https://github.com/xxhuberrr/mineradio/blob/main/desktop/wallpaper-engine-runtime.js"
click node_renderer_entry "https://github.com/xxhuberrr/mineradio/blob/main/public/index.html"
click node_module_loader "https://github.com/xxhuberrr/mineradio/blob/main/public/js/index-loader.js"
click node_state_scheduler "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/00-state/10-frame-scheduler.js"
click node_main_loop "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/11-main-loop.js"
click node_playback "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/05-playback/12-playback-switch-core.js"
click node_lyrics "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/06-lyrics/00-lyrics-fetch-parse.js"
click node_beat_runtime "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/03-beat/01-audio-beat-analysis.js"
click node_automix "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/05-playback/18-cuefield-automix-integration.js"
click node_cuefield "https://github.com/xxhuberrr/mineradio/blob/main/cuefield/recipe-planner.js"
click node_visual_stage "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/02-visual/14-stage-lyrics-rendering.js"
click node_playlist_shelf "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/04-shelf/01-manager-core.js"
click node_local_service "https://github.com/xxhuberrr/mineradio/blob/main/server.js"
click node_provider_adapters "https://github.com/xxhuberrr/mineradio/blob/main/kugou-api.js"
click node_local_library "https://github.com/xxhuberrr/mineradio/blob/main/desktop/local-music-library.js"
click node_cache_storage "https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/07-fx/08-cache-storage-settings.js"
click node_windows_packaging "https://github.com/xxhuberrr/mineradio/blob/main/electron-builder.internal-beta.json"

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_electron_main,node_preload,node_overlay_preload,node_desktop_modes,node_wallpaper_engine toneBlue
class node_renderer_entry,node_module_loader,node_state_scheduler,node_main_loop,node_playback,node_lyrics,node_beat_runtime,node_automix,node_visual_stage,node_playlist_shelf toneAmber
class node_cuefield,node_local_service,node_provider_adapters toneMint
class node_local_library,node_cache_storage,node_windows_packaging toneRose
```

## Components

### Electron desktop

Native process and desktop-mode boundary.

- [Electron main](https://github.com/xxhuberrr/mineradio/blob/main/desktop/main.js): main process · Owns windows, native integration, and local-library access. · `desktop/main.js`
- [Renderer preload](https://github.com/xxhuberrr/mineradio/blob/main/desktop/preload.js): IPC bridge · Exposes controlled main-process capabilities. · `desktop/preload.js`
- [Overlay preload](https://github.com/xxhuberrr/mineradio/blob/main/desktop/overlay-preload.js): IPC bridge · `desktop/overlay-preload.js`
- [Desktop mode runtimes](https://github.com/xxhuberrr/mineradio/blob/main/desktop/full-desktop-mode-runtime.js): native window modes · Runs full-desktop, wallpaper, and native icon-layer modes. · `desktop/full-desktop-mode-runtime.js`
- [Wallpaper Engine runtime](https://github.com/xxhuberrr/mineradio/blob/main/desktop/wallpaper-engine-runtime.js): desktop integration · `desktop/wallpaper-engine-runtime.js`

### Renderer runtime

Browser-side playback and visual runtime.

- [Renderer bootstrap](https://github.com/xxhuberrr/mineradio/blob/main/public/index.html): HTML module entry · `public/index.html`
- [Module loader](https://github.com/xxhuberrr/mineradio/blob/main/public/js/index-loader.js): browser bootstrap · Loads ordered renderer module domains. · `public/js/index-loader.js`
- [State & frame scheduling](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/00-state/10-frame-scheduler.js): renderer core · Maintains stores and controls visual workload. · `public/js/modules/00-state/10-frame-scheduler.js`
- [Main loop](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/11-main-loop.js): renderer coordinator · Coordinates scene, UI, and playback-driven rendering. · `public/js/modules/11-main-loop.js`
- [Playback orchestration](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/05-playback/12-playback-switch-core.js): playback core · Selects sources, controls audio, queue, autoplay, and fallback. · `public/js/modules/05-playback/12-playback-switch-core.js`
- [Lyrics pipeline](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/06-lyrics/00-lyrics-fetch-parse.js): content runtime · Fetches, parses, and times lyric content. · `public/js/modules/06-lyrics/00-lyrics-fetch-parse.js`
- [Beat analysis & maps](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/03-beat/01-audio-beat-analysis.js): audio analysis · Builds and supplies tempo and beat maps. · `public/js/modules/03-beat/01-audio-beat-analysis.js`
- [Cuefield automix](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/05-playback/18-cuefield-automix-integration.js): mix integration · Executes planned automated transitions. · `public/js/modules/05-playback/18-cuefield-automix-integration.js`
- [Visual stage](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/02-visual/14-stage-lyrics-rendering.js): scene rendering · Renders lyrics, cover scenes, particles, palettes, and FX. · `public/js/modules/02-visual/14-stage-lyrics-rendering.js`
- [3D playlist shelf](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/04-shelf/01-manager-core.js): scene interaction · Provides playlist and queue interaction. · `public/js/modules/04-shelf/01-manager-core.js`

### Local services & providers

Server and provider integration boundary.

- [Cuefield planner](https://github.com/xxhuberrr/mineradio/blob/main/cuefield/recipe-planner.js): transition planner · Derives and evaluates transition recipes. · `cuefield/recipe-planner.js`
- [Local service](https://github.com/xxhuberrr/mineradio/blob/main/server.js): Node service · `server.js`
- [Provider adapters](https://github.com/xxhuberrr/mineradio/blob/main/kugou-api.js): provider boundary · Keeps account, decryption, and paid-rights behavior provider-bound. · `kugou-api.js`

### User data & distribution

Local persistence and Windows packaging.

- [Local music library](https://github.com/xxhuberrr/mineradio/blob/main/desktop/local-music-library.js): local library access · Indexes local music metadata for the desktop app. · `desktop/local-music-library.js`
- [User cache storage](https://github.com/xxhuberrr/mineradio/blob/main/public/js/modules/07-fx/08-cache-storage-settings.js): persistence · Stores preferences, FX archives, covers, lyrics, login state, and beat caches. · `public/js/modules/07-fx/08-cache-storage-settings.js`
- [Windows packaging](https://github.com/xxhuberrr/mineradio/blob/main/electron-builder.internal-beta.json): electron-builder / NSIS · Builds and installs the Windows distribution. · `electron-builder.internal-beta.json`

## Connections

- Electron main → Renderer preload: loads
- Electron main → Overlay preload: loads overlay bridge
- Electron main → Desktop mode runtimes: owns lifecycle
- Desktop mode runtimes → Wallpaper Engine runtime: integrates
- Electron main → Local music library: accesses
- Renderer bootstrap → Module loader: starts
- Module loader → State & frame scheduling: initializes
- Module loader → Main loop: starts
- Renderer preload → Main loop: exposes native capabilities
- Main loop → Playback orchestration: coordinates
- Main loop → Visual stage: updates
- State & frame scheduling → Visual stage: budgets frames
- Playback orchestration → Provider adapters: requests sources / fallback
- Playback orchestration → Lyrics pipeline: requests timed lyrics
- Playback orchestration → Beat analysis & maps: supplies audio
- Beat analysis & maps → Visual stage: drives beat-aware visuals
- Lyrics pipeline → Visual stage: renders lyric data
- 3D playlist shelf → Playback orchestration: controls queue
- Cuefield planner → Cuefield automix: provides recipes
- Cuefield automix → Playback orchestration: executes transitions
- Playback orchestration → User cache storage: persists state and caches
- Beat analysis & maps → User cache storage: caches beat maps
- Electron main → Windows packaging: packaged as
