Statify is a Spotify analytics dashboard that visualizes your listening habits with an editorial "digital archivist" aesthetic. Built on Next.js App Router with:
- Server-side Spotify Authorization Code auth
- Secure HTTP-only cookies for Spotify tokens
- SWR for client-side fetching and mutations
- Dark/light theme with Material Design 3 surface tokens
- Inter + Space Grotesk typography
Create a local env file from .env.example and set:
SPOTIFY_CLIENT_IDSPOTIFY_CLIENT_SECRETSPOTIFY_REDIRECT_URINEXT_PUBLIC_APP_URL
Important: The redirect URI must use http://127.0.0.1:3000 — Spotify's OAuth does not support localhost as a callback host. Set your redirect URI to:
http://127.0.0.1:3000/api/auth/callback
This must match exactly in both your .env.local file and your Spotify Developer Dashboard app settings.
Install dependencies:
bun installRun the development server:
bun run devOpen http://127.0.0.1:3000 in your browser.
Run ESLint:
bun run lintRun Prettier in check mode:
bun run format:checkFormat the codebase:
bun run formatRun unit tests:
bun run testRun a production build:
bun run buildThe app is organized around a client/server split:
client/components/— UI components and screens for landing, dashboard, top items, history, auth, theme, and shared UI primitives.client/hooks/— SWR-backed client hooks for auth status, top items, current playback, recent history, theme state, and mutations.client/services/— Browser-side fetch wrappers that call the Next.js route handlers.client/lib/— Client-only utilities such ascnand display constants like time-range labels.app/— Next.js App Router pages, layouts, loading states, and API route handlers.server/services/— Server-side application logic for Spotify auth and data fetching.server/adapters/— Low-level Spotify API integrations.server/lib/— Server-only env access, cookie helpers, session helpers, and Spotify auth constants.types/— Shared TypeScript contracts for Spotify data and app-facing response shapes.
The runtime request flow is:
- Client UI in
client/components/ - Client orchestration in
client/hooks/ - Browser fetch layer in
client/services/ - Next.js route handlers in
app/api/** - Server business logic in
server/services/ - Spotify HTTP adapters in
server/adapters/
| Route | Description |
|---|---|
/ |
Landing page (redirects to /dashboard if logged in) |
/dashboard |
Now playing, quick stats, recent listening history |
/artists |
Top artists with time range filtering |
/tracks |
Top tracks with time range filtering |
/history |
Full listening history, grouped by day |
/privacy |
Privacy policy |
/terms |
Terms of service |
/auth-error |
OAuth error page with reason-specific messaging |
The current implementation requests only:
user-top-readuser-read-currently-playinguser-read-privateuser-read-recently-played