# lyswhut/lx-music-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/lyswhut/lx-music-desktop
- Repository: https://github.com/lyswhut/lx-music-desktop

## Overview

LX Music is an Electron/Vue desktop music application. The main user workflow is to discover music through supported online sources, manage lists, and play tracks, with downloads and synchronized data as additional capabilities. The desktop main process hosts the application windows and services; the primary Vue renderer provides the music UI, while a separate renderer handles desktop lyrics. The graph preserves documented integrations and major subsystems, but several renderer and music features are represented at directory level because their implementation was not sampled.

Main entry points: [`src/main/modules/winMain/main.ts`](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/winMain/main.ts) (Main window), [`src/renderer/main.ts`](https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/main.ts) (Renderer bootstrap), [`src/main/modules/winLyric/main.ts`](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/winLyric/main.ts) (Lyric window), [`src/main/app.ts`](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/app.ts) (Main app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_main["Main app<br/>[app.ts]"]
  node_mainwindow["Main window<br/>[main.ts]"]
  node_rendererboot["Renderer bootstrap<br/>[main.ts]"]
  node_lyricmain["Lyric window<br/>[main.ts]"]
end

subgraph group_music["Music experience"]
  node_appui["Main UI<br/>[App.vue]"]
  node_discovery["Music discovery"]
  node_lists["Lists and search"]
  node_player["Playback"]
  node_downloads["Downloads<br/>[download.ts]"]
  node_lyricui["Lyric renderer<br/>[App.vue]"]
end

subgraph group_state["Data and settings"]
  node_settings["Settings and state<br/>[setting.ts]"]
  node_database[("Local database<br/>[db.ts]")]
end

subgraph group_sync["Synchronization"]
  node_syncserver["Sync server<br/>[server.ts]"]
  node_syncclient["Sync client<br/>[client.ts]"]
end

subgraph group_integrations["External interfaces"]
  node_openapi["Open API<br/>[index.ts]"]
  node_userapi["User API<br/>[main.ts]"]
end

node_user(("Listener"))
node_musicplatforms["Music platforms"]
node_syncservice["Sync service"]
node_thirdparty(("Third-party callers"))

node_user -->|"opens app"| node_mainwindow
node_main -->|"checks window"| node_mainwindow
node_main -->|"migrates data"| node_database
node_mainwindow -->|"loads renderer"| node_rendererboot
node_rendererboot -->|"mounts app"| node_appui
node_rendererboot -->|"initializes settings"| node_settings
node_appui -.->|"presents controls"| node_user
node_user -.->|"requests music"| node_discovery
node_discovery -.->|"queries catalogs"| node_musicplatforms
node_user -.->|"manages lists"| node_lists
node_user -.->|"starts playback"| node_player
node_player -.->|"downloads tracks"| node_downloads
node_mainwindow -.->|"opens lyric window"| node_lyricmain
node_lyricmain -->|"loads renderer"| node_lyricui
node_lyricui -->|"sends IPC"| node_lyricmain
node_user -.->|"configures sync"| node_syncclient
node_syncclient -->|"synchronizes data"| node_syncservice
node_syncserver -->|"hosts service"| node_syncservice
node_thirdparty -->|"calls locally"| node_openapi
node_thirdparty -.->|"uses API"| node_userapi

click node_main "https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/app.ts"
click node_mainwindow "https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/winMain/main.ts"
click node_rendererboot "https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/main.ts"
click node_appui "https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/App.vue"
click node_discovery "https://github.com/lyswhut/lx-music-desktop/tree/master/src/renderer/utils/musicSdk"
click node_lists "https://github.com/lyswhut/lx-music-desktop/tree/master/src/renderer/views"
click node_player "https://github.com/lyswhut/lx-music-desktop/tree/master/src/renderer/core/player"
click node_downloads "https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/core/music/download.ts"
click node_lyricmain "https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/winLyric/main.ts"
click node_lyricui "https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer-lyric/App.vue"
click node_settings "https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/store/setting.ts"
click node_database "https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/worker/dbService/db.ts"
click node_syncserver "https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/sync/server/server/server.ts"
click node_syncclient "https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/sync/client/client.ts"
click node_openapi "https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/openApi/index.ts"
click node_userapi "https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/userApi/main.ts"

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_main,node_mainwindow,node_rendererboot,node_lyricmain toneBlue
class node_appui,node_discovery,node_lists,node_player,node_downloads,node_lyricui toneAmber
class node_settings,node_database toneMint
class node_syncserver,node_syncclient toneRose
class node_openapi,node_userapi,node_user,node_musicplatforms,node_syncservice,node_thirdparty toneIndigo
```

## Components

### Desktop runtime

- [Main app](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/app.ts): `src/main/app.ts`
- [Main window](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/winMain/main.ts): `src/main/modules/winMain/main.ts`
- [Renderer bootstrap](https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/main.ts): `src/renderer/main.ts`
- [Lyric window](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/winLyric/main.ts): `src/main/modules/winLyric/main.ts`

### Music experience

- [Main UI](https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/App.vue): `src/renderer/App.vue`
- [Music discovery](https://github.com/lyswhut/lx-music-desktop/tree/master/src/renderer/utils/musicSdk): `src/renderer/utils/musicSdk`
- [Lists and search](https://github.com/lyswhut/lx-music-desktop/tree/master/src/renderer/views): `src/renderer/views`
- [Playback](https://github.com/lyswhut/lx-music-desktop/tree/master/src/renderer/core/player): `src/renderer/core/player`
- [Downloads](https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/core/music/download.ts): `src/renderer/core/music/download.ts`
- [Lyric renderer](https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer-lyric/App.vue): `src/renderer-lyric/App.vue`

### Data and settings

- [Settings and state](https://github.com/lyswhut/lx-music-desktop/blob/master/src/renderer/store/setting.ts): `src/renderer/store/setting.ts`
- [Local database](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/worker/dbService/db.ts): `src/main/worker/dbService/db.ts`

### Synchronization

- [Sync server](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/sync/server/server/server.ts): `src/main/modules/sync/server/server/server.ts`
- [Sync client](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/sync/client/client.ts): `src/main/modules/sync/client/client.ts`

### External interfaces

- [Open API](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/openApi/index.ts): `src/main/modules/openApi/index.ts`
- [User API](https://github.com/lyswhut/lx-music-desktop/blob/master/src/main/modules/userApi/main.ts): `src/main/modules/userApi/main.ts`

### Other components

- **Listener**
- **Music platforms**
- **Sync service**
- **Third-party callers**

## Connections

- Listener → Main window: opens app (evidence: `README.md`)
- Main app → Main window: checks window (evidence: `src/main/app.ts`)
- Main app → Local database: migrates data (evidence: `src/main/app.ts`)
- Main window → Renderer bootstrap: loads renderer (evidence: `src/main/modules/winMain/main.ts`)
- Renderer bootstrap → Main UI: mounts app (evidence: `src/renderer/main.ts`)
- Renderer bootstrap → Settings and state: initializes settings (evidence: `src/renderer/main.ts`)
- Main UI → Listener: presents controls
- Listener → Music discovery: requests music
- Music discovery → Music platforms: queries catalogs (evidence: `README.md`)
- Listener → Lists and search: manages lists
- Listener → Playback: starts playback
- Playback → Downloads: downloads tracks
- Main window → Lyric window: opens lyric window
- Lyric window → Lyric renderer: loads renderer (evidence: `src/main/modules/winLyric/main.ts`)
- Lyric renderer → Lyric window: sends IPC (evidence: `src/renderer-lyric/App.vue`)
- Listener → Sync client: configures sync
- Sync client → Sync service: synchronizes data (evidence: `README.md`)
- Sync server → Sync service: hosts service (evidence: `README.md`)
- Third-party callers → Open API: calls locally (evidence: `README.md`)
- Third-party callers → User API: uses API
