# echomusicapp/desktop architecture

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

- Interactive diagram: https://gitdiagram.com/echomusicapp/desktop
- Repository: https://github.com/echomusicapp/desktop

## Overview

Echo Music Desktop is a native YouTube Music client. Users navigate Home, Explore, Library, podcasts, and downloads or search for music; they can then play tracks, manage the queue, and use playback features such as lyrics, EQ, and full-screen artwork. The app also supports offline listening, history and stats, desktop media surfaces, and optional integrations. The excerpts show route loaders calling YouTube client methods and identify several internal services, but do not expose all runtime wiring; README-documented capability links are cited as such.

Main entry points: [`internal/player/player.go`](https://github.com/echomusicapp/desktop/blob/main/internal/player/player.go) (Audio player), [`internal/app/playback.go`](https://github.com/echomusicapp/desktop/blob/main/internal/app/playback.go) (Playback controls), [`internal/youtube/client.go`](https://github.com/echomusicapp/desktop/blob/main/internal/youtube/client.go) (YouTube Music client), [`main.go`](https://github.com/echomusicapp/desktop/blob/main/main.go) (Desktop entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_entry["Desktop entry<br/>[main.go]"]
  node_app["App coordinator<br/>[app.go]"]
  node_routes["Navigation routes<br/>[routes.go]"]
end

subgraph group_catalog["Music discovery"]
  node_search["Search<br/>[search.go]"]
  node_youtube["YouTube Music client<br/>[client.go]"]
  node_browse["Catalog browsing<br/>[browse.go]"]
  node_offline[("Downloads library<br/>[offline.go]")]
end

subgraph group_playback["Playback and media"]
  node_playback_ui["Playback controls<br/>[playback.go]"]
  node_player["Audio player<br/>[player.go]"]
  node_stream["Stream resolution<br/>[ytdlp.go]"]
  node_audio_cache[("Audio cache<br/>[cache.go]")]
  node_artwork[("Artwork cache<br/>[artwork.go]")]
  node_lyrics["Lyrics lookup<br/>[danklyrics.go]"]
end

subgraph group_state["Local state and integrations"]
  node_settings[("Preferences<br/>[settings.go]")]
  node_history[("Listening history<br/>[history.go]")]
  node_playstate[("Queue state<br/>[playstate.go]")]
  node_cookies["Browser sign-in<br/>[discover.go]"]
  node_mcp["Local MCP control<br/>[control.go]"]
  node_discord["Discord presence<br/>[rpc.go]"]
  node_desktop_media["System media surfaces<br/>[media.go]"]
end

node_user(("Listener"))

node_user -->|"launches"| node_entry
node_entry -->|"starts"| node_app
node_user -->|"navigates"| node_routes
node_routes -->|"loads catalog"| node_youtube
node_user -->|"searches"| node_search
node_search -->|"queries"| node_youtube
node_user -->|"starts playback"| node_playback_ui
node_playback_ui -.->|"controls"| node_player
node_player -.->|"resolves streams"| node_stream
node_player -.->|"uses cache"| node_audio_cache
node_user -->|"downloads tracks"| node_offline
node_user -->|"views artwork"| node_artwork
node_user -->|"views lyrics"| node_lyrics
node_user -->|"configures"| node_settings
node_user -->|"reviews stats"| node_history
node_playback_ui -.->|"persists queue"| node_playstate
node_youtube -.->|"uses sign-in"| node_cookies
node_user -->|"controls locally"| node_mcp
node_player -.->|"reports playback"| node_discord
node_player -.->|"updates media"| node_desktop_media

click node_entry "https://github.com/echomusicapp/desktop/blob/main/main.go"
click node_app "https://github.com/echomusicapp/desktop/blob/main/internal/app/app.go"
click node_routes "https://github.com/echomusicapp/desktop/blob/main/internal/app/routes.go"
click node_search "https://github.com/echomusicapp/desktop/blob/main/internal/app/search.go"
click node_youtube "https://github.com/echomusicapp/desktop/blob/main/internal/youtube/client.go"
click node_browse "https://github.com/echomusicapp/desktop/blob/main/internal/youtube/browse.go"
click node_offline "https://github.com/echomusicapp/desktop/blob/main/internal/offline/offline.go"
click node_playback_ui "https://github.com/echomusicapp/desktop/blob/main/internal/app/playback.go"
click node_player "https://github.com/echomusicapp/desktop/blob/main/internal/player/player.go"
click node_stream "https://github.com/echomusicapp/desktop/blob/main/internal/ytdlp/ytdlp.go"
click node_audio_cache "https://github.com/echomusicapp/desktop/blob/main/internal/audio/cache.go"
click node_artwork "https://github.com/echomusicapp/desktop/blob/main/internal/artwork/artwork.go"
click node_lyrics "https://github.com/echomusicapp/desktop/blob/main/internal/danklyrics/danklyrics.go"
click node_settings "https://github.com/echomusicapp/desktop/blob/main/internal/settings/settings.go"
click node_history "https://github.com/echomusicapp/desktop/blob/main/internal/history/history.go"
click node_playstate "https://github.com/echomusicapp/desktop/blob/main/internal/playstate/playstate.go"
click node_cookies "https://github.com/echomusicapp/desktop/blob/main/internal/cookies/discover.go"
click node_mcp "https://github.com/echomusicapp/desktop/blob/main/internal/mcpcontrol/control.go"
click node_discord "https://github.com/echomusicapp/desktop/blob/main/internal/discordrpc/rpc.go"
click node_desktop_media "https://github.com/echomusicapp/desktop/blob/main/internal/systemmedia/media.go"

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_entry,node_app,node_routes toneBlue
class node_search,node_youtube,node_browse,node_offline toneAmber
class node_playback_ui,node_player,node_stream,node_audio_cache,node_artwork,node_lyrics toneMint
class node_settings,node_history,node_playstate,node_cookies,node_mcp,node_discord,node_desktop_media toneRose
class node_user toneIndigo
```

## Components

### Desktop experience

- [Desktop entry](https://github.com/echomusicapp/desktop/blob/main/main.go): `main.go`
- [App coordinator](https://github.com/echomusicapp/desktop/blob/main/internal/app/app.go): `internal/app/app.go`
- [Navigation routes](https://github.com/echomusicapp/desktop/blob/main/internal/app/routes.go): `internal/app/routes.go`

### Music discovery

- [Search](https://github.com/echomusicapp/desktop/blob/main/internal/app/search.go): `internal/app/search.go`
- [YouTube Music client](https://github.com/echomusicapp/desktop/blob/main/internal/youtube/client.go): `internal/youtube/client.go`
- [Catalog browsing](https://github.com/echomusicapp/desktop/blob/main/internal/youtube/browse.go): `internal/youtube/browse.go`
- [Downloads library](https://github.com/echomusicapp/desktop/blob/main/internal/offline/offline.go): `internal/offline/offline.go`

### Playback and media

- [Playback controls](https://github.com/echomusicapp/desktop/blob/main/internal/app/playback.go): `internal/app/playback.go`
- [Audio player](https://github.com/echomusicapp/desktop/blob/main/internal/player/player.go): `internal/player/player.go`
- [Stream resolution](https://github.com/echomusicapp/desktop/blob/main/internal/ytdlp/ytdlp.go): `internal/ytdlp/ytdlp.go`
- [Audio cache](https://github.com/echomusicapp/desktop/blob/main/internal/audio/cache.go): `internal/audio/cache.go`
- [Artwork cache](https://github.com/echomusicapp/desktop/blob/main/internal/artwork/artwork.go): `internal/artwork/artwork.go`
- [Lyrics lookup](https://github.com/echomusicapp/desktop/blob/main/internal/danklyrics/danklyrics.go): `internal/danklyrics/danklyrics.go`

### Local state and integrations

- [Preferences](https://github.com/echomusicapp/desktop/blob/main/internal/settings/settings.go): `internal/settings/settings.go`
- [Listening history](https://github.com/echomusicapp/desktop/blob/main/internal/history/history.go): `internal/history/history.go`
- [Queue state](https://github.com/echomusicapp/desktop/blob/main/internal/playstate/playstate.go): `internal/playstate/playstate.go`
- [Browser sign-in](https://github.com/echomusicapp/desktop/blob/main/internal/cookies/discover.go): `internal/cookies/discover.go`
- [Local MCP control](https://github.com/echomusicapp/desktop/blob/main/internal/mcpcontrol/control.go): `internal/mcpcontrol/control.go`
- [Discord presence](https://github.com/echomusicapp/desktop/blob/main/internal/discordrpc/rpc.go): `internal/discordrpc/rpc.go`
- [System media surfaces](https://github.com/echomusicapp/desktop/blob/main/internal/systemmedia/media.go): `internal/systemmedia/media.go`

### Other components

- **Listener**

## Connections

- Listener → Desktop entry: launches (evidence: `main.go`)
- Desktop entry → App coordinator: starts (evidence: `main.go`)
- Listener → Navigation routes: navigates (evidence: `README.md`)
- Navigation routes → YouTube Music client: loads catalog (evidence: `internal/app/routes.go`)
- Listener → Search: searches (evidence: `README.md`)
- Search → YouTube Music client: queries (evidence: `internal/app/search.go`)
- Listener → Playback controls: starts playback (evidence: `README.md`)
- Playback controls → Audio player: controls
- Audio player → Stream resolution: resolves streams
- Audio player → Audio cache: uses cache
- Listener → Downloads library: downloads tracks (evidence: `README.md`)
- Listener → Artwork cache: views artwork (evidence: `README.md`)
- Listener → Lyrics lookup: views lyrics (evidence: `README.md`)
- Listener → Preferences: configures (evidence: `README.md`)
- Listener → Listening history: reviews stats (evidence: `README.md`)
- Playback controls → Queue state: persists queue
- YouTube Music client → Browser sign-in: uses sign-in
- Listener → Local MCP control: controls locally (evidence: `README.md`)
- Audio player → Discord presence: reports playback
- Audio player → System media surfaces: updates media
