How creepsooff/nuviodesktop works
1. What this repo is
- Nuvio is a Kotlin Multiplatform / Compose Multiplatform media client.
- The core product is shared across Android, iOS, and desktop, with native entry points and platform adapters.
- It is not a backend service; it is a client app that aggregates metadata, addon content, watch state, downloads, and playback.
2. Top-level architectural split
- composeApp/src/commonMain holds most of the shared UI, feature logic, repositories, and domain models.
- Platform-specific source sets (androidMain, iosMain, desktopMain, plus androidFull, iosFull, androidPlaystore, iosAppStore) provide OS integrations, storage, playback backends, notifications, and build-variant policy.
- iosApp/ is a separate native Xcode shell around the shared Kotlin app.
- Docs/Stremio addons refer/ documents the addon protocol the app is built around.
3. Shared core layer
- core/ provides app-wide primitives: auth, networking, storage, sync, UI theming, i18n, deeplinks, and build policy.
- Important abstractions include:
- AuthStorage / AuthRepository
- NetworkStatusRepository
- SyncManager / ProfileSettingsSync
- PlatformImageLoader, PlatformBackHandler, PlatformExitApp
- This layer is where cross-platform behavior is normalized before being specialized per OS.
4. Feature-driven UI and domain organization
- The app is organized by feature modules rather than technical layers.
- Major feature areas are:
- Home and catalog browsing
- Search
- Details pages
- Player
- Streams
- Downloads
- Library
- Collections
- Profiles
- Settings
- Watched / Watch progress
- Notifications
- Each feature usually has a Repository, Models, and one or more Compose screens/components.
5. Content discovery and metadata flow
- Discovery starts in Home, Search, Catalog, and Details.
- Metadata can come from TMDb, Trakt, MDBList, and addon-derived catalogs.
- The details pipeline includes parsing and shaping metadata via repositories like:
- TmdbMetadataService
- MetaDetailsRepository
- Trakt*Repository classes
- MdbListMetadataService
- UI screens consume normalized models, not provider-specific payloads.
6. Stremio addon ecosystem boundary
- Addons are a first-class integration point.
- Shared addon code parses manifests and content IDs, then resolves addon capabilities into catalog/meta/stream/resource behavior.
- The repo includes a dedicated Docs/Stremio addons refer/ area, which matches the code’s role as a Stremio addon-compatible client.
- Platform source sets supply the “addon platform” pieces needed for networking, crypto, and runtime support.
7. Playback architecture
- Playback is centered around features/player.
- Shared player logic handles:
- track selection
- subtitles/audio modes
- player layout and overlays
- intro skip / next-episode rules
- runtime tracing and preferences
- Platform-specific backends connect shared player state to actual media engines:
- Android uses Media3/ExoPlayer-related integrations.
- iOS bridges to native playback via AVFoundation-style integration.
- Desktop supports both mpv and a native bridge backend.
- Stream resolution happens before playback through StreamsRepository, StreamParser, and autoplay selection logic.
8. Stream resolution and launch flow
- Streams are treated as a separate subsystem from player rendering.
- The flow is roughly:
- content/detail selection
- stream link parsing and caching
- autoplay policy selection
- launch context storage
- handoff to the player backend
- StreamLinkCache*, StreamContextStore, and StreamLaunchStore indicate the app deliberately separates stream discovery from playback execution.
9. Watch state, progress, and syncing
- The app maintains two related but distinct state families:
- Watched state
- Watch progress / continue watching
- These are managed by repositories, rules, and storage layers in features/watched and features/watchprogress.
- Sync adapters bridge local state to external services:
- Supabase
- Trakt
- SyncManager and SyncPlatform suggest sync is coordinated centrally, then fanned out through provider-specific adapters.
10. Downloads and notifications
- Downloads are a separate subsystem with storage, live status, and platform downloader implementations.
- Android includes notification receivers/workers for background progress updates.
- iOS includes a Downloads Widget / Live Activity extension in iosApp/DownloadsWidgetExtension.
- This implies a split between:
- shared download state and UI
- platform execution and notification surfaces
11. Profiles, auth, and local persistence
- Profiles are strongly scoped and backed by local storage plus crypto helpers for secrets/PINs.
- Auth and profile data are persisted through platform-specific storages in each OS source set.
- LocalAccountDataCleaner and ProfileScopedKey show the app manages per-profile local data separation rather than one global account blob.
12. Platform-specific architecture boundaries
- androidMain, iosMain, and desktopMain supply the concrete implementation of:
- storage
- UI affordances
- foreground/background monitoring
- image loading
- app lifecycle/back navigation
- updater hooks
- androidFull / iosFull and store-specific variants imply feature gating by build target, not just by OS.
- AppFeaturePolicy.* files are the key switchboard for what features are available in each distribution.
13. Desktop-specific runtime
- Desktop has its own runtime shell: window state, URI handling, single-instance management, and native bootstrap code.
- Player backends are more elaborate here, with both mpv and native bridge implementations.
- This makes desktop the most infrastructure-heavy target in terms of runtime orchestration.
14. Testing and validation
- commonTest contains broad unit coverage for parsers, rules, repositories, and UI helpers.
- Tests focus on domain behavior and data transformations, which fits the app’s architecture: shared logic is meant to be portable and testable outside the platform layers.
15. How to draw the architecture
- A good diagram would show:
- Shared Compose app in the center
- feature modules radiating out from it
- platform adapters on the sides for Android, iOS, and desktop
- external services at the edge: Stremio addons, TMDb, Trakt, MDBList, Supabase
- playback engines and download/notification systems as separate platform-bound execution paths
- The main data flow is: UI → repository/domain logic → local storage and external services → normalized models → UI, with playback and sync as the two major side-effect-heavy pipelines.
Main entry points: features Features · player Player · settings Settings · addons Addons
Components 22
Shared app
Multiplatform Kotlin app with common UI, domain logic, and feature modules.
- Compose app · Shared Compose Multiplatform application entry and top-level UI composition.
composeApp/src/commonMain/kotlin/com/nuvio/app/App.kt - Core · Cross-cutting app primitives for auth, networking, storage, sync, theming, i18n, deeplinks, and platform abstraction.
composeApp/src/commonMain/kotlin/com/nuvio/app/core - Features · Feature-driven shared screens, repositories, models, and flows.
composeApp/src/commonMain/kotlin/com/nuvio/app/features - Home · Homepage, catalog definitions, and continue-watching surfacing.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/home - Search · Search history and discovery entry point for content lookup.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/search - Details · Metadata shaping, detail pages, series rules, trailers, and related content views.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/details - Streams · Stream parsing, cache, autoplay policy, and launch context management before playback.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/streams - Player · Shared playback state, controls, subtitles, track selection, skip rules, and runtime tracing.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/player - Downloads · Shared download state, repository, storage, and live status coordination.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/downloads - Watching · Watched and watch-progress logic, rules, and sync adapters for continuity.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/watching - Profiles · Profile selection, PIN handling, avatars, and per-profile storage boundaries.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/profiles - Settings · Feature gating, integrations, playback, appearance, notifications, and provider settings.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/settings - Addons · Addon manifest parsing, repository, transport URLs, and addon-facing screens.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/addons
Platform targets
Android, iOS, and desktop entry points plus OS-specific adapters and runtimes.
- Android · Android entry point, storage, lifecycle, notifications, downloads, and Media3/ExoPlayer playback bindings.
composeApp/src/androidMain/kotlin/com/nuvio/app/MainActivity.kt - iOS · iOS entry point, native storage, foreground monitoring, playback bridge, and widget/live activity support.
composeApp/src/iosMain/kotlin/com/nuvio/app/MainViewController.kt - Desktop · Desktop bootstrap, window/URI handling, single-instance management, and player backend orchestration.
composeApp/src/desktopMain/kotlin/com/nuvio/app/DesktopApp.kt
External services
Metadata, sync, addon, and playback dependencies the client integrates with.
- TMDb · TMDb service and settings used for metadata enrichment and browsing.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/tmdb - Trakt · Trakt auth, comments, library, scrobble, progress, and list integration.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/trakt - MDBList · MDBList metadata/settings used for list-driven discovery.
composeApp/src/commonMain/kotlin/com/nuvio/app/features/mdblist - Supabase · Remote backend used by sync and watched/progress adapters.
composeApp/src/commonMain/kotlin/com/nuvio/app/core/network/SupabaseProvider.kt - Addon docs · Reference documentation for the Stremio addon protocol and deep-link behavior.
Docs/Stremio addons refer/README.md
Native iOS shell
Swift/Xcode host and iOS-only extension surfaces around the shared app.
- iOS shell · Native Xcode wrapper around the shared Kotlin app plus iOS-specific extensions and player bridge.
iosApp/iosApp/iOSApp.swift
Connections 35
- Compose app → Core: uses · Top-level UI depends on shared app primitives.
- Compose app → Features: composes · Shared app composes feature modules.
- Features → Home: includes · Home is a major feature area.
- Features → Search: includes · Search is a major feature area.
- Features → Details: includes · Details and metadata are a major feature area.
- Features → Streams: includes · Stream discovery and launch are a major feature area.
- Features → Player: includes · Playback is a major feature area.
- Features → Downloads: includes · Downloads are a major feature area.
- Features → Watching: includes · Watched and progress tracking are a major feature area.
- Features → Profiles: includes · Profiles and auth scope are a major feature area.
- Features → Settings: includes · Settings organize most app configuration.
- Features → Addons: includes · Addon integration is a first-class feature boundary.
- Home → TMDb: reads metadata · Home catalogs can be enriched by TMDb.
- Search → Addons: discovers · Search can route through addon content.
- Details → TMDb: normalizes · Details resolve metadata through TMDb.
- Details → Trakt: enriches · Details consume Trakt comments, lists, and related data.
- Streams → Addons: resolves streams · Streams come from addon-derived capabilities and content IDs.
- Player → Streams: consumes · Player receives resolved streams and launch context.
- Watching → Trakt: syncs · Watched/progress state syncs to Trakt.
- Watching → Supabase: syncs · Watched/progress state also syncs through Supabase adapters.
- Settings → TMDb: configures · Settings include TMDb integration.
- Settings → Trakt: configures · Settings include Trakt integration.
- Settings → MDBList: configures · Settings include MDBList integration.
- Settings → Addons: configures · Settings manage addon behavior.
- Android → Player: binds engine · Android connects shared playback logic to Media3/ExoPlayer integrations.
- Android → Downloads: runs downloads · Android provides downloader, live status, and notification surfaces.
- Android → Core: implements · Android supplies platform-specific core adapters.
- iOS → Player: binds engine · iOS bridges shared playback logic to native playback.
- iOS → Downloads: runs downloads · iOS supplies download live-activity surfaces and storage.
- iOS → Core: implements · iOS supplies platform-specific core adapters.
- Desktop → Player: binds engine · Desktop orchestrates mpv and native bridge player backends.
- Desktop → Core: implements · Desktop supplies runtime, windowing, and lifecycle adapters.
- iOS shell → iOS: hosts · Native Swift shell embeds the shared iOS target.
- iOS shell → Player: bridges player · Swift player bridge connects to shared playback.
- Addon docs → Addons: documents · Protocol docs describe the addon boundary implemented in code.