# suganth-s-39/nocturne architecture

> Architecture diagram of the GitHub repository suganth-s-39/nocturne, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/suganth-s-39/nocturne
- Repository: https://github.com/suganth-s-39/nocturne

## Overview

Nocturne is a Windows desktop lyrics visualizer. Its main workflow follows Spotify or YouTube Music playback, retrieves and caches lyrics, estimates or uses word timings, then renders the active words in an animated style. The README documents auto-sync, album-art colors, custom backgrounds, the gallery, and floating-window and tray controls, so these appear as distinct branches. The sampled files show frontend stores, timing, rendering, and native bridges; some subsystem connections rely on README descriptions rather than inspected implementation.

Main entry points: [`src/engine/director.ts`](https://github.com/suganth-s-39/nocturne/blob/main/src/engine/director.ts) (Animation director), [`src/media/mediaStore.ts`](https://github.com/suganth-s-39/nocturne/blob/main/src/media/mediaStore.ts) (Media state), [`src/sync/autoSync.ts`](https://github.com/suganth-s-39/nocturne/blob/main/src/sync/autoSync.ts) (Automatic alignment), [`src-tauri/src/lyrics/service.rs`](https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/lyrics/service.rs) (Lyrics service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_playback["Playback and sync"]
  node_media_native["Media tracking<br/>[service.rs]"]
  node_media_clock["Playback clock<br/>[clock.rs]"]
  node_media_store["Media state<br/>[mediaStore.ts]"]
  node_audio_capture["Audio capture and features"]
  node_auto_sync["Automatic alignment<br/>[autoSync.ts]"]
  node_align["Sync alignment<br/>[align.ts]"]
end

subgraph group_lyrics["Lyrics pipeline"]
  node_lyrics_native["Lyrics service<br/>[service.rs]"]
  node_lrclib["LRCLIB"]
  node_lyrics_cache[("Lyrics cache and overrides")]
  node_lyrics_store["Lyrics state<br/>[lyricsStore.ts]"]
  node_word_timing["Word timing<br/>[timing.ts]"]
end

subgraph group_visuals["Visualization"]
  node_art_theme["Album art and palettes"]
  node_backgrounds["Background library<br/>[library.ts]"]
  node_director["Animation director<br/>[director.ts]"]
  node_scene_styles["Ten lyric styles"]
  node_stage["Lyrics stage<br/>[Stage.tsx]"]
  node_gallery["Style gallery<br/>[Gallery.tsx]"]
  node_custom_backgrounds["User backgrounds<br/>[backgrounds.rs]"]
end

subgraph group_desktop["Desktop experience"]
  node_settings[("Settings<br/>[settingsStore.ts]")]
  node_shell_bridge["Native shell bridge<br/>[bridge.ts]"]
  node_native_shell["Windows shell"]
  node_app_ui["Controls and panels<br/>[App.tsx]"]
  node_overlay["Floating lyrics window<br/>[OverlayApp.tsx]"]
  node_tray_hotkeys["Tray and hotkeys"]
end

node_players(("Spotify / YouTube Music"))

node_players -->|"reports playback"| node_media_native
node_media_native -->|"updates position"| node_media_clock
node_media_native -->|"sends state"| node_media_store
node_media_clock -->|"provides clock"| node_media_store
node_media_store -->|"triggers lookup"| node_lyrics_native
node_lyrics_native -->|"searches lyrics"| node_lrclib
node_lyrics_native -->|"reads and writes"| node_lyrics_cache
node_lyrics_native -->|"publishes lyrics"| node_lyrics_store
node_lyrics_store -->|"builds timed document"| node_word_timing
node_media_store -->|"supplies playback"| node_auto_sync
node_auto_sync -->|"listens for music"| node_audio_capture
node_auto_sync -->|"aligns lyrics"| node_align
node_auto_sync -->|"sets offset"| node_lyrics_store
node_lyrics_store -->|"supplies timed lyrics"| node_director
node_media_store -->|"supplies playback"| node_director
node_director -->|"creates and feeds scenes"| node_scene_styles
node_director -->|"renders backgrounds"| node_backgrounds
node_scene_styles -->|"renders lyrics"| node_stage
node_stage -->|"drives animation"| node_director
node_gallery -->|"selects style"| node_stage
node_art_theme -->|"provides album colors"| node_director
node_settings -->|"syncs preferences"| node_shell_bridge
node_shell_bridge -->|"invokes commands"| node_native_shell
node_native_shell -->|"handles shell actions"| node_tray_hotkeys
node_app_ui -->|"hosts stage"| node_stage
node_app_ui -->|"hosts gallery"| node_gallery
node_app_ui -->|"opens floating view"| node_overlay
node_custom_backgrounds -->|"offers backgrounds"| node_director

click node_media_native "https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/media/service.rs"
click node_media_clock "https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/media/clock.rs"
click node_media_store "https://github.com/suganth-s-39/nocturne/blob/main/src/media/mediaStore.ts"
click node_audio_capture "https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/audio"
click node_auto_sync "https://github.com/suganth-s-39/nocturne/blob/main/src/sync/autoSync.ts"
click node_align "https://github.com/suganth-s-39/nocturne/blob/main/src/sync/align.ts"
click node_lyrics_native "https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/lyrics/service.rs"
click node_lyrics_cache "https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/lyrics"
click node_lyrics_store "https://github.com/suganth-s-39/nocturne/blob/main/src/lyrics/lyricsStore.ts"
click node_word_timing "https://github.com/suganth-s-39/nocturne/blob/main/src/lyrics/timing.ts"
click node_settings "https://github.com/suganth-s-39/nocturne/blob/main/src/settings/settingsStore.ts"
click node_shell_bridge "https://github.com/suganth-s-39/nocturne/blob/main/src/shell/bridge.ts"
click node_native_shell "https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/shell"
click node_art_theme "https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/art"
click node_backgrounds "https://github.com/suganth-s-39/nocturne/blob/main/src/backgrounds/library.ts"
click node_director "https://github.com/suganth-s-39/nocturne/blob/main/src/engine/director.ts"
click node_scene_styles "https://github.com/suganth-s-39/nocturne/tree/main/src/scenes"
click node_stage "https://github.com/suganth-s-39/nocturne/blob/main/src/ui/Stage.tsx"
click node_gallery "https://github.com/suganth-s-39/nocturne/blob/main/src/ui/gallery/Gallery.tsx"
click node_app_ui "https://github.com/suganth-s-39/nocturne/blob/main/src/App.tsx"
click node_overlay "https://github.com/suganth-s-39/nocturne/blob/main/src/overlay/OverlayApp.tsx"
click node_tray_hotkeys "https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/shell"
click node_custom_backgrounds "https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/backgrounds.rs"

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_media_native,node_media_clock,node_media_store,node_audio_capture,node_auto_sync,node_align toneBlue
class node_lyrics_native,node_lrclib,node_lyrics_cache,node_lyrics_store,node_word_timing toneAmber
class node_art_theme,node_backgrounds,node_director,node_scene_styles,node_stage,node_gallery,node_custom_backgrounds toneMint
class node_settings,node_shell_bridge,node_native_shell,node_app_ui,node_overlay,node_tray_hotkeys toneRose
class node_players toneIndigo
```

## Components

### Playback and sync

- [Media tracking](https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/media/service.rs): `src-tauri/src/media/service.rs`
- [Playback clock](https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/media/clock.rs): `src-tauri/src/media/clock.rs`
- [Media state](https://github.com/suganth-s-39/nocturne/blob/main/src/media/mediaStore.ts): `src/media/mediaStore.ts`
- [Audio capture and features](https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/audio): `src-tauri/src/audio`
- [Automatic alignment](https://github.com/suganth-s-39/nocturne/blob/main/src/sync/autoSync.ts): `src/sync/autoSync.ts`
- [Sync alignment](https://github.com/suganth-s-39/nocturne/blob/main/src/sync/align.ts): `src/sync/align.ts`

### Lyrics pipeline

- [Lyrics service](https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/lyrics/service.rs): `src-tauri/src/lyrics/service.rs`
- **LRCLIB**
- [Lyrics cache and overrides](https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/lyrics): `src-tauri/src/lyrics`
- [Lyrics state](https://github.com/suganth-s-39/nocturne/blob/main/src/lyrics/lyricsStore.ts): `src/lyrics/lyricsStore.ts`
- [Word timing](https://github.com/suganth-s-39/nocturne/blob/main/src/lyrics/timing.ts): `src/lyrics/timing.ts`

### Visualization

- [Album art and palettes](https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/art): `src-tauri/src/art`
- [Background library](https://github.com/suganth-s-39/nocturne/blob/main/src/backgrounds/library.ts): `src/backgrounds/library.ts`
- [Animation director](https://github.com/suganth-s-39/nocturne/blob/main/src/engine/director.ts): `src/engine/director.ts`
- [Ten lyric styles](https://github.com/suganth-s-39/nocturne/tree/main/src/scenes): `src/scenes`
- [Lyrics stage](https://github.com/suganth-s-39/nocturne/blob/main/src/ui/Stage.tsx): `src/ui/Stage.tsx`
- [Style gallery](https://github.com/suganth-s-39/nocturne/blob/main/src/ui/gallery/Gallery.tsx): `src/ui/gallery/Gallery.tsx`
- [User backgrounds](https://github.com/suganth-s-39/nocturne/blob/main/src-tauri/src/backgrounds.rs): `src-tauri/src/backgrounds.rs`

### Desktop experience

- [Settings](https://github.com/suganth-s-39/nocturne/blob/main/src/settings/settingsStore.ts): `src/settings/settingsStore.ts`
- [Native shell bridge](https://github.com/suganth-s-39/nocturne/blob/main/src/shell/bridge.ts): `src/shell/bridge.ts`
- [Windows shell](https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/shell): `src-tauri/src/shell`
- [Controls and panels](https://github.com/suganth-s-39/nocturne/blob/main/src/App.tsx): `src/App.tsx`
- [Floating lyrics window](https://github.com/suganth-s-39/nocturne/blob/main/src/overlay/OverlayApp.tsx): `src/overlay/OverlayApp.tsx`
- [Tray and hotkeys](https://github.com/suganth-s-39/nocturne/tree/main/src-tauri/src/shell): `src-tauri/src/shell`

### Other components

- **Spotify / YouTube Music**

## Connections

- Spotify / YouTube Music → Media tracking: reports playback (evidence: `README.md`)
- Media tracking → Playback clock: updates position (evidence: `src-tauri/src/media/service.rs`)
- Media tracking → Media state: sends state (evidence: `README.md`)
- Playback clock → Media state: provides clock (evidence: `README.md`)
- Media state → Lyrics service: triggers lookup (evidence: `src-tauri/src/lyrics/service.rs`)
- Lyrics service → LRCLIB: searches lyrics (evidence: `src-tauri/src/lyrics/service.rs`)
- Lyrics service → Lyrics cache and overrides: reads and writes (evidence: `src-tauri/src/lyrics/service.rs`)
- Lyrics service → Lyrics state: publishes lyrics (evidence: `README.md`)
- Lyrics state → Word timing: builds timed document (evidence: `src/lyrics/lyricsStore.ts`)
- Media state → Automatic alignment: supplies playback (evidence: `src/sync/autoSync.ts`)
- Automatic alignment → Audio capture and features: listens for music (evidence: `README.md`)
- Automatic alignment → Sync alignment: aligns lyrics (evidence: `src/sync/autoSync.ts`)
- Automatic alignment → Lyrics state: sets offset (evidence: `README.md`)
- Lyrics state → Animation director: supplies timed lyrics (evidence: `src/engine/director.ts`)
- Media state → Animation director: supplies playback (evidence: `src/engine/director.ts`)
- Animation director → Ten lyric styles: creates and feeds scenes (evidence: `src/engine/director.ts`)
- Animation director → Background library: renders backgrounds (evidence: `README.md`)
- Ten lyric styles → Lyrics stage: renders lyrics (evidence: `README.md`)
- Lyrics stage → Animation director: drives animation (evidence: `README.md`)
- Style gallery → Lyrics stage: selects style (evidence: `README.md`)
- Album art and palettes → Animation director: provides album colors (evidence: `README.md`)
- Settings → Native shell bridge: syncs preferences (evidence: `src/shell/bridge.ts`)
- Native shell bridge → Windows shell: invokes commands (evidence: `src/shell/bridge.ts`)
- Windows shell → Tray and hotkeys: handles shell actions (evidence: `README.md`)
- Controls and panels → Lyrics stage: hosts stage (evidence: `src/App.tsx`)
- Controls and panels → Style gallery: hosts gallery (evidence: `src/App.tsx`)
- Controls and panels → Floating lyrics window: opens floating view (evidence: `README.md`)
- User backgrounds → Animation director: offers backgrounds (evidence: `README.md`)
