# cisumapp/cisum architecture

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

- Interactive diagram: https://gitdiagram.com/cisumapp/cisum
- Repository: https://github.com/cisumapp/cisum

## Overview

#### Purpose and entry points
Cisum is a modular Swift/SwiftUI music client for iOS and macOS. Platform app targets start in `iOS/cisum/iOSApp.swift` and `macOS/cisum/macOSApp.swift`, then delegate composition and root UI to Core. iOS also ships a lyrics widget/Live Activity extension under `iOS/Lyrics/LyricsLiveActivity.swift`.

#### Application composition and navigation
Core owns application bootstrapping, dependency/service composition, root presentation, navigation state, and deep-link handling. Feature modules should integrate through this boundary rather than construct global services directly.
- `Modules/Core/Sources/Core/AppBootstrap.swift`
- `Modules/Core/Sources/Core/ServicesContainer.swift`
- `Modules/Core/Sources/Core/RootView.swift`
- `Modules/Core/Sources/Core/AppRouter.swift`
- `Modules/Core/Sources/Core/DeepLinkCoordinator.swift`

#### Shared domain and platform foundations
Shared Swift packages define the cross-feature media, provider, playlist, import, playback, and deep-link contracts. Networking centralizes HTTP/auth, Supabase integration, connectivity, and update checks; caching holds reusable media and resolved-playback URL state. These packages form the boundary between feature UI/orchestration and remote or persistent behavior.
- `Modules/Shared/Models/Sources/Models/MediaProvider.swift`
- `Modules/Shared/Models/Sources/Models/MediaRefs.swift`
- `Modules/Shared/Models/Sources/Models/Playlists/Playlist.swift`
- `Modules/Shared/Networking/Sources/Networking/NetworkingClient.swift`
- `Modules/Shared/Networking/Sources/Networking/SupabaseService.swift`
- `Modules/Shared/Caching/Sources/Caching/MediaCacheStore.swift`

#### Playback pipeline
Player is the primary stateful runtime subsystem. `PlayerViewModel` coordinates queue, loading, fallback, audio session, lyrics, artwork, and UI presentation. `PlaybackEngine` drives AVPlayer-level playback; queue persistence restores state; resolvers translate provider media references into playable URLs, including YouTube and provider SDK paths. Player state feeds mini/expanded player UI and likely the lyrics extension.
- `Modules/Features/Player/Sources/Player/PlayerViewModel.swift`
- `Modules/Features/Player/Sources/Player/Controllers/PlaybackEngine.swift`
- `Modules/Features/Player/Sources/Player/Controllers/QueueManager.swift`
- `Modules/Features/Player/Sources/Player/PlaybackURLResolver.swift`
- `Modules/Features/Player/Sources/Player/QueuePersistenceStore.swift`
- `Modules/Features/Player/Sources/Player/PlayerModule.swift`

#### Discovery, search, and content presentation
Home, Discover, Search, and media-detail modules provide browsing and federated lookup over shared models/providers. Search has its own overlay/controller and history/cache-hint persistence, then results navigate into track, album, artist, and playlist detail wrappers. Reusable visual primitives live separately in Aesthetics.
- `Modules/Features/Search/Sources/Search/SearchViewModel.swift`
- `Modules/Features/Search/Sources/Search/SearchOverlayController.swift`
- `Modules/Features/Home/Sources/Home/HomeModule.swift`
- `Modules/Features/Albums/Sources/Albums/AlbumDetailWrapper.swift`
- `Modules/Features/Artists/Sources/Artists/ArtistDetailWrapper.swift`
- `Modules/Shared/Aesthetics/Sources/Aesthetics/UI/ArtworkPipeline.swift`

#### Library, playlists, and import/reconciliation
Library manages central media and playlist-facing state. Imports are provider-specific adapters (Apple Music, Spotify, YouTube, local files) selected by a factory and surfaced through progress services/UI. Imported tracks are normalized/reconciled through shared canonical import models before becoming library or playlist data. Playlist-specific stores also support import jobs and share links.
- `Modules/Features/Library/Sources/Library/CentralMediaStore.swift`
- `Modules/Features/Library/Sources/Library/Importing/ImportServicesFactory.swift`
- `Modules/Features/Library/Sources/Library/Importing/ImportProgressFacade.swift`
- `Modules/Shared/Models/Sources/Models/Import/CanonicalSongReconciler.swift`
- `Modules/Features/Playlists/Sources/Playlists/PlaylistLibraryStore.swift`
- `Modules/Features/Playlists/Sources/Playlists/PlaylistShareLink.swift`

#### Identity, providers, and extensions
Authentication supports Apple sign-in plus persisted YouTube credentials in Keychain. Plugins configure streaming-provider manifests, Spotify session/cache, and Last.fm scrobbling. Radio combines Spotify and YouTube sources through a hybrid provider; Profile maintains listening history and analytics. External integrations materially include Apple Music, Spotify, YouTube, Last.fm, Supabase, AVFoundation, Keychain, and platform audio/media APIs.
- `Modules/Features/Authentication/Sources/Authentication/AuthService.swift`
- `Modules/Features/Authentication/Sources/Authentication/KeychainYouTubeStorage.swift`
- `Modules/Features/Plugins/Sources/Plugins/SpotifySessionCoordinator.swift`
- `Modules/Features/Plugins/Sources/Plugins/LastFMScrobbler.swift`
- `Modules/Features/Radio/Sources/Radio/HybridRadioProvider.swift`
- `Modules/Features/Profile/Sources/Profile/ListeningHistoryStore.swift`

Main entry points: [`Modules/Features/Player/Sources/Player/PlayerViewModel.swift`](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Player/Sources/Player/PlayerViewModel.swift) (Player Runtime), [`Modules/Core/Sources/Core/ServicesContainer.swift`](https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/ServicesContainer.swift) (Services Container), [`Modules/Core/Sources/Core/AppBootstrap.swift`](https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/AppBootstrap.swift) (App Bootstrap), [`Modules/Features/Search/Sources/Search/SearchViewModel.swift`](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Search/Sources/Search/SearchViewModel.swift) (Discovery & Search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["App Targets"]
  node_ios_app["iOS App<br/>SwiftUI target<br/>[iOSApp.swift]"]
  node_macos_app["macOS App<br/>SwiftUI target<br/>[macOSApp.swift]"]
  node_lyrics_extension["Lyrics Live Activity<br/>iOS extension"]
end

subgraph group_core["Composition"]
  node_bootstrap["App Bootstrap<br/>composition root<br/>[AppBootstrap.swift]"]
  node_services["Services Container<br/>dependency composition"]
  node_root_ui["Root UI<br/>root presentation<br/>[RootView.swift]"]
  node_router["Router &amp; Deep Links<br/>navigation coordinator"]
end

subgraph group_shared["Shared Foundations"]
  node_models["Domain Models<br/>shared contracts"]
  node_networking["Networking<br/>remote services"]
  node_cache[("Media Cache<br/>cache store")]
end

subgraph group_features["Feature Systems"]
  node_player["Player Runtime<br/>playback orchestration"]
  node_playback_engine["Playback Engine<br/>AVPlayer controller"]
  node_url_resolver["Playback URL Resolver<br/>media resolver"]
  node_discovery["Discovery &amp; Search<br/>browse and lookup UI"]
  node_library_import["Library &amp; Import<br/>media state and import"]
  node_playlists[("Playlists<br/>playlist store")]
  node_identity_plugins["Identity &amp; Provider Plugins<br/>provider integration<br/>[AuthService.swift]"]
  node_radio_profile["Radio &amp; Profile<br/>recommendations and history"]
end

subgraph group_external["External Platforms"]
  node_platforms{{"Music &amp; Platform APIs<br/>external integrations"}}
end

node_ios_app -->|"starts"| node_bootstrap
node_macos_app -->|"starts"| node_bootstrap
node_bootstrap -->|"composes"| node_services
node_bootstrap -->|"presents"| node_root_ui
node_root_ui -->|"navigates via"| node_router
node_services -->|"provides"| node_player
node_services -->|"provides"| node_discovery
node_services -->|"provides"| node_library_import
node_services -->|"provides"| node_identity_plugins
node_router -->|"routes to"| node_discovery
node_discovery -->|"uses"| node_models
node_discovery -->|"plays selections"| node_player
node_library_import -->|"reconciles into"| node_models
node_library_import -->|"imports into"| node_playlists
node_playlists -->|"uses"| node_models
node_player -->|"controls"| node_playback_engine
node_player -->|"resolves media through"| node_url_resolver
node_player -->|"reads and writes"| node_cache
node_url_resolver -->|"requests URLs"| node_networking
node_identity_plugins -->|"configures access"| node_networking
node_networking -->|"integrates"| node_platforms
node_identity_plugins -->|"authenticates and streams"| node_platforms
node_radio_profile -->|"uses provider sessions"| node_identity_plugins
node_lyrics_extension -.->|"consumes player state"| node_player

click node_ios_app "https://github.com/cisumapp/cisum/blob/main/iOS/cisum/iOSApp.swift"
click node_macos_app "https://github.com/cisumapp/cisum/blob/main/macOS/cisum/macOSApp.swift"
click node_lyrics_extension "https://github.com/cisumapp/cisum/blob/main/iOS/Lyrics/LyricsLiveActivity.swift"
click node_bootstrap "https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/AppBootstrap.swift"
click node_services "https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/ServicesContainer.swift"
click node_root_ui "https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/RootView.swift"
click node_router "https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/DeepLinkCoordinator.swift"
click node_models "https://github.com/cisumapp/cisum/blob/main/Modules/Shared/Models/Sources/Models/MediaProvider.swift"
click node_networking "https://github.com/cisumapp/cisum/blob/main/Modules/Shared/Networking/Sources/Networking/NetworkingClient.swift"
click node_cache "https://github.com/cisumapp/cisum/blob/main/Modules/Shared/Caching/Sources/Caching/MediaCacheStore.swift"
click node_player "https://github.com/cisumapp/cisum/blob/main/Modules/Features/Player/Sources/Player/PlayerViewModel.swift"
click node_playback_engine "https://github.com/cisumapp/cisum/blob/main/Modules/Features/Player/Sources/Player/Controllers/PlaybackEngine.swift"
click node_url_resolver "https://github.com/cisumapp/cisum/blob/main/Modules/Features/Player/Sources/Player/PlaybackURLResolver.swift"
click node_discovery "https://github.com/cisumapp/cisum/blob/main/Modules/Features/Search/Sources/Search/SearchViewModel.swift"
click node_library_import "https://github.com/cisumapp/cisum/blob/main/Modules/Features/Library/Sources/Library/Importing/ImportServicesFactory.swift"
click node_playlists "https://github.com/cisumapp/cisum/blob/main/Modules/Features/Playlists/Sources/Playlists/PlaylistLibraryStore.swift"
click node_identity_plugins "https://github.com/cisumapp/cisum/blob/main/Modules/Features/Authentication/Sources/Authentication/AuthService.swift"
click node_radio_profile "https://github.com/cisumapp/cisum/blob/main/Modules/Features/Radio/Sources/Radio/HybridRadioProvider.swift"

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_ios_app,node_macos_app,node_lyrics_extension toneBlue
class node_bootstrap,node_services,node_root_ui,node_router toneAmber
class node_models,node_networking,node_cache toneMint
class node_player,node_playback_engine,node_url_resolver,node_discovery,node_library_import,node_playlists,node_identity_plugins,node_radio_profile toneRose
class node_platforms toneIndigo
```

## Components

### App Targets

- [iOS App](https://github.com/cisumapp/cisum/blob/main/iOS/cisum/iOSApp.swift): SwiftUI target · `iOS/cisum/iOSApp.swift`
- [macOS App](https://github.com/cisumapp/cisum/blob/main/macOS/cisum/macOSApp.swift): SwiftUI target · `macOS/cisum/macOSApp.swift`
- [Lyrics Live Activity](https://github.com/cisumapp/cisum/blob/main/iOS/Lyrics/LyricsLiveActivity.swift): iOS extension · `iOS/Lyrics/LyricsLiveActivity.swift`

### Composition

- [App Bootstrap](https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/AppBootstrap.swift): composition root · `Modules/Core/Sources/Core/AppBootstrap.swift`
- [Services Container](https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/ServicesContainer.swift): dependency composition · `Modules/Core/Sources/Core/ServicesContainer.swift`
- [Root UI](https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/RootView.swift): root presentation · `Modules/Core/Sources/Core/RootView.swift`
- [Router & Deep Links](https://github.com/cisumapp/cisum/blob/main/Modules/Core/Sources/Core/DeepLinkCoordinator.swift): navigation coordinator · `Modules/Core/Sources/Core/DeepLinkCoordinator.swift`

### Shared Foundations

- [Domain Models](https://github.com/cisumapp/cisum/blob/main/Modules/Shared/Models/Sources/Models/MediaProvider.swift): shared contracts · Media, providers, playlists, imports, and deep links. · `Modules/Shared/Models/Sources/Models/MediaProvider.swift`
- [Networking](https://github.com/cisumapp/cisum/blob/main/Modules/Shared/Networking/Sources/Networking/NetworkingClient.swift): remote services · HTTP, authentication, Supabase, connectivity, and updates. · `Modules/Shared/Networking/Sources/Networking/NetworkingClient.swift`
- [Media Cache](https://github.com/cisumapp/cisum/blob/main/Modules/Shared/Caching/Sources/Caching/MediaCacheStore.swift): cache store · Caches media and resolved playback URLs. · `Modules/Shared/Caching/Sources/Caching/MediaCacheStore.swift`

### Feature Systems

- [Player Runtime](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Player/Sources/Player/PlayerViewModel.swift): playback orchestration · Coordinates queue, loading, fallback, audio, lyrics, artwork, and player UI. · `Modules/Features/Player/Sources/Player/PlayerViewModel.swift`
- [Playback Engine](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Player/Sources/Player/Controllers/PlaybackEngine.swift): AVPlayer controller · `Modules/Features/Player/Sources/Player/Controllers/PlaybackEngine.swift`
- [Playback URL Resolver](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Player/Sources/Player/PlaybackURLResolver.swift): media resolver · Resolves provider references to playable URLs. · `Modules/Features/Player/Sources/Player/PlaybackURLResolver.swift`
- [Discovery & Search](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Search/Sources/Search/SearchViewModel.swift): browse and lookup UI · Federated search routes results to media details. · `Modules/Features/Search/Sources/Search/SearchViewModel.swift`
- [Library & Import](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Library/Sources/Library/Importing/ImportServicesFactory.swift): media state and import · Selects provider adapters and normalizes imported tracks. · `Modules/Features/Library/Sources/Library/Importing/ImportServicesFactory.swift`
- [Playlists](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Playlists/Sources/Playlists/PlaylistLibraryStore.swift): playlist store · Maintains playlist data, import jobs, and share links. · `Modules/Features/Playlists/Sources/Playlists/PlaylistLibraryStore.swift`
- [Identity & Provider Plugins](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Authentication/Sources/Authentication/AuthService.swift): provider integration · Apple sign-in, YouTube credentials, Spotify session, and Last.fm scrobbling. · `Modules/Features/Authentication/Sources/Authentication/AuthService.swift`
- [Radio & Profile](https://github.com/cisumapp/cisum/blob/main/Modules/Features/Radio/Sources/Radio/HybridRadioProvider.swift): recommendations and history · Combines Spotify/YouTube radio with listening history. · `Modules/Features/Radio/Sources/Radio/HybridRadioProvider.swift`

### External Platforms

- **Music & Platform APIs**: external integrations · Apple Music, Spotify, YouTube, Last.fm, Supabase, AVFoundation, Keychain, and media APIs.

## Connections

- iOS App → App Bootstrap: starts
- macOS App → App Bootstrap: starts
- App Bootstrap → Services Container: composes
- App Bootstrap → Root UI: presents
- Root UI → Router & Deep Links: navigates via
- Services Container → Player Runtime: provides
- Services Container → Discovery & Search: provides
- Services Container → Library & Import: provides
- Services Container → Identity & Provider Plugins: provides
- Router & Deep Links → Discovery & Search: routes to
- Discovery & Search → Domain Models: uses
- Discovery & Search → Player Runtime: plays selections
- Library & Import → Domain Models: reconciles into
- Library & Import → Playlists: imports into
- Playlists → Domain Models: uses
- Player Runtime → Playback Engine: controls
- Player Runtime → Playback URL Resolver: resolves media through
- Player Runtime → Media Cache: reads and writes
- Playback URL Resolver → Networking: requests URLs
- Identity & Provider Plugins → Networking: configures access
- Networking → Music & Platform APIs: integrates
- Identity & Provider Plugins → Music & Platform APIs: authenticates and streams
- Radio & Profile → Identity & Provider Plugins: uses provider sessions
- Lyrics Live Activity → Player Runtime: consumes player state
