# bartoostveen/vitune architecture

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

- Interactive diagram: https://gitdiagram.com/bartoostveen/vitune
- Repository: https://github.com/bartoostveen/vitune

## Overview

ViTune is an Android music-streaming app. The main user flow is browsing or searching YouTube Music (or choosing local music), selecting media, and playing it through a background-capable player; users can also save media offline and manage playlists and lyrics. The graph separates UI/navigation, online discovery, playback/offline services, and persistent state. README feature statements support the broad product flows; source excerpts confirm routing, search-history persistence, service responsibilities, and database structure, but do not expose every screen-to-provider call.

Main entry points: [`app/src/main/kotlin/app/vitune/android/ui/screens`](https://github.com/bartoostveen/vitune/tree/master/app/src/main/kotlin/app/vitune/android/ui/screens) (Browse and search screens), [`app/src/main/kotlin/app/vitune/android/service/PlayerService.kt`](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/service/PlayerService.kt) (Playback service), [`app/src/main/kotlin/app/vitune/android/Database.kt`](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/Database.kt) (Library database), [`app/src/main/kotlin/app/vitune/android/ui/screens/Routes.kt`](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/Routes.kt) (Route definitions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App UI and navigation"]
  node_routes["Route definitions<br/>[Routes.kt]"]
  node_screens["Browse and search screens"]
  node_router["Compose router<br/>[RootRouter.kt]"]
end

subgraph group_discovery["Music discovery"]
  node_search["Online search<br/>[OnlineSearch.kt]"]
  node_innertube["YouTube Music API<br/>[Innertube.kt]"]
  node_moods["Mood discovery"]
  node_piped["Piped playlists<br/>[Piped.kt]"]
  node_lyrics["Lyrics providers"]
end

subgraph group_playback["Playback and offline"]
  node_player["Playback service<br/>[PlayerService.kt]"]
  node_media_browser["Media browser"]
  node_player_ui["Player screens<br/>[Player.kt]"]
  node_precache["Offline downloads<br/>[PrecacheService.kt]"]
  node_cache["Media cache<br/>[Cache.kt]"]
end

subgraph group_state["Library and settings"]
  node_local_library["Local music<br/>[HomeLocalSongs.kt]"]
  node_database[("Library database<br/>[Database.kt]")]
  node_song_model["Song records<br/>[Song.kt]"]
  node_playlist_model["Playlist records<br/>[Playlist.kt]"]
  node_preferences["Data preferences<br/>[DataPreferences.kt]"]
  node_settings["Settings screens<br/>[SettingsScreen.kt]"]
end

node_listener(("Listener"))

node_listener -->|"opens features"| node_routes
node_routes -->|"registers routes"| node_router
node_routes -->|"dispatches to"| node_screens
node_screens -->|"offers search"| node_search
node_search -->|"searches catalog"| node_innertube
node_screens -->|"browses moods"| node_moods
node_screens -->|"imports playlists"| node_piped
node_screens -->|"views and edits"| node_lyrics
node_screens -->|"selects music"| node_player
node_listener -->|"chooses device music"| node_local_library
node_local_library -->|"plays local tracks"| node_player
node_player_ui -->|"controls playback"| node_player
node_media_browser -->|"controls playback"| node_player
node_player -.->|"records playback"| node_database
node_player -->|"reads cached media"| node_cache
node_listener -->|"requests offline cache"| node_precache
node_precache -->|"writes media cache"| node_cache
node_listener -->|"manages library"| node_database
node_database -->|"stores songs"| node_song_model
node_database -->|"stores playlists"| node_playlist_model
node_screens -->|"stores search history"| node_database
node_listener -->|"customizes app"| node_settings
node_settings -.->|"configures data behavior"| node_preferences

click node_routes "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/Routes.kt"
click node_screens "https://github.com/bartoostveen/vitune/tree/master/app/src/main/kotlin/app/vitune/android/ui/screens"
click node_router "https://github.com/bartoostveen/vitune/blob/master/compose/routing/src/main/kotlin/app/vitune/compose/routing/RootRouter.kt"
click node_search "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/search/OnlineSearch.kt"
click node_innertube "https://github.com/bartoostveen/vitune/blob/master/providers/innertube/src/main/kotlin/app/vitune/providers/innertube/Innertube.kt"
click node_moods "https://github.com/bartoostveen/vitune/tree/master/app/src/main/kotlin/app/vitune/android/ui/screens/mood"
click node_piped "https://github.com/bartoostveen/vitune/blob/master/providers/piped/src/main/kotlin/app/vitune/providers/piped/Piped.kt"
click node_lyrics "https://github.com/bartoostveen/vitune/tree/master/providers"
click node_player "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/service/PlayerService.kt"
click node_media_browser "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/service/PlayerMediaBrowserService.kt"
click node_player_ui "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/player/Player.kt"
click node_precache "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/service/PrecacheService.kt"
click node_cache "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/utils/Cache.kt"
click node_local_library "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/home/HomeLocalSongs.kt"
click node_database "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/Database.kt"
click node_song_model "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/models/Song.kt"
click node_playlist_model "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/models/Playlist.kt"
click node_preferences "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/preferences/DataPreferences.kt"
click node_settings "https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/settings/SettingsScreen.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_routes,node_screens,node_router toneBlue
class node_search,node_innertube,node_moods,node_piped,node_lyrics toneAmber
class node_player,node_media_browser,node_player_ui,node_precache,node_cache toneMint
class node_local_library,node_database,node_song_model,node_playlist_model,node_preferences,node_settings toneRose
class node_listener toneIndigo
```

## Components

### App UI and navigation

- [Route definitions](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/Routes.kt): `app/src/main/kotlin/app/vitune/android/ui/screens/Routes.kt`
- [Browse and search screens](https://github.com/bartoostveen/vitune/tree/master/app/src/main/kotlin/app/vitune/android/ui/screens): `app/src/main/kotlin/app/vitune/android/ui/screens`
- [Compose router](https://github.com/bartoostveen/vitune/blob/master/compose/routing/src/main/kotlin/app/vitune/compose/routing/RootRouter.kt): `compose/routing/src/main/kotlin/app/vitune/compose/routing/RootRouter.kt`

### Music discovery

- [Online search](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/search/OnlineSearch.kt): `app/src/main/kotlin/app/vitune/android/ui/screens/search/OnlineSearch.kt`
- [YouTube Music API](https://github.com/bartoostveen/vitune/blob/master/providers/innertube/src/main/kotlin/app/vitune/providers/innertube/Innertube.kt): `providers/innertube/src/main/kotlin/app/vitune/providers/innertube/Innertube.kt`
- [Mood discovery](https://github.com/bartoostveen/vitune/tree/master/app/src/main/kotlin/app/vitune/android/ui/screens/mood): `app/src/main/kotlin/app/vitune/android/ui/screens/mood`
- [Piped playlists](https://github.com/bartoostveen/vitune/blob/master/providers/piped/src/main/kotlin/app/vitune/providers/piped/Piped.kt): `providers/piped/src/main/kotlin/app/vitune/providers/piped/Piped.kt`
- [Lyrics providers](https://github.com/bartoostveen/vitune/tree/master/providers): `providers`

### Playback and offline

- [Playback service](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/service/PlayerService.kt): `app/src/main/kotlin/app/vitune/android/service/PlayerService.kt`
- [Media browser](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/service/PlayerMediaBrowserService.kt): `app/src/main/kotlin/app/vitune/android/service/PlayerMediaBrowserService.kt`
- [Player screens](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/player/Player.kt): `app/src/main/kotlin/app/vitune/android/ui/screens/player/Player.kt`
- [Offline downloads](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/service/PrecacheService.kt): `app/src/main/kotlin/app/vitune/android/service/PrecacheService.kt`
- [Media cache](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/utils/Cache.kt): `app/src/main/kotlin/app/vitune/android/utils/Cache.kt`

### Library and settings

- [Local music](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/home/HomeLocalSongs.kt): `app/src/main/kotlin/app/vitune/android/ui/screens/home/HomeLocalSongs.kt`
- [Library database](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/Database.kt): `app/src/main/kotlin/app/vitune/android/Database.kt`
- [Song records](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/models/Song.kt): `app/src/main/kotlin/app/vitune/android/models/Song.kt`
- [Playlist records](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/models/Playlist.kt): `app/src/main/kotlin/app/vitune/android/models/Playlist.kt`
- [Data preferences](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/preferences/DataPreferences.kt): `app/src/main/kotlin/app/vitune/android/preferences/DataPreferences.kt`
- [Settings screens](https://github.com/bartoostveen/vitune/blob/master/app/src/main/kotlin/app/vitune/android/ui/screens/settings/SettingsScreen.kt): `app/src/main/kotlin/app/vitune/android/ui/screens/settings/SettingsScreen.kt`

### Other components

- **Listener**

## Connections

- Listener → Route definitions: opens features (evidence: `README.md`)
- Route definitions → Compose router: registers routes (evidence: `app/src/main/kotlin/app/vitune/android/ui/screens/Routes.kt`)
- Route definitions → Browse and search screens: dispatches to (evidence: `app/src/main/kotlin/app/vitune/android/ui/screens/Routes.kt`)
- Browse and search screens → Online search: offers search (evidence: `README.md`)
- Online search → YouTube Music API: searches catalog (evidence: `README.md`)
- Browse and search screens → Mood discovery: browses moods (evidence: `README.md`)
- Browse and search screens → Piped playlists: imports playlists (evidence: `README.md`)
- Browse and search screens → Lyrics providers: views and edits (evidence: `README.md`)
- Browse and search screens → Playback service: selects music (evidence: `README.md`)
- Listener → Local music: chooses device music (evidence: `README.md`)
- Local music → Playback service: plays local tracks (evidence: `README.md`)
- Player screens → Playback service: controls playback (evidence: `README.md`)
- Media browser → Playback service: controls playback (evidence: `app/src/main/kotlin/app/vitune/android/service/PlayerMediaBrowserService.kt`)
- Playback service → Library database: records playback (evidence: `app/src/main/kotlin/app/vitune/android/service/PlayerService.kt`)
- Playback service → Media cache: reads cached media (evidence: `app/src/main/kotlin/app/vitune/android/service/PlayerService.kt`)
- Listener → Offline downloads: requests offline cache (evidence: `README.md`)
- Offline downloads → Media cache: writes media cache (evidence: `app/src/main/kotlin/app/vitune/android/service/PrecacheService.kt`)
- Listener → Library database: manages library (evidence: `README.md`)
- Library database → Song records: stores songs (evidence: `app/src/main/kotlin/app/vitune/android/Database.kt`)
- Library database → Playlist records: stores playlists (evidence: `app/src/main/kotlin/app/vitune/android/Database.kt`)
- Browse and search screens → Library database: stores search history (evidence: `app/src/main/kotlin/app/vitune/android/ui/screens/Routes.kt`)
- Listener → Settings screens: customizes app (evidence: `README.md`)
- Settings screens → Data preferences: configures data behavior
