Skip to content

feat: add FastAPI webapp for Spotify/Last.FM library management#46

Draft
jmlrt wants to merge 1 commit into
mainfrom
feat/webapp
Draft

feat: add FastAPI webapp for Spotify/Last.FM library management#46
jmlrt wants to merge 1 commit into
mainfrom
feat/webapp

Conversation

@jmlrt
Copy link
Copy Markdown
Owner

@jmlrt jmlrt commented May 31, 2026

Summary

  • Adds a server-rendered web interface (FastAPI + Jinja2 + HTMX + Pico CSS) that imports existing spotfm.* library functions directly — CLI unchanged
  • Session-based auth via [web] api_key in spotfm.toml; background jobs tracked in-memory with HTMX polling for status
  • Docker deployment via Dockerfile + docker-compose.yml with volume mounts for DB, config, and token cache

Features

Route Description
GET / Dashboard: track/playlist/artist/album counts
GET /playlists Playlists with track counts + per-playlist update buttons
GET /tracks Track list with filters: playlist, artist, album, year range
GET /duplicates Duplicate detection by ID (sync) or name/fuzzy (async job)
GET /scrobbles Recent Last.FM scrobbles
GET /track-counts track_counts_log CSV visualized as a table
POST /jobs/update-playlists Background job: update playlists from Spotify API
POST /jobs/discover Background job: discover new tracks
GET /jobs/{job_id} HTMX polling partial for job status

Tech stack

  • FastAPI 0.115+ — async routes, factory pattern (uvicorn --factory)
  • Jinja2 + HTMX 2.x — server-rendered, zero JS build step
  • Pico CSS 2.x — classless minimal styling (CDN)
  • Starlette SessionMiddleware — signed cookie, api_key as secret
  • asyncio.create_task + run_in_executor — background jobs with in-memory registry

Test plan

  • uv run pytest tests/web/ — 25 web tests (auth, routes, jobs) pass
  • uv run pytest — full suite (340 tests) passes, no regressions
  • uv run spfm-web — app starts; login page at http://localhost:8000
  • Manual: log in, navigate dashboard, playlists, track filters
  • Manual: trigger update-playlists or discover, observe HTMX job polling
  • docker compose up --build — container starts, volume mounts work

🤖 Generated with Claude Code

Adds a server-rendered web interface (FastAPI + Jinja2 + HTMX + Pico CSS)
that imports existing library functions directly rather than wrapping the CLI.
Features: dashboard stats, playlists, track filtering, duplicate detection,
background jobs with HTMX polling, Last.FM scrobbles, track counts CSV view,
and session-based auth via api_key in spotfm.toml. Includes Docker deployment
files and 25 web tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant