# kushiemoon-dev/flacidal architecture

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

- Interactive diagram: https://gitdiagram.com/kushiemoon-dev/flacidal
- Repository: https://github.com/kushiemoon-dev/flacidal

## Overview

FLACidal is a desktop and headless-server application for finding and downloading lossless music, with metadata and artwork. Users paste a streaming URL or search for tracks, albums, or artists, then queue downloads; the configured source order tries providers until one succeeds. The README also describes library deduplication, history, endpoint status, extensions, and audio/file tools. Frontend-to-backend routing is visible in the API layer, but detailed backend call chains were not sampled, so those relationships are not expanded.

Main entry points: [`internal/app/app_sources.go`](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app_sources.go) (Ordered source fallback), [`frontend/src/App.svelte`](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/App.svelte) (App shell), [`frontend/src/lib/api.ts`](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/lib/api.ts) (Runtime API client), [`internal/api/handlers.go`](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/handlers.go) (HTTP endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app_ui["App shell<br/>[App.svelte]"]
  node_home["URL intake<br/>[Home.svelte]"]
  node_search["Music search<br/>[Search.svelte]"]
  node_queue_ui["Download queue<br/>[Queue.svelte]"]
  node_settings["Settings<br/>[Settings.svelte]"]
  node_history["Download history<br/>[History.svelte]"]
  node_api_client["Runtime API client<br/>[api.ts]"]
  node_queue_state["Queue state<br/>[queue.ts]"]
end

subgraph group_backend["Application backend"]
  node_headless_server["Headless HTTP server<br/>[server.go]"]
  node_api_handlers["HTTP endpoints<br/>[handlers.go]"]
  node_app_services["Download services<br/>[app.go]"]
  node_search_services["Search services<br/>[app_search.go]"]
  node_history_services["History services<br/>[app_history.go]"]
  node_analyzer["Audio analyzer"]
end

subgraph group_download["Music acquisition"]
  node_sources["Ordered source fallback<br/>[app_sources.go]"]
  node_tidal["Tidal"]
  node_qobuz["Qobuz"]
  node_amazon["Amazon Music"]
  node_bandcamp["Bandcamp"]
  node_soulseek["Soulseek P2P"]
  node_extensions["Community extensions"]
end

subgraph group_tools["Library and tools"]
  node_library["Downloaded files<br/>[Files.svelte]"]
  node_file_tools["Audio and file tools"]
  node_external_library[("External music library")]
end

node_user(("Music listener"))

node_user -->|"uses"| node_app_ui
node_app_ui -->|"routes to"| node_home
node_app_ui -->|"routes to"| node_search
node_app_ui -->|"routes to"| node_queue_ui
node_app_ui -->|"routes to"| node_settings
node_app_ui -->|"routes to"| node_history
node_home -.->|"requests content"| node_api_client
node_search -->|"searches and queues"| node_api_client
node_queue_ui -.->|"manages downloads"| node_api_client
node_queue_ui -.->|"uses state"| node_queue_state
node_settings -.->|"configures sources"| node_api_client
node_history -.->|"loads history"| node_api_client
node_api_client -->|"HTTP requests"| node_headless_server
node_headless_server -.->|"routes requests"| node_api_handlers
node_api_handlers -.->|"delegates"| node_app_services
node_api_handlers -.->|"serves search"| node_search_services
node_api_handlers -.->|"serves history"| node_history_services
node_api_handlers -.->|"serves analysis"| node_analyzer
node_app_services -.->|"tries sources"| node_sources
node_sources -->|"tries first"| node_tidal
node_sources -->|"falls back"| node_qobuz
node_sources -->|"falls back"| node_amazon
node_sources -->|"falls back"| node_bandcamp
node_sources -->|"falls back"| node_soulseek
node_sources -->|"tries enabled"| node_extensions
node_app_services -.->|"writes downloads"| node_library
node_library -.->|"checks duplicates"| node_external_library
node_user -->|"uses tools"| node_file_tools

click node_app_ui "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/App.svelte"
click node_home "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Home.svelte"
click node_search "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Search.svelte"
click node_queue_ui "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Queue.svelte"
click node_settings "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Settings.svelte"
click node_history "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/History.svelte"
click node_api_client "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/lib/api.ts"
click node_queue_state "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/stores/queue.ts"
click node_headless_server "https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/server.go"
click node_api_handlers "https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/handlers.go"
click node_app_services "https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app.go"
click node_search_services "https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app_search.go"
click node_history_services "https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app_history.go"
click node_analyzer "https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/handlers_analyzer.go"
click node_sources "https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app_sources.go"
click node_extensions "https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/handlers_extensions.go"
click node_library "https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Files.svelte"
click node_file_tools "https://github.com/kushiemoon-dev/flacidal/tree/main/frontend/src/pages/tools"

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_app_ui,node_home,node_search,node_queue_ui,node_settings,node_history,node_api_client,node_queue_state toneBlue
class node_headless_server,node_api_handlers,node_app_services,node_search_services,node_history_services,node_analyzer toneAmber
class node_sources,node_tidal,node_qobuz,node_amazon,node_bandcamp,node_soulseek,node_extensions toneMint
class node_library,node_file_tools,node_external_library toneRose
class node_user toneIndigo
```

## Components

### User interface

- [App shell](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/App.svelte): `frontend/src/App.svelte`
- [URL intake](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Home.svelte): `frontend/src/pages/Home.svelte`
- [Music search](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Search.svelte): `frontend/src/pages/Search.svelte`
- [Download queue](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Queue.svelte): `frontend/src/pages/Queue.svelte`
- [Settings](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Settings.svelte): `frontend/src/pages/Settings.svelte`
- [Download history](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/History.svelte): `frontend/src/pages/History.svelte`
- [Runtime API client](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Queue state](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/stores/queue.ts): `frontend/src/stores/queue.ts`

### Application backend

- [Headless HTTP server](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/server.go): `internal/api/server.go`
- [HTTP endpoints](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/handlers.go): `internal/api/handlers.go`
- [Download services](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app.go): `internal/app/app.go`
- [Search services](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app_search.go): `internal/app/app_search.go`
- [History services](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app_history.go): `internal/app/app_history.go`
- [Audio analyzer](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/handlers_analyzer.go): `internal/api/handlers_analyzer.go`

### Music acquisition

- [Ordered source fallback](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/app/app_sources.go): `internal/app/app_sources.go`
- **Tidal**
- **Qobuz**
- **Amazon Music**
- **Bandcamp**
- **Soulseek P2P**
- [Community extensions](https://github.com/kushiemoon-dev/flacidal/blob/main/internal/api/handlers_extensions.go): `internal/api/handlers_extensions.go`

### Library and tools

- [Downloaded files](https://github.com/kushiemoon-dev/flacidal/blob/main/frontend/src/pages/Files.svelte): `frontend/src/pages/Files.svelte`
- [Audio and file tools](https://github.com/kushiemoon-dev/flacidal/tree/main/frontend/src/pages/tools): `frontend/src/pages/tools`
- **External music library**

### Other components

- **Music listener**

## Connections

- Music listener → App shell: uses (evidence: `README.md`)
- App shell → URL intake: routes to (evidence: `frontend/src/App.svelte`)
- App shell → Music search: routes to (evidence: `frontend/src/App.svelte`)
- App shell → Download queue: routes to (evidence: `frontend/src/App.svelte`)
- App shell → Settings: routes to (evidence: `frontend/src/App.svelte`)
- App shell → Download history: routes to (evidence: `frontend/src/App.svelte`)
- URL intake → Runtime API client: requests content
- Music search → Runtime API client: searches and queues (evidence: `frontend/src/pages/Search.svelte`)
- Download queue → Runtime API client: manages downloads
- Download queue → Queue state: uses state
- Settings → Runtime API client: configures sources
- Download history → Runtime API client: loads history
- Runtime API client → Headless HTTP server: HTTP requests (evidence: `frontend/src/lib/api.ts`)
- Headless HTTP server → HTTP endpoints: routes requests
- HTTP endpoints → Download services: delegates
- HTTP endpoints → Search services: serves search
- HTTP endpoints → History services: serves history
- HTTP endpoints → Audio analyzer: serves analysis
- Download services → Ordered source fallback: tries sources
- Ordered source fallback → Tidal: tries first (evidence: `README.md`)
- Ordered source fallback → Qobuz: falls back (evidence: `README.md`)
- Ordered source fallback → Amazon Music: falls back (evidence: `README.md`)
- Ordered source fallback → Bandcamp: falls back (evidence: `README.md`)
- Ordered source fallback → Soulseek P2P: falls back (evidence: `README.md`)
- Ordered source fallback → Community extensions: tries enabled (evidence: `README.md`)
- Download services → Downloaded files: writes downloads
- Downloaded files → External music library: checks duplicates (evidence: `README.md`)
- Music listener → Audio and file tools: uses tools (evidence: `README.md`)
