# theeliad/theeliad-spotify-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/theeliad/theeliad-spotify-dashboard
- Repository: https://github.com/theeliad/theeliad-spotify-dashboard

## Overview

TheEliad Spotify Dashboard lets a user connect a Spotify account, choose playlists to track, and inspect playlist activity and statistics. Its main data-refresh path is the dashboard’s sync action into an observer poll cycle, which fetches Spotify playlist and play data, detects changes, and persists results for dashboard queries. A separate tempo backfill resolves audio previews through Deezer and iTunes, estimates tempo, and caches it. The graph combines excerpted call paths with relationships listed in the SOURCE INDEX; unsampled widget and persistence internals are represented at subsystem level.

Main entry points: [`src/observer/sync.py`](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/observer/sync.py) (Poll orchestrator), [`src/db`](https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/db) (Playlist and event persistence), [`src/tempo/backfill.py`](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/tempo/backfill.py) (Tempo backfill), [`src/dashboard/main.py`](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/dashboard/main.py) (Dashboard app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_app["Dashboard app<br/>[main.py]"]
  node_connect["Account connection<br/>[connect.py]"]
  node_widgets["Dashboard widgets"]
  node_format["Display formatting<br/>[format.py]"]
end

subgraph group_spotify["Spotify access"]
  node_spotify_client["OAuth client<br/>[spotify_client.py]"]
  node_api_fetch["Spotify fetchers"]
  node_retry["Rate-limit retry<br/>[retry.py]"]
end

subgraph group_observer["Playlist monitoring"]
  node_sync["Poll orchestrator<br/>[sync.py]"]
  node_diff["Playlist diff<br/>[diff.py]"]
  node_alerts["Change alerts<br/>[alerts.py]"]
end

subgraph group_storage["Persistence"]
  node_db_access["Database access<br/>[db.py]"]
  node_persistence["Playlist and event persistence"]
  node_sqlite[("SQLite database")]
end

subgraph group_tempo["Tempo enrichment"]
  node_preview["Preview resolver<br/>[fetch_preview.py]"]
  node_tempo_backfill["Tempo backfill<br/>[backfill.py]"]
  node_tempo_estimator["Tempo estimator<br/>[estimate.py]"]
end

node_user(("Dashboard user"))
node_spotify_api{{"Spotify API"}}
node_preview_providers{{"Preview providers"}}

node_user -->|"uses"| node_dashboard_app
node_dashboard_app -->|"renders"| node_connect
node_dashboard_app -->|"starts sync"| node_sync
node_dashboard_app -->|"renders"| node_widgets
node_widgets -->|"formats display"| node_format
node_connect -->|"uses OAuth"| node_spotify_client
node_connect -->|"fetches account data"| node_api_fetch
node_connect -->|"saves user selection"| node_persistence
node_spotify_client -->|"authenticates"| node_spotify_api
node_api_fetch -->|"fetches data"| node_spotify_api
node_api_fetch -->|"uses retry"| node_retry
node_sync -->|"builds client"| node_spotify_client
node_sync -->|"fetches playlists"| node_api_fetch
node_sync -->|"loads and writes"| node_persistence
node_sync -->|"compares tracks"| node_diff
node_sync -->|"writes alert"| node_alerts
node_widgets -->|"loads dashboard data"| node_persistence
node_persistence -->|"opens connection"| node_db_access
node_db_access -->|"reads and writes"| node_sqlite
node_tempo_backfill -->|"opens connection"| node_db_access
node_tempo_backfill -->|"resolves and downloads"| node_preview
node_preview -->|"searches providers"| node_preview_providers
node_tempo_backfill -->|"estimates tempo"| node_tempo_estimator
node_tempo_backfill -->|"caches features"| node_persistence

click node_dashboard_app "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/dashboard/main.py"
click node_connect "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/dashboard/connect.py"
click node_widgets "https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/dashboard/widgets"
click node_format "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/dashboard/utils/format.py"
click node_spotify_client "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/api/spotify_client.py"
click node_api_fetch "https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/api"
click node_retry "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/api/retry.py"
click node_sync "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/observer/sync.py"
click node_diff "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/observer/diff.py"
click node_alerts "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/observer/alerts.py"
click node_db_access "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/db/db.py"
click node_persistence "https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/db"
click node_sqlite "https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/db"
click node_preview "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/api/fetch_preview.py"
click node_tempo_backfill "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/tempo/backfill.py"
click node_tempo_estimator "https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/tempo/estimate.py"

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_dashboard_app,node_connect,node_widgets,node_format,node_user,node_preview_providers toneBlue
class node_spotify_client,node_api_fetch,node_retry toneAmber
class node_sync,node_diff,node_alerts,node_spotify_api toneMint
class node_db_access,node_persistence,node_sqlite toneRose
class node_preview,node_tempo_backfill,node_tempo_estimator toneIndigo
```

## Components

### Dashboard

- [Dashboard app](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/dashboard/main.py): `src/dashboard/main.py`
- [Account connection](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/dashboard/connect.py): `src/dashboard/connect.py`
- [Dashboard widgets](https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/dashboard/widgets): `src/dashboard/widgets`
- [Display formatting](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/dashboard/utils/format.py): `src/dashboard/utils/format.py`

### Spotify access

- [OAuth client](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/api/spotify_client.py): `src/api/spotify_client.py`
- [Spotify fetchers](https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/api): `src/api`
- [Rate-limit retry](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/api/retry.py): `src/api/retry.py`

### Playlist monitoring

- [Poll orchestrator](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/observer/sync.py): `src/observer/sync.py`
- [Playlist diff](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/observer/diff.py): `src/observer/diff.py`
- [Change alerts](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/observer/alerts.py): `src/observer/alerts.py`

### Persistence

- [Database access](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/db/db.py): `src/db/db.py`
- [Playlist and event persistence](https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/db): `src/db`
- [SQLite database](https://github.com/theeliad/theeliad-spotify-dashboard/tree/main/src/db): `src/db`

### Tempo enrichment

- [Preview resolver](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/api/fetch_preview.py): `src/api/fetch_preview.py`
- [Tempo backfill](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/tempo/backfill.py): `src/tempo/backfill.py`
- [Tempo estimator](https://github.com/theeliad/theeliad-spotify-dashboard/blob/main/src/tempo/estimate.py): `src/tempo/estimate.py`

### Other components

- **Dashboard user**
- **Spotify API**
- **Preview providers**

## Connections

- Dashboard user → Dashboard app: uses (evidence: `src/dashboard/main.py`)
- Dashboard app → Account connection: renders (evidence: `src/dashboard/main.py`)
- Dashboard app → Poll orchestrator: starts sync (evidence: `src/dashboard/main.py`)
- Dashboard app → Dashboard widgets: renders (evidence: `src/dashboard/main.py`)
- Dashboard widgets → Display formatting: formats display (evidence: `src/dashboard/widgets/playlist_changes.py`)
- Account connection → OAuth client: uses OAuth (evidence: `src/dashboard/connect.py`)
- Account connection → Spotify fetchers: fetches account data (evidence: `src/dashboard/connect.py`)
- Account connection → Playlist and event persistence: saves user selection (evidence: `src/dashboard/connect.py`)
- OAuth client → Spotify API: authenticates (evidence: `src/api/spotify_client.py`)
- Spotify fetchers → Spotify API: fetches data (evidence: `src/api/fetch_playlists.py`)
- Spotify fetchers → Rate-limit retry: uses retry (evidence: `src/api/fetch_current_user.py`)
- Poll orchestrator → OAuth client: builds client (evidence: `src/observer/sync.py`)
- Poll orchestrator → Spotify fetchers: fetches playlists (evidence: `src/observer/sync.py`)
- Poll orchestrator → Playlist and event persistence: loads and writes (evidence: `src/observer/sync.py`)
- Poll orchestrator → Playlist diff: compares tracks (evidence: `src/observer/sync.py`)
- Poll orchestrator → Change alerts: writes alert (evidence: `src/observer/sync.py`)
- Dashboard widgets → Playlist and event persistence: loads dashboard data (evidence: `src/dashboard/widgets/playlist_bpm.py`)
- Playlist and event persistence → Database access: opens connection (evidence: `src/db/load_playlist_tracks.py`)
- Database access → SQLite database: reads and writes (evidence: `src/db/db.py`)
- Tempo backfill → Database access: opens connection (evidence: `src/tempo/backfill.py`)
- Tempo backfill → Preview resolver: resolves and downloads (evidence: `src/tempo/backfill.py`)
- Preview resolver → Preview providers: searches providers (evidence: `src/api/fetch_preview.py`)
- Tempo backfill → Tempo estimator: estimates tempo (evidence: `src/tempo/backfill.py`)
- Tempo backfill → Playlist and event persistence: caches features (evidence: `src/tempo/backfill.py`)
