A lightweight web app that lets audience members search the Spotify catalogue and submit song requests to the DJ's playlist — no Spotify account required. Audience members scan a QR code at the venue and use the mobile-friendly interface.
- Python 3.12+
- uv package manager
- A Spotify Developer account and app (see setup below)
Install uv if you don't have it:
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.local/bin/envgit clone <repo-url>
cd dj-requests-app
uv sync- Go to the Spotify Developer Dashboard and log in.
- Click Create app and fill in:
- App name: DJ Requests App
- App description: Enables audience members to search the Spotify catalogue and request songs.
- Website: leave blank (or add your deployed URL later)
- Redirect URIs: add
http://127.0.0.1:8888/callback— this exact URI is required;http://localhostis not accepted. - API/SDKs: tick Web API
- Save. Then go to Settings to find your Client ID and Client Secret.
Copy the example env file and fill in your credentials:
cp .env.example .envEdit .env:
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
SPOTIFY_REFRESH_TOKEN= # populated by the auth script below
SPOTIFY_PLAYLIST_NAME=DJ Requests
.envis gitignored and will never be committed.
In the Spotify app (or web player), create a playlist named DJ Requests (or whatever name you set in SPOTIFY_PLAYLIST_NAME). This is where audience requests will appear.
This step obtains a refresh token so the app can add tracks to your playlist on your behalf:
uv run python scripts/spotify_auth.pyA browser window will open for the Spotify consent screen. After approving, SPOTIFY_REFRESH_TOKEN is written to .env automatically.
Open the exploration notebook to get a feel for the Spotify API responses and the Polars DataFrames produced by SpotifyClient:
uv run jupyter lab notebooks/spotify_exploration.ipynbuv run behave --tags @unitEnsure .env is populated, then:
uv run behave --tags @e2eScenarios tagged @requires_refresh_token additionally need SPOTIFY_REFRESH_TOKEN in .env.
src/
spotify/ — SpotifyClient: search, playlist reads/writes
scripts/
spotify_auth.py — One-time OAuth helper; writes refresh token to .env
notebooks/
spotify_exploration.ipynb — API exploration notebook
tests/
bdd/
features/spotify/ — Gherkin feature files
steps/ — Step definitions
fixtures/spotify/ — Mock API response JSON fixtures
docs/
REQUIREMENTS.md
ARCHITECTURE.md
uv sync # Install / update dependencies
uv add <package> # Add a new dependency
uv run behave --tags @unit # Run unit tests
uv run behave --tags @e2e # Run e2e tests