# knighthat/kreate architecture

> Architecture diagram of the GitHub repository knighthat/kreate, 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/knighthat/kreate
- Repository: https://github.com/knighthat/kreate

## Overview

Kreate is a cross-platform music player fork focused on performance. A listener uses its screens to find music and manage a library, then plays or downloads it for offline listening; playback and library state are also stored locally. The README additionally documents lyrics, statistics, themes, visualizations, widgets, sharing, and optional updating. The tree and excerpts show the Android player, database, preferences, and YouTube Music client; relationships for unsampled feature implementations are therefore omitted rather than inferred.

Main entry points: [`composeApp/src/androidMain/kotlin/it/fast4x/rimusic/service/MyDownloadService.kt`](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/it/fast4x/rimusic/service/MyDownloadService.kt) (Download service), [`composeApp/src/androidMain/kotlin/app/kreate/android/service/player/PlaybackController.kt`](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/service/player/PlaybackController.kt) (Playback controller), [`composeApp/src/androidMain/kotlin/app/kreate/android/themed/rimusic/screen`](https://github.com/knighthat/kreate/tree/main/composeApp/src/androidMain/kotlin/app/kreate/android/themed/rimusic/screen) (Music screens), [`extensions/innertube/src/main/kotlin/it/fast4x/innertube/requests/SearchSuggestions.kt`](https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/requests/SearchSuggestions.kt) (Search suggestions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_screens["Music screens"]
  node_items["Library items"]
  node_settings["Settings"]
end

subgraph group_music["Music discovery"]
  node_search["Search suggestions"]
  node_youtubeclient["YouTube client<br/>[YouTubeClient.kt]"]
  node_innertube["Innertube API<br/>[Innertube.kt]"]
  node_context["Request context<br/>[Context.kt]"]
end

subgraph group_playback["Playback and offline"]
  node_player["Playback controller"]
  node_playerstate["Player service"]
  node_downloads["Download service"]
  node_downloadhelper["Download helper<br/>[DownloadHelper.kt]"]
end

subgraph group_state["Local state"]
  node_database[("Music database<br/>[Database.kt]")]
  node_preferences[("Preferences<br/>[Preferences.kt]")]
  node_export["Database export"]
end

subgraph group_integrations["External integrations"]
  node_youtube{{"YouTube Music"}}
  node_discord["Discord presence<br/>[DiscordImpl.kt]"]
  node_lyrics["Lyrics providers<br/>[LrcLib.kt]"]
  node_kugou["Kugou lyrics<br/>[KuGou.kt]"]
end

node_listener(("Listener"))

node_listener -->|"browses and plays"| node_screens
node_listener -->|"searches music"| node_search
node_listener -->|"downloads music"| node_downloads
node_listener -->|"configures"| node_settings
node_search -->|"posts requests"| node_innertube
node_innertube -.->|"queries music"| node_youtube
node_youtubeclient -->|"uses context"| node_context
node_player -->|"reads playback data"| node_database
node_player -->|"reads download state"| node_downloads
node_downloads -->|"gets manager"| node_downloadhelper
node_export -->|"checkpoints database"| node_database
node_screens -.->|"shows library items"| node_items

click node_screens "https://github.com/knighthat/kreate/tree/main/composeApp/src/androidMain/kotlin/app/kreate/android/themed/rimusic/screen"
click node_items "https://github.com/knighthat/kreate/tree/main/composeApp/src/androidMain/kotlin/app/kreate/android/themed/rimusic/component"
click node_settings "https://github.com/knighthat/kreate/tree/main/composeApp/src/androidMain/kotlin/app/kreate/android/themed/common/screens/settings"
click node_search "https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/requests/SearchSuggestions.kt"
click node_youtubeclient "https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/clients/YouTubeClient.kt"
click node_innertube "https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/Innertube.kt"
click node_context "https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/models/Context.kt"
click node_player "https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/service/player/PlaybackController.kt"
click node_playerstate "https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/service/player/StatefulPlayerImpl.kt"
click node_downloads "https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/it/fast4x/rimusic/service/MyDownloadService.kt"
click node_downloadhelper "https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/service/DownloadHelper.kt"
click node_database "https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/it/fast4x/rimusic/Database.kt"
click node_preferences "https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/Preferences.kt"
click node_export "https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/ExportDatabaseActivity.kt"
click node_discord "https://github.com/knighthat/kreate/blob/main/extensions/discord/src/androidMain/kotlin/me/knighthat/discord/DiscordImpl.kt"
click node_lyrics "https://github.com/knighthat/kreate/blob/main/extensions/lrclib/src/main/kotlin/it/fast4x/lrclib/LrcLib.kt"
click node_kugou "https://github.com/knighthat/kreate/blob/main/extensions/kugou/src/main/kotlin/it/fast4x/kugou/KuGou.kt"

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_screens,node_items,node_settings toneBlue
class node_search,node_youtubeclient,node_innertube,node_context toneAmber
class node_player,node_playerstate,node_downloads,node_downloadhelper toneMint
class node_database,node_preferences,node_export toneRose
class node_youtube,node_discord,node_lyrics,node_kugou,node_listener toneIndigo
```

## Components

### App experience

- [Music screens](https://github.com/knighthat/kreate/tree/main/composeApp/src/androidMain/kotlin/app/kreate/android/themed/rimusic/screen): `composeApp/src/androidMain/kotlin/app/kreate/android/themed/rimusic/screen`
- [Library items](https://github.com/knighthat/kreate/tree/main/composeApp/src/androidMain/kotlin/app/kreate/android/themed/rimusic/component): `composeApp/src/androidMain/kotlin/app/kreate/android/themed/rimusic/component`
- [Settings](https://github.com/knighthat/kreate/tree/main/composeApp/src/androidMain/kotlin/app/kreate/android/themed/common/screens/settings): `composeApp/src/androidMain/kotlin/app/kreate/android/themed/common/screens/settings`

### Music discovery

- [Search suggestions](https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/requests/SearchSuggestions.kt): `extensions/innertube/src/main/kotlin/it/fast4x/innertube/requests/SearchSuggestions.kt`
- [YouTube client](https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/clients/YouTubeClient.kt): `extensions/innertube/src/main/kotlin/it/fast4x/innertube/clients/YouTubeClient.kt`
- [Innertube API](https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/Innertube.kt): `extensions/innertube/src/main/kotlin/it/fast4x/innertube/Innertube.kt`
- [Request context](https://github.com/knighthat/kreate/blob/main/extensions/innertube/src/main/kotlin/it/fast4x/innertube/models/Context.kt): `extensions/innertube/src/main/kotlin/it/fast4x/innertube/models/Context.kt`

### Playback and offline

- [Playback controller](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/service/player/PlaybackController.kt): `composeApp/src/androidMain/kotlin/app/kreate/android/service/player/PlaybackController.kt`
- [Player service](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/service/player/StatefulPlayerImpl.kt): `composeApp/src/androidMain/kotlin/app/kreate/android/service/player/StatefulPlayerImpl.kt`
- [Download service](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/it/fast4x/rimusic/service/MyDownloadService.kt): `composeApp/src/androidMain/kotlin/it/fast4x/rimusic/service/MyDownloadService.kt`
- [Download helper](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/service/DownloadHelper.kt): `composeApp/src/androidMain/kotlin/app/kreate/android/service/DownloadHelper.kt`

### Local state

- [Music database](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/it/fast4x/rimusic/Database.kt): `composeApp/src/androidMain/kotlin/it/fast4x/rimusic/Database.kt`
- [Preferences](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/Preferences.kt): `composeApp/src/androidMain/kotlin/app/kreate/android/Preferences.kt`
- [Database export](https://github.com/knighthat/kreate/blob/main/composeApp/src/androidMain/kotlin/app/kreate/android/ExportDatabaseActivity.kt): `composeApp/src/androidMain/kotlin/app/kreate/android/ExportDatabaseActivity.kt`

### External integrations

- **YouTube Music**
- [Discord presence](https://github.com/knighthat/kreate/blob/main/extensions/discord/src/androidMain/kotlin/me/knighthat/discord/DiscordImpl.kt): `extensions/discord/src/androidMain/kotlin/me/knighthat/discord/DiscordImpl.kt`
- [Lyrics providers](https://github.com/knighthat/kreate/blob/main/extensions/lrclib/src/main/kotlin/it/fast4x/lrclib/LrcLib.kt): `extensions/lrclib/src/main/kotlin/it/fast4x/lrclib/LrcLib.kt`
- [Kugou lyrics](https://github.com/knighthat/kreate/blob/main/extensions/kugou/src/main/kotlin/it/fast4x/kugou/KuGou.kt): `extensions/kugou/src/main/kotlin/it/fast4x/kugou/KuGou.kt`

### Other components

- **Listener**

## Connections

- Listener → Music screens: browses and plays
- Listener → Search suggestions: searches music
- Listener → Download service: downloads music
- Listener → Settings: configures
- Search suggestions → Innertube API: posts requests (evidence: `extensions/innertube/src/main/kotlin/it/fast4x/innertube/requests/SearchSuggestions.kt`)
- Innertube API → YouTube Music: queries music
- YouTube client → Request context: uses context (evidence: `extensions/innertube/src/main/kotlin/it/fast4x/innertube/clients/YouTubeClient.kt`)
- Playback controller → Music database: reads playback data (evidence: `composeApp/src/androidMain/kotlin/app/kreate/android/service/player/PlaybackController.kt`)
- Playback controller → Download service: reads download state (evidence: `composeApp/src/androidMain/kotlin/app/kreate/android/service/player/PlaybackController.kt`)
- Download service → Download helper: gets manager (evidence: `composeApp/src/androidMain/kotlin/it/fast4x/rimusic/service/MyDownloadService.kt`)
- Database export → Music database: checkpoints database (evidence: `composeApp/src/androidMain/kotlin/app/kreate/android/ExportDatabaseActivity.kt`)
- Music screens → Library items: shows library items
