# acronymuz/cpotify architecture

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

- Interactive diagram: https://gitdiagram.com/acronymuz/cpotify
- Repository: https://github.com/acronymuz/cpotify

## Overview

Cpotify is an Android Spotify client combining a Vue interface, Spotify authentication/catalog access, and Web Playback SDK streaming with native Android background playback controls. The main user flow is login and callback, authenticated navigation to listening and discovery views, then playback through the SDK with state reflected in the player UI and native media session. Android also hosts Spotify’s web player and handles ad-resume/accessibility behavior. The source index and README support the major feature branches; unsampled implementation details and some native/plugin wiring are not asserted beyond documented or indexed relationships.

Main entry points: [`src/router/index.ts`](https://github.com/acronymuz/cpotify/blob/main/src/router/index.ts) (Route Guard), [`src/stores/auth.ts`](https://github.com/acronymuz/cpotify/blob/main/src/stores/auth.ts) (Auth Store), [`src/services/spotifyApi.ts`](https://github.com/acronymuz/cpotify/blob/main/src/services/spotifyApi.ts) (Spotify API), [`src/composables/usePlaybackSDK.ts`](https://github.com/acronymuz/cpotify/blob/main/src/composables/usePlaybackSDK.ts) (Web Playback SDK)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Experience"]
  node_app["App Shell<br/>[App.vue]"]
  node_router["Route Guard<br/>[index.ts]"]
  node_login["Login View<br/>[LoginView.vue]"]
  node_callback["OAuth Callback<br/>[CallbackView.vue]"]
  node_home["Home View<br/>[HomeView.vue]"]
  node_search["Search View<br/>[SearchView.vue]"]
  node_library["Library View<br/>[LibraryView.vue]"]
  node_detailviews["Media Details"]
  node_settings["Settings View<br/>[SettingsView.vue]"]
  node_playerbar["Player Bar<br/>[PlayerBar.vue]"]
end

subgraph group_spotify["Spotify Access"]
  node_auth["Auth Store<br/>[auth.ts]"]
  node_spotifyapi["Spotify API<br/>[spotifyApi.ts]"]
  node_spotifytypes["Spotify Models<br/>[spotify.ts]"]
end

subgraph group_playback["Playback"]
  node_playerstore["Player Store<br/>[player.ts]"]
  node_sdk["Web Playback SDK<br/>[usePlaybackSDK.ts]"]
  node_nativecontrols["Native Controls Hook"]
end

subgraph group_android["Android Runtime"]
  node_activity["Main Activity<br/>[MainActivity.java]"]
  node_webhost["Android Web Host<br/>[WebPlayerHost.java]"]
  node_adblock["Ad Block Rules<br/>[AdBlockRules.java]"]
  node_media["Playback Service"]
  node_accessibility["Resume Accessibility"]
end

subgraph group_bridge["Native Bridge"]
  node_bridgeplugin["Bridge Plugin"]
  node_bridgewebhost["Plugin Web Host<br/>[WebPlayerHost.java]"]
  node_bridgeapi["Bridge API<br/>[definitions.ts]"]
end

node_user(("Listener"))
node_spotify{{"Spotify Platform"}}
node_preferences[("Preferences")]

node_user -->|"uses"| node_app
node_app -->|"renders routes"| node_router
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_callback
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_search
node_router -->|"routes to"| node_library
node_router -->|"routes to"| node_detailviews
node_router -->|"routes to"| node_settings
node_login -->|"starts login"| node_auth
node_callback -->|"completes login"| node_auth
node_auth -->|"authenticates"| node_spotify
node_auth -->|"persists tokens"| node_preferences
node_auth -->|"uses models"| node_spotifytypes
node_home -->|"fetches content"| node_spotifyapi
node_search -->|"searches catalog"| node_spotifyapi
node_library -->|"loads library"| node_spotifyapi
node_detailviews -->|"loads details"| node_spotifyapi
node_spotifyapi -->|"gets token"| node_auth
node_spotifyapi -->|"calls API"| node_spotify
node_spotifyapi -->|"uses models"| node_spotifytypes
node_app -->|"initializes playback"| node_sdk
node_app -->|"reads playback state"| node_playerstore
node_app -->|"renders controls"| node_playerbar
node_sdk -->|"gets credentials"| node_auth
node_sdk -->|"syncs playback"| node_playerstore
node_sdk -->|"streams audio"| node_spotify
node_playerbar -->|"reads state"| node_playerstore
node_playerbar -->|"controls playback"| node_sdk
node_nativecontrols -->|"reads state"| node_playerstore
node_nativecontrols -->|"invokes controls"| node_sdk
node_playerstore -->|"stores settings"| node_preferences
node_activity -->|"creates host"| node_webhost
node_activity -->|"updates media"| node_media
node_activity -->|"requests resume"| node_accessibility
node_webhost -->|"uses rules"| node_adblock
node_media -->|"downloads artwork"| node_spotify
node_media -->|"shows media controls"| node_user
node_activity -.->|"integrates bridge"| node_bridgeplugin
node_bridgeplugin -->|"uses host"| node_bridgewebhost
node_bridgeplugin -.->|"implements API"| node_bridgeapi

click node_app "https://github.com/acronymuz/cpotify/blob/main/src/App.vue"
click node_router "https://github.com/acronymuz/cpotify/blob/main/src/router/index.ts"
click node_login "https://github.com/acronymuz/cpotify/blob/main/src/views/LoginView.vue"
click node_callback "https://github.com/acronymuz/cpotify/blob/main/src/views/CallbackView.vue"
click node_home "https://github.com/acronymuz/cpotify/blob/main/src/views/HomeView.vue"
click node_search "https://github.com/acronymuz/cpotify/blob/main/src/views/SearchView.vue"
click node_library "https://github.com/acronymuz/cpotify/blob/main/src/views/LibraryView.vue"
click node_detailviews "https://github.com/acronymuz/cpotify/tree/main/src/views"
click node_settings "https://github.com/acronymuz/cpotify/blob/main/src/views/SettingsView.vue"
click node_playerbar "https://github.com/acronymuz/cpotify/blob/main/src/components/PlayerBar.vue"
click node_auth "https://github.com/acronymuz/cpotify/blob/main/src/stores/auth.ts"
click node_spotifyapi "https://github.com/acronymuz/cpotify/blob/main/src/services/spotifyApi.ts"
click node_spotifytypes "https://github.com/acronymuz/cpotify/blob/main/src/types/spotify.ts"
click node_playerstore "https://github.com/acronymuz/cpotify/blob/main/src/stores/player.ts"
click node_sdk "https://github.com/acronymuz/cpotify/blob/main/src/composables/usePlaybackSDK.ts"
click node_nativecontrols "https://github.com/acronymuz/cpotify/blob/main/src/composables/useNativeMediaControls.ts"
click node_activity "https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/MainActivity.java"
click node_webhost "https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/myspoti/WebPlayerHost.java"
click node_adblock "https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/myspoti/AdBlockRules.java"
click node_media "https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/MediaPlaybackService.java"
click node_accessibility "https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/ResumeAccessibilityService.java"
click node_bridgeplugin "https://github.com/acronymuz/cpotify/blob/main/plugins/myspoti-bridge/src/android/main/java/com/cpotify/app/myspoti/MyspotiBridgePlugin.java"
click node_bridgewebhost "https://github.com/acronymuz/cpotify/blob/main/plugins/myspoti-bridge/src/android/main/java/com/cpotify/app/myspoti/WebPlayerHost.java"
click node_bridgeapi "https://github.com/acronymuz/cpotify/blob/main/plugins/myspoti-bridge/src/definitions.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_app,node_router,node_login,node_callback,node_home,node_search,node_library,node_detailviews,node_settings,node_playerbar toneBlue
class node_auth,node_spotifyapi,node_spotifytypes,node_preferences toneAmber
class node_playerstore,node_sdk,node_nativecontrols toneMint
class node_activity,node_webhost,node_adblock,node_media,node_accessibility toneRose
class node_bridgeplugin,node_bridgewebhost,node_bridgeapi,node_user,node_spotify toneIndigo
```

## Components

### Web Experience

- [App Shell](https://github.com/acronymuz/cpotify/blob/main/src/App.vue): `src/App.vue`
- [Route Guard](https://github.com/acronymuz/cpotify/blob/main/src/router/index.ts): `src/router/index.ts`
- [Login View](https://github.com/acronymuz/cpotify/blob/main/src/views/LoginView.vue): `src/views/LoginView.vue`
- [OAuth Callback](https://github.com/acronymuz/cpotify/blob/main/src/views/CallbackView.vue): `src/views/CallbackView.vue`
- [Home View](https://github.com/acronymuz/cpotify/blob/main/src/views/HomeView.vue): `src/views/HomeView.vue`
- [Search View](https://github.com/acronymuz/cpotify/blob/main/src/views/SearchView.vue): `src/views/SearchView.vue`
- [Library View](https://github.com/acronymuz/cpotify/blob/main/src/views/LibraryView.vue): `src/views/LibraryView.vue`
- [Media Details](https://github.com/acronymuz/cpotify/tree/main/src/views): `src/views`
- [Settings View](https://github.com/acronymuz/cpotify/blob/main/src/views/SettingsView.vue): `src/views/SettingsView.vue`
- [Player Bar](https://github.com/acronymuz/cpotify/blob/main/src/components/PlayerBar.vue): `src/components/PlayerBar.vue`

### Spotify Access

- [Auth Store](https://github.com/acronymuz/cpotify/blob/main/src/stores/auth.ts): `src/stores/auth.ts`
- [Spotify API](https://github.com/acronymuz/cpotify/blob/main/src/services/spotifyApi.ts): `src/services/spotifyApi.ts`
- [Spotify Models](https://github.com/acronymuz/cpotify/blob/main/src/types/spotify.ts): `src/types/spotify.ts`

### Playback

- [Player Store](https://github.com/acronymuz/cpotify/blob/main/src/stores/player.ts): `src/stores/player.ts`
- [Web Playback SDK](https://github.com/acronymuz/cpotify/blob/main/src/composables/usePlaybackSDK.ts): `src/composables/usePlaybackSDK.ts`
- [Native Controls Hook](https://github.com/acronymuz/cpotify/blob/main/src/composables/useNativeMediaControls.ts): `src/composables/useNativeMediaControls.ts`

### Android Runtime

- [Main Activity](https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/MainActivity.java): `android/app/src/main/java/com/cpotify/app/MainActivity.java`
- [Android Web Host](https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/myspoti/WebPlayerHost.java): `android/app/src/main/java/com/cpotify/app/myspoti/WebPlayerHost.java`
- [Ad Block Rules](https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/myspoti/AdBlockRules.java): `android/app/src/main/java/com/cpotify/app/myspoti/AdBlockRules.java`
- [Playback Service](https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/MediaPlaybackService.java): `android/app/src/main/java/com/cpotify/app/MediaPlaybackService.java`
- [Resume Accessibility](https://github.com/acronymuz/cpotify/blob/main/android/app/src/main/java/com/cpotify/app/ResumeAccessibilityService.java): `android/app/src/main/java/com/cpotify/app/ResumeAccessibilityService.java`

### Native Bridge

- [Bridge Plugin](https://github.com/acronymuz/cpotify/blob/main/plugins/myspoti-bridge/src/android/main/java/com/cpotify/app/myspoti/MyspotiBridgePlugin.java): `plugins/myspoti-bridge/src/android/main/java/com/cpotify/app/myspoti/MyspotiBridgePlugin.java`
- [Plugin Web Host](https://github.com/acronymuz/cpotify/blob/main/plugins/myspoti-bridge/src/android/main/java/com/cpotify/app/myspoti/WebPlayerHost.java): `plugins/myspoti-bridge/src/android/main/java/com/cpotify/app/myspoti/WebPlayerHost.java`
- [Bridge API](https://github.com/acronymuz/cpotify/blob/main/plugins/myspoti-bridge/src/definitions.ts): `plugins/myspoti-bridge/src/definitions.ts`

### Other components

- **Listener**
- **Spotify Platform**
- **Preferences**

## Connections

- Listener → App Shell: uses (evidence: `README.md`)
- App Shell → Route Guard: renders routes (evidence: `src/App.vue`)
- Route Guard → Login View: routes to (evidence: `src/router/index.ts`)
- Route Guard → OAuth Callback: routes to (evidence: `src/router/index.ts`)
- Route Guard → Home View: routes to (evidence: `src/router/index.ts`)
- Route Guard → Search View: routes to (evidence: `src/router/index.ts`)
- Route Guard → Library View: routes to (evidence: `src/router/index.ts`)
- Route Guard → Media Details: routes to (evidence: `src/router/index.ts`)
- Route Guard → Settings View: routes to (evidence: `src/router/index.ts`)
- Login View → Auth Store: starts login (evidence: `src/views/LoginView.vue`)
- OAuth Callback → Auth Store: completes login (evidence: `src/views/CallbackView.vue`)
- Auth Store → Spotify Platform: authenticates (evidence: `README.md`)
- Auth Store → Preferences: persists tokens (evidence: `src/stores/auth.ts`)
- Auth Store → Spotify Models: uses models (evidence: `src/stores/auth.ts`)
- Home View → Spotify API: fetches content (evidence: `src/views/HomeView.vue`)
- Search View → Spotify API: searches catalog (evidence: `src/views/SearchView.vue`)
- Library View → Spotify API: loads library (evidence: `src/views/LibraryView.vue`)
- Media Details → Spotify API: loads details (evidence: `src/views/AlbumView.vue`)
- Spotify API → Auth Store: gets token (evidence: `src/services/spotifyApi.ts`)
- Spotify API → Spotify Platform: calls API (evidence: `README.md`)
- Spotify API → Spotify Models: uses models (evidence: `src/services/spotifyApi.ts`)
- App Shell → Web Playback SDK: initializes playback (evidence: `src/App.vue`)
- App Shell → Player Store: reads playback state (evidence: `src/App.vue`)
- App Shell → Player Bar: renders controls (evidence: `src/App.vue`)
- Web Playback SDK → Auth Store: gets credentials (evidence: `src/composables/usePlaybackSDK.ts`)
- Web Playback SDK → Player Store: syncs playback (evidence: `src/composables/usePlaybackSDK.ts`)
- Web Playback SDK → Spotify Platform: streams audio (evidence: `README.md`)
- Player Bar → Player Store: reads state (evidence: `src/components/PlayerBar.vue`)
- Player Bar → Web Playback SDK: controls playback (evidence: `src/components/PlayerBar.vue`)
- Native Controls Hook → Player Store: reads state (evidence: `src/composables/useNativeMediaControls.ts`)
- Native Controls Hook → Web Playback SDK: invokes controls (evidence: `src/composables/useNativeMediaControls.ts`)
- Player Store → Preferences: stores settings (evidence: `src/stores/player.ts`)
- Main Activity → Android Web Host: creates host (evidence: `android/app/src/main/java/com/cpotify/app/MainActivity.java`)
- Main Activity → Playback Service: updates media (evidence: `android/app/src/main/java/com/cpotify/app/MainActivity.java`)
- Main Activity → Resume Accessibility: requests resume (evidence: `android/app/src/main/java/com/cpotify/app/MainActivity.java`)
- Android Web Host → Ad Block Rules: uses rules (evidence: `android/app/src/main/java/com/cpotify/app/myspoti/WebPlayerHost.java`)
- Playback Service → Spotify Platform: downloads artwork (evidence: `README.md`)
- Playback Service → Listener: shows media controls (evidence: `README.md`)
- Main Activity → Bridge Plugin: integrates bridge
- Bridge Plugin → Plugin Web Host: uses host (evidence: `plugins/myspoti-bridge/src/android/main/java/com/cpotify/app/myspoti/WebPlayerHost.java`)
- Bridge Plugin → Bridge API: implements API
