# wes10645/spotify_listenerstats_app architecture

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

- Interactive diagram: https://gitdiagram.com/wes10645/spotify_listenerstats_app
- Repository: https://github.com/wes10645/spotify_listenerstats_app

## Overview

Spotiboard is a React and Express application for viewing personal Spotify listening statistics. A user opens the landing page, starts Spotify OAuth, and returns with an encrypted session cookie; the frontend then requests profile and chart data. Backend routes fetch Spotify profile, top artists and tracks, and recent plays, with caching and genre/hour analytics before returning JSON for chart rendering. The README also lists trend, forecasting, and audio-feature analysis as in-development capabilities; no implementation paths for those are evident in the supplied tree. Relationships reflect the sampled source and documented frontend/backend setup.

Main entry points: [`server/app.js`](https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/app.js) (Auth and data routes), [`src/App.js`](https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/App.js) (Dashboard state), [`src/LandingPage.jsx`](https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/LandingPage.jsx) (Animated landing), [`src/api.js`](https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app_ui["Dashboard state<br/>[App.js]"]
  node_landing["Animated landing<br/>[LandingPage.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_charts["Bar charts<br/>[BarChart.js]"]
end

subgraph group_backend["Backend API"]
  node_local_entry["Local server entry<br/>[index.js]"]
  node_vercel_entry["Vercel entry<br/>[index.js]"]
  node_routes["Auth and data routes<br/>[app.js]"]
end

subgraph group_spotify_integration["Spotify integration"]
  node_spotify_client["OAuth and Spotify API<br/>[spotify.js]"]
end

subgraph group_support["Session and analytics"]
  node_session_cookie["Encrypted sessions<br/>[session.js]"]
  node_response_cache[("Response cache<br/>[cache.js]")]
  node_listening_analytics["Listening analytics<br/>[analytics.js]"]
end

node_listener(("Listener"))
node_spotify["Spotify services"]

node_listener -->|"uses"| node_app_ui
node_app_ui -->|"renders"| node_landing
node_landing -->|"starts login"| node_app_ui
node_app_ui -->|"requests data"| node_api_client
node_app_ui -->|"renders"| node_charts
node_api_client -->|"calls API"| node_routes
node_local_entry -->|"loads"| node_routes
node_vercel_entry -->|"exports"| node_routes
node_routes -->|"calls"| node_spotify_client
node_spotify_client -->|"requests"| node_spotify
node_routes -->|"seals sessions"| node_session_cookie
node_routes -->|"reads and writes"| node_response_cache
node_routes -->|"computes charts"| node_listening_analytics

click node_app_ui "https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/App.js"
click node_landing "https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/LandingPage.jsx"
click node_api_client "https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/api.js"
click node_charts "https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/components/BarChart.js"
click node_local_entry "https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/index.js"
click node_vercel_entry "https://github.com/wes10645/spotify_listenerstats_app/blob/main/api/index.js"
click node_routes "https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/app.js"
click node_spotify_client "https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/spotify.js"
click node_session_cookie "https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/session.js"
click node_response_cache "https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/cache.js"
click node_listening_analytics "https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/analytics.js"

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_ui,node_landing,node_api_client,node_charts toneBlue
class node_local_entry,node_vercel_entry,node_routes toneAmber
class node_spotify_client toneMint
class node_session_cookie,node_response_cache,node_listening_analytics toneRose
class node_listener,node_spotify toneIndigo
```

## Components

### Frontend experience

- [Dashboard state](https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/App.js): `src/App.js`
- [Animated landing](https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/LandingPage.jsx): `src/LandingPage.jsx`
- [API client](https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/api.js): `src/api.js`
- [Bar charts](https://github.com/wes10645/spotify_listenerstats_app/blob/main/src/components/BarChart.js): `src/components/BarChart.js`

### Backend API

- [Local server entry](https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/index.js): `server/index.js`
- [Vercel entry](https://github.com/wes10645/spotify_listenerstats_app/blob/main/api/index.js): `api/index.js`
- [Auth and data routes](https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/app.js): `server/app.js`

### Spotify integration

- [OAuth and Spotify API](https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/spotify.js): `server/spotify.js`

### Session and analytics

- [Encrypted sessions](https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/session.js): `server/session.js`
- [Response cache](https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/cache.js): `server/cache.js`
- [Listening analytics](https://github.com/wes10645/spotify_listenerstats_app/blob/main/server/analytics.js): `server/analytics.js`

### Other components

- **Listener**
- **Spotify services**

## Connections

- Listener → Dashboard state: uses (evidence: `src/App.js`)
- Dashboard state → Animated landing: renders (evidence: `src/App.js`)
- Animated landing → Dashboard state: starts login (evidence: `src/LandingPage.jsx`)
- Dashboard state → API client: requests data (evidence: `src/App.js`)
- Dashboard state → Bar charts: renders (evidence: `src/App.js`)
- API client → Auth and data routes: calls API (evidence: `README.md`)
- Local server entry → Auth and data routes: loads (evidence: `server/index.js`)
- Vercel entry → Auth and data routes: exports (evidence: `api/index.js`)
- Auth and data routes → OAuth and Spotify API: calls (evidence: `server/app.js`)
- OAuth and Spotify API → Spotify services: requests (evidence: `server/spotify.js`)
- Auth and data routes → Encrypted sessions: seals sessions (evidence: `server/app.js`)
- Auth and data routes → Response cache: reads and writes (evidence: `server/app.js`)
- Auth and data routes → Listening analytics: computes charts (evidence: `server/app.js`)
