# lyswhut/lx-music-mobile architecture

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

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

## Overview

LX Music Mobile is a React Native music player. The main path is app startup and navigation into search or music-list views, followed by playback through the player service. Other major areas include charts and song lists, personal playlists, lyrics, downloads, settings, local persistence, and optional server synchronization. The graph uses sampled source and SOURCE INDEX references for evidenced links; unsampled product branches and integrations are shown only where their paths are supported, with unverified links dashed.

Main entry points: [`src/screens/Home/Vertical/Main.tsx`](https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Vertical/Main.tsx) (Home navigation), [`src/plugins/player/service.ts`](https://github.com/lyswhut/lx-music-mobile/blob/master/src/plugins/player/service.ts) (Playback service), [`src/screens/Home/Views/Setting/Main.tsx`](https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Setting/Main.tsx) (Settings), [`src/plugins/sync/client/client.ts`](https://github.com/lyswhut/lx-music-mobile/blob/master/src/plugins/sync/client/client.ts) (Sync client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and discovery"]
  node_startup["App startup<br/>[app.ts]"]
  node_home["Home navigation<br/>[Main.tsx]"]
  node_searchview["Music search<br/>[index.tsx]"]
  node_charts["Charts<br/>[index.tsx]"]
  node_songlists["Online song lists<br/>[index.tsx]"]
end

subgraph group_music["Music and playback"]
  node_searchcore["Search logic<br/>[search.ts]"]
  node_playback["Playback service<br/>[service.ts]"]
  node_playercore["Player state and control<br/>[player.ts]"]
  node_lyrics["Lyrics<br/>[lyric.ts]"]
  node_downloads["Music downloads<br/>[download.ts]"]
  node_locals["Local music<br/>[local.ts]"]
  node_customsource["Custom music sources<br/>[userApi.ts]"]
end

subgraph group_data["User data and settings"]
  node_personal["Personal playlists<br/>[index.tsx]"]
  node_settings["Settings<br/>[Main.tsx]"]
  node_dataapi["App data access<br/>[data.ts]"]
  node_storage[("Persistent storage<br/>[storage.ts]")]
end

subgraph group_sync["Synchronization"]
  node_syncclient["Sync client<br/>[client.ts]"]
  node_synccore["Sync state<br/>[sync.ts]"]
  node_syncservice["Sync server"]
end

node_user(("Listener"))

node_user -->|"opens app"| node_startup
node_startup -.->|"opens navigation"| node_home
node_startup -->|"initializes core"| node_startup
node_home -->|"renders view"| node_searchview
node_home -->|"renders view"| node_charts
node_home -->|"renders view"| node_songlists
node_home -->|"renders view"| node_personal
node_home -->|"renders view"| node_settings
node_searchview -->|"calls search"| node_searchcore
node_searchcore -.->|"updates results"| node_searchview
node_searchview -.->|"starts playback"| node_playback
node_charts -.->|"starts playback"| node_playback
node_songlists -.->|"starts playback"| node_playback
node_personal -.->|"starts playback"| node_playback
node_playback -->|"uses player"| node_playercore
node_playback -->|"loads lyrics"| node_lyrics
node_settings -.->|"configures sources"| node_customsource
node_settings -.->|"configures playback"| node_downloads
node_settings -.->|"configures sync"| node_syncclient
node_dataapi -->|"reads and writes"| node_storage
node_personal -.->|"loads playlist data"| node_dataapi
node_locals -.->|"loads local data"| node_dataapi
node_downloads -.->|"saves downloads"| node_dataapi
node_syncclient -->|"updates sync status"| node_synccore
node_syncclient -->|"connects by WebSocket"| node_syncservice
node_syncclient -.->|"syncs playlist data"| node_personal

click node_startup "https://github.com/lyswhut/lx-music-mobile/blob/master/src/app.ts"
click node_home "https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Vertical/Main.tsx"
click node_searchview "https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Search/index.tsx"
click node_searchcore "https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/search/search.ts"
click node_charts "https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Leaderboard/index.tsx"
click node_songlists "https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/SongList/index.tsx"
click node_personal "https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Mylist/index.tsx"
click node_playback "https://github.com/lyswhut/lx-music-mobile/blob/master/src/plugins/player/service.ts"
click node_playercore "https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/player/player.ts"
click node_lyrics "https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/lyric.ts"
click node_downloads "https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/music/download.ts"
click node_locals "https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/music/local.ts"
click node_customsource "https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/userApi.ts"
click node_settings "https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Setting/Main.tsx"
click node_dataapi "https://github.com/lyswhut/lx-music-mobile/blob/master/src/utils/data.ts"
click node_storage "https://github.com/lyswhut/lx-music-mobile/blob/master/src/plugins/storage.ts"
click node_syncclient "https://github.com/lyswhut/lx-music-mobile/blob/master/src/plugins/sync/client/client.ts"
click node_synccore "https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/sync.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_startup,node_home,node_searchview,node_charts,node_songlists toneBlue
class node_searchcore,node_playback,node_playercore,node_lyrics,node_downloads,node_locals,node_customsource toneAmber
class node_personal,node_settings,node_dataapi,node_storage toneMint
class node_syncclient,node_synccore,node_syncservice toneRose
class node_user toneIndigo
```

## Components

### App and discovery

- [App startup](https://github.com/lyswhut/lx-music-mobile/blob/master/src/app.ts): `src/app.ts`
- [Home navigation](https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Vertical/Main.tsx): `src/screens/Home/Vertical/Main.tsx`
- [Music search](https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Search/index.tsx): `src/screens/Home/Views/Search/index.tsx`
- [Charts](https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Leaderboard/index.tsx): `src/screens/Home/Views/Leaderboard/index.tsx`
- [Online song lists](https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/SongList/index.tsx): `src/screens/Home/Views/SongList/index.tsx`

### Music and playback

- [Search logic](https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/search/search.ts): `src/core/search/search.ts`
- [Playback service](https://github.com/lyswhut/lx-music-mobile/blob/master/src/plugins/player/service.ts): `src/plugins/player/service.ts`
- [Player state and control](https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/player/player.ts): `src/core/player/player.ts`
- [Lyrics](https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/lyric.ts): `src/core/lyric.ts`
- [Music downloads](https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/music/download.ts): `src/core/music/download.ts`
- [Local music](https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/music/local.ts): `src/core/music/local.ts`
- [Custom music sources](https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/userApi.ts): `src/core/userApi.ts`

### User data and settings

- [Personal playlists](https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Mylist/index.tsx): `src/screens/Home/Views/Mylist/index.tsx`
- [Settings](https://github.com/lyswhut/lx-music-mobile/blob/master/src/screens/Home/Views/Setting/Main.tsx): `src/screens/Home/Views/Setting/Main.tsx`
- [App data access](https://github.com/lyswhut/lx-music-mobile/blob/master/src/utils/data.ts): `src/utils/data.ts`
- [Persistent storage](https://github.com/lyswhut/lx-music-mobile/blob/master/src/plugins/storage.ts): `src/plugins/storage.ts`

### Synchronization

- [Sync client](https://github.com/lyswhut/lx-music-mobile/blob/master/src/plugins/sync/client/client.ts): `src/plugins/sync/client/client.ts`
- [Sync state](https://github.com/lyswhut/lx-music-mobile/blob/master/src/core/sync.ts): `src/core/sync.ts`
- **Sync server**

### Other components

- **Listener**

## Connections

- Listener → App startup: opens app (evidence: `src/app.ts`)
- App startup → Home navigation: opens navigation (evidence: `src/app.ts`)
- App startup → App startup: initializes core (evidence: `src/app.ts`)
- Home navigation → Music search: renders view (evidence: `src/screens/Home/Vertical/Main.tsx`)
- Home navigation → Charts: renders view (evidence: `src/screens/Home/Vertical/Main.tsx`)
- Home navigation → Online song lists: renders view (evidence: `src/screens/Home/Vertical/Main.tsx`)
- Home navigation → Personal playlists: renders view (evidence: `src/screens/Home/Vertical/Main.tsx`)
- Home navigation → Settings: renders view (evidence: `src/screens/Home/Vertical/Main.tsx`)
- Music search → Search logic: calls search (evidence: `src/screens/Home/Views/Search/index.tsx`)
- Search logic → Music search: updates results (evidence: `src/screens/Home/Views/Search/index.tsx`)
- Music search → Playback service: starts playback
- Charts → Playback service: starts playback
- Online song lists → Playback service: starts playback
- Personal playlists → Playback service: starts playback
- Playback service → Player state and control: uses player (evidence: `src/plugins/player/service.ts`)
- Playback service → Lyrics: loads lyrics (evidence: `src/plugins/player/service.ts`)
- Settings → Custom music sources: configures sources
- Settings → Music downloads: configures playback
- Settings → Sync client: configures sync
- App data access → Persistent storage: reads and writes (evidence: `src/utils/data.ts`)
- Personal playlists → App data access: loads playlist data
- Local music → App data access: loads local data
- Music downloads → App data access: saves downloads
- Sync client → Sync state: updates sync status (evidence: `src/plugins/sync/client/client.ts`)
- Sync client → Sync server: connects by WebSocket (evidence: `src/plugins/sync/client/client.ts`)
- Sync client → Personal playlists: syncs playlist data
