# instazdll/waveflow-server architecture

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

- Interactive diagram: https://gitdiagram.com/instazdll/waveflow-server
- Repository: https://github.com/instazdll/waveflow-server

## Overview

WaveFlow is a self-hosted music server: it scans local music into a tenant-aware SQLite catalogue, then serves playback and library features through the native API, OpenSubsonic, and an embedded web player. The graph keeps scanning, domain services, API façades, and browser client distinct, while showing major documented capabilities such as uploads, sync, scrobbling, and metadata enrichment. Some feature links are documented by the README rather than sampled implementation; those edges cite it. Unsampled details are not inferred.

Main entry points: [`src/api/mod.rs`](https://github.com/instazdll/waveflow-server/blob/main/src/api/mod.rs) (Native API), [`webapp/src/main.tsx`](https://github.com/instazdll/waveflow-server/blob/main/webapp/src/main.tsx) (Web application routes), [`src/services/mod.rs`](https://github.com/instazdll/waveflow-server/blob/main/src/services/mod.rs) (Domain services), [`src/database.rs`](https://github.com/instazdll/waveflow-server/blob/main/src/database.rs) (SQLite database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server Runtime"]
  node_sqlite[("SQLite database<br/>[database.rs]")]
  node_server_boot["Server startup<br/>[main.rs]"]
  node_configuration["Configuration<br/>[config.rs]"]
  node_auth_security["Authentication and security<br/>[authentication.rs]"]
end

subgraph group_catalog["Music Catalogue"]
  node_scanner["Library scanner<br/>[scanner.rs]"]
  node_catalogue[("Catalogue repository<br/>[catalog.rs]")]
  node_tags_lyrics["Tags and lyrics<br/>[tags.rs]"]
  node_metadata["Metadata enrichment<br/>[enrichment.rs]"]
end

subgraph group_domain["Domain Services"]
  node_domain_services["Domain services<br/>[mod.rs]"]
  node_media_playback["Playback and transcoding<br/>[media.rs]"]
  node_scrobbling["Scrobble queue<br/>[scrobbling.rs]"]
  node_scrobble_adapters["Scrobble adapters<br/>[mod.rs]"]
end

subgraph group_surfaces["Client Interfaces"]
  node_native_api["Native API<br/>[mod.rs]"]
  node_subsonic_api["OpenSubsonic API<br/>[mod.rs]"]
  node_sync["User data sync<br/>[sync.rs]"]
  node_oauth["OAuth and PKCE<br/>[oauth.rs]"]
end

subgraph group_web["Web Player"]
  node_web_routes["Web application routes<br/>[main.tsx]"]
  node_web_api["Web API client<br/>[client.ts]"]
  node_web_player["Music player<br/>[player.tsx]"]
  node_i18n["Localization<br/>[i18n.tsx]"]
  node_library_scope["Library selection<br/>[library-scope.tsx]"]
end

node_music_owner(("Music owner"))
node_subsonic_client(("Subsonic client"))
node_desktop_client(("Desktop client"))
node_browser_user(("Browser user"))
node_music_files["Music files"]
node_ffmpeg["FFmpeg"]
node_metadata_providers["Metadata providers"]
node_scrobble_destinations["Scrobble destinations"]

node_music_owner -->|"provides library"| node_music_files
node_server_boot -->|"loads settings"| node_configuration
node_server_boot -->|"serves with"| node_sqlite
node_scanner -->|"scans files"| node_music_files
node_scanner -->|"indexes tracks"| node_catalogue
node_scanner -->|"reads tags"| node_tags_lyrics
node_catalogue -->|"stores catalogue"| node_sqlite
node_metadata -.->|"queries providers"| node_metadata_providers
node_domain_services -->|"serves catalogue"| node_catalogue
node_domain_services -->|"reads and writes"| node_sqlite
node_media_playback -.->|"transcodes with"| node_ffmpeg
node_media_playback -.->|"reads track data"| node_sqlite
node_scrobbling -.->|"dispatches jobs"| node_scrobble_adapters
node_scrobble_adapters -.->|"sends scrobbles"| node_scrobble_destinations
node_native_api -->|"authenticates requests"| node_auth_security
node_native_api -->|"routes operations"| node_domain_services
node_subsonic_api -->|"uses shared services"| node_domain_services
node_subsonic_api -->|"serves streams"| node_media_playback
node_native_api -.->|"supports sync"| node_sync
node_native_api -->|"handles authorization"| node_oauth
node_desktop_client -->|"calls API"| node_native_api
node_subsonic_client -->|"sends requests"| node_subsonic_api
node_browser_user -->|"uses player"| node_web_routes
node_web_routes -->|"calls resources"| node_web_api
node_web_api -->|"calls endpoints"| node_native_api
node_web_routes -->|"hosts player"| node_web_player
node_web_routes -->|"provides translations"| node_i18n
node_web_routes -->|"selects library"| node_library_scope
node_web_player -->|"requests playback"| node_web_api

click node_sqlite "https://github.com/instazdll/waveflow-server/blob/main/src/database.rs"
click node_server_boot "https://github.com/instazdll/waveflow-server/blob/main/src/main.rs"
click node_configuration "https://github.com/instazdll/waveflow-server/blob/main/src/config.rs"
click node_auth_security "https://github.com/instazdll/waveflow-server/blob/main/src/authentication.rs"
click node_scanner "https://github.com/instazdll/waveflow-server/blob/main/src/scanner.rs"
click node_catalogue "https://github.com/instazdll/waveflow-server/blob/main/src/catalog.rs"
click node_tags_lyrics "https://github.com/instazdll/waveflow-server/blob/main/src/tags.rs"
click node_metadata "https://github.com/instazdll/waveflow-server/blob/main/src/enrichment.rs"
click node_domain_services "https://github.com/instazdll/waveflow-server/blob/main/src/services/mod.rs"
click node_media_playback "https://github.com/instazdll/waveflow-server/blob/main/src/media.rs"
click node_scrobbling "https://github.com/instazdll/waveflow-server/blob/main/src/services/scrobbling.rs"
click node_scrobble_adapters "https://github.com/instazdll/waveflow-server/blob/main/src/scrobblers/mod.rs"
click node_native_api "https://github.com/instazdll/waveflow-server/blob/main/src/api/mod.rs"
click node_subsonic_api "https://github.com/instazdll/waveflow-server/blob/main/src/subsonic/mod.rs"
click node_sync "https://github.com/instazdll/waveflow-server/blob/main/src/sync.rs"
click node_oauth "https://github.com/instazdll/waveflow-server/blob/main/src/oauth.rs"
click node_web_routes "https://github.com/instazdll/waveflow-server/blob/main/webapp/src/main.tsx"
click node_web_api "https://github.com/instazdll/waveflow-server/blob/main/webapp/src/api/client.ts"
click node_web_player "https://github.com/instazdll/waveflow-server/blob/main/webapp/src/player/player.tsx"
click node_i18n "https://github.com/instazdll/waveflow-server/blob/main/webapp/src/state/i18n.tsx"
click node_library_scope "https://github.com/instazdll/waveflow-server/blob/main/webapp/src/state/library-scope.tsx"

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_sqlite,node_server_boot,node_configuration,node_auth_security,node_subsonic_client,node_desktop_client,node_browser_user toneBlue
class node_scanner,node_catalogue,node_tags_lyrics,node_metadata toneAmber
class node_domain_services,node_media_playback,node_scrobbling,node_scrobble_adapters toneMint
class node_native_api,node_subsonic_api,node_sync,node_oauth toneRose
class node_web_routes,node_web_api,node_web_player,node_i18n,node_library_scope,node_music_owner,node_music_files,node_ffmpeg,node_metadata_providers,node_scrobble_destinations toneIndigo
```

## Components

### Server Runtime

- [SQLite database](https://github.com/instazdll/waveflow-server/blob/main/src/database.rs): `src/database.rs`
- [Server startup](https://github.com/instazdll/waveflow-server/blob/main/src/main.rs): `src/main.rs`
- [Configuration](https://github.com/instazdll/waveflow-server/blob/main/src/config.rs): `src/config.rs`
- [Authentication and security](https://github.com/instazdll/waveflow-server/blob/main/src/authentication.rs): `src/authentication.rs`

### Music Catalogue

- [Library scanner](https://github.com/instazdll/waveflow-server/blob/main/src/scanner.rs): `src/scanner.rs`
- [Catalogue repository](https://github.com/instazdll/waveflow-server/blob/main/src/catalog.rs): `src/catalog.rs`
- [Tags and lyrics](https://github.com/instazdll/waveflow-server/blob/main/src/tags.rs): `src/tags.rs`
- [Metadata enrichment](https://github.com/instazdll/waveflow-server/blob/main/src/enrichment.rs): `src/enrichment.rs`

### Domain Services

- [Domain services](https://github.com/instazdll/waveflow-server/blob/main/src/services/mod.rs): `src/services/mod.rs`
- [Playback and transcoding](https://github.com/instazdll/waveflow-server/blob/main/src/media.rs): `src/media.rs`
- [Scrobble queue](https://github.com/instazdll/waveflow-server/blob/main/src/services/scrobbling.rs): `src/services/scrobbling.rs`
- [Scrobble adapters](https://github.com/instazdll/waveflow-server/blob/main/src/scrobblers/mod.rs): `src/scrobblers/mod.rs`

### Client Interfaces

- [Native API](https://github.com/instazdll/waveflow-server/blob/main/src/api/mod.rs): `src/api/mod.rs`
- [OpenSubsonic API](https://github.com/instazdll/waveflow-server/blob/main/src/subsonic/mod.rs): `src/subsonic/mod.rs`
- [User data sync](https://github.com/instazdll/waveflow-server/blob/main/src/sync.rs): `src/sync.rs`
- [OAuth and PKCE](https://github.com/instazdll/waveflow-server/blob/main/src/oauth.rs): `src/oauth.rs`

### Web Player

- [Web application routes](https://github.com/instazdll/waveflow-server/blob/main/webapp/src/main.tsx): `webapp/src/main.tsx`
- [Web API client](https://github.com/instazdll/waveflow-server/blob/main/webapp/src/api/client.ts): `webapp/src/api/client.ts`
- [Music player](https://github.com/instazdll/waveflow-server/blob/main/webapp/src/player/player.tsx): `webapp/src/player/player.tsx`
- [Localization](https://github.com/instazdll/waveflow-server/blob/main/webapp/src/state/i18n.tsx): `webapp/src/state/i18n.tsx`
- [Library selection](https://github.com/instazdll/waveflow-server/blob/main/webapp/src/state/library-scope.tsx): `webapp/src/state/library-scope.tsx`

### Other components

- **Music owner**
- **Subsonic client**
- **Desktop client**
- **Browser user**
- **Music files**
- **FFmpeg**
- **Metadata providers**
- **Scrobble destinations**

## Connections

- Music owner → Music files: provides library (evidence: `README.md`)
- Server startup → Configuration: loads settings (evidence: `README.md`)
- Server startup → SQLite database: serves with (evidence: `README.md`)
- Library scanner → Music files: scans files (evidence: `README.md`)
- Library scanner → Catalogue repository: indexes tracks (evidence: `src/scanner.rs`)
- Library scanner → Tags and lyrics: reads tags (evidence: `src/scanner.rs`)
- Catalogue repository → SQLite database: stores catalogue (evidence: `src/catalog.rs`)
- Metadata enrichment → Metadata providers: queries providers
- Domain services → Catalogue repository: serves catalogue
- Domain services → SQLite database: reads and writes (evidence: `src/services/mod.rs`)
- Playback and transcoding → FFmpeg: transcodes with (evidence: `README.md`)
- Playback and transcoding → SQLite database: reads track data
- Scrobble queue → Scrobble adapters: dispatches jobs (evidence: `src/scrobblers/mod.rs`)
- Scrobble adapters → Scrobble destinations: sends scrobbles (evidence: `README.md`)
- Native API → Authentication and security: authenticates requests (evidence: `src/api/auth.rs`)
- Native API → Domain services: routes operations (evidence: `src/api/mod.rs`)
- OpenSubsonic API → Domain services: uses shared services
- OpenSubsonic API → Playback and transcoding: serves streams (evidence: `src/subsonic/mod.rs`)
- Native API → User data sync: supports sync (evidence: `README.md`)
- Native API → OAuth and PKCE: handles authorization (evidence: `src/api/oauth.rs`)
- Desktop client → Native API: calls API (evidence: `README.md`)
- Subsonic client → OpenSubsonic API: sends requests (evidence: `README.md`)
- Browser user → Web application routes: uses player (evidence: `README.md`)
- Web application routes → Web API client: calls resources
- Web API client → Native API: calls endpoints (evidence: `webapp/src/api/client.ts`)
- Web application routes → Music player: hosts player (evidence: `webapp/src/main.tsx`)
- Web application routes → Localization: provides translations (evidence: `webapp/src/main.tsx`)
- Web application routes → Library selection: selects library (evidence: `webapp/src/state/library-scope.tsx`)
- Music player → Web API client: requests playback (evidence: `webapp/src/player/player.tsx`)
