Votuna is an open source collaborative playlist voting app.
Current provider status:
- Frontend login: Spotify, SoundCloud, Apple Music, and TIDAL
- Backend auth/provider clients: Spotify, SoundCloud, Apple Music, and TIDAL
- Spotify, SoundCloud, Apple Music, and TIDAL OAuth login with cookie-based sessions
- Apple Music OAuth + provider client integration in backend
- Provider clients for Spotify, SoundCloud, Apple Music, and TIDAL (playlist + track APIs; TIDAL refresh token handling)
- Dashboard to:
- List provider playlists
- Create a new provider playlist (public/private)
- Enable existing provider playlists for Votuna
- Playlist detail experience:
- Search provider tracks from within the playlist page
- Suggest tracks from search results or by pasting a track URL
- Vote on suggestions with voter display names in tooltip
- Play tracks in a persistent "Now Playing" dock
- Configure playlist vote settings (required vote percent, auto-add toggle)
- View collaborator roles and suggestion counts
- Track recommendations for supported providers (currently SoundCloud and TIDAL)
- Manage tab (owner-only):
- Import another playlist into the current playlist
- Export the current playlist into an existing playlist or a newly created playlist
- Filter transfers by
all,genre,artist, or selectedsongs - Preview transfer results before execute (matched, to-add, duplicates)
- Execute with duplicate skip behavior and failure summary
- Source-track picker with search and pagination for song selection
- Profile page:
- Edit display name, first name, last name, and email
- Upload avatar
- Save theme and email preference settings
- API docs at
/docsand/redoc
- Provider polish:
- Continue hardening Apple Music login and callback UX
- Broaden recommendation support where provider APIs are reliable
- Cross-provider playlist links and metadata sync
- Playlist management tools:
- Bulk remove selected tracks from a playlist
- Duplicate cleanup utility inside a playlist
- Reorder tools (manual drag/drop + auto-sort presets)
- Operation history, undo checkpoints, and replay options
- Collaboration and automation:
- Role-based moderation actions for collaborators
- Duplicate detection and quality rules
- Playlist activity feed and vote history export
- Webhook events for bots and external workflows
- Backend: FastAPI, SQLAlchemy, Alembic, PostgreSQL
- Frontend: Next.js 15, React 18, TanStack Query, Tailwind, Tremor UI
- Dev infra: Docker Compose
votuna/
api/ FastAPI app, models, migrations, tests
frontend/ Next.js app
docker-compose.yml Local multi-service orchestration
.env.example Root environment template
cp .env.example .envOn Windows PowerShell:
Copy-Item .env.example .envAt minimum set:
AUTH_SECRET_KEY(replacechange-me)- At least one provider OAuth set:
SPOTIFY_CLIENT_ID,SPOTIFY_CLIENT_SECRET,SPOTIFY_REDIRECT_URISOUNDCLOUD_CLIENT_ID,SOUNDCLOUD_CLIENT_SECRET,SOUNDCLOUD_REDIRECT_URIAPPLE_CLIENT_ID,APPLE_CLIENT_SECRET,APPLE_REDIRECT_URITIDAL_CLIENT_ID,TIDAL_CLIENT_SECRET,TIDAL_REDIRECT_URI
- Optional provider settings:
APPLE_MUSIC_TEAM_ID,APPLE_MUSIC_KEY_ID,APPLE_MUSIC_PRIVATE_KEYAPPLE_MUSIC_DEVELOPER_TOKEN(or signing key settings above),APPLE_MUSIC_STOREFRONTTIDAL_COUNTRY_CODE
Optional but common:
NEXT_PUBLIC_API_URL(defaulthttp://localhost:8000)FRONTEND_URL(defaulthttp://localhost:3000)
docker compose up --build- Frontend: http://localhost:3000
- API: http://localhost:8000
- Swagger: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- Health: http://localhost:8000/health
Start PostgreSQL only:
docker compose up -d postgresRun API:
cd api
python -m venv .venv
# Linux/macOS
source .venv/bin/activate
# Windows PowerShell
# .\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
alembic upgrade head
python main.pyRun frontend in another shell:
cd frontend
npm install
npm run devIf needed, create frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8000Apple Sign In callbacks must be HTTPS and cannot use localhost. For low-friction local testing:
- Reserve an ngrok domain and register it in Apple Developer as:
https://<reserved-ngrok-domain>/api/v1/auth/callback/apple
- Set these values once in root
.env:APPLE_REDIRECT_URI=https://<reserved-ngrok-domain>/api/v1/auth/callback/appleNEXT_PUBLIC_API_URL=https://<reserved-ngrok-domain>AUTH_COOKIE_SECURE=TrueAUTH_COOKIE_SAMESITE=none- Keep
FRONTEND_URL=http://localhost:3000 - Keep
ALLOWED_ORIGINSincludinghttp://localhost:3000
- Generate
APPLE_CLIENT_SECRETonce and store it in.env(rotate before expiry). - Start ngrok locally against the API port:
ngrok config add-authtoken <token>
ngrok http --domain=<reserved-ngrok-domain> 8000Generate/update APPLE_CLIENT_SECRET with the helper script:
python scripts/generate_apple_tokens.py \
--token-type client-secret \
--team-id <apple-team-id> \
--key-id <apple-signin-key-id> \
--client-id <apple-client-id> \
--private-key-path <path-to-AuthKey_XXXXXX.p8> \
--write-envGenerate/update APPLE_MUSIC_DEVELOPER_TOKEN with the same helper script:
python scripts/generate_apple_tokens.py \
--token-type music-developer \
--team-id <apple-team-id> \
--key-id <apple-musickit-key-id> \
--private-key-path <path-to-AuthKey_XXXXXX.p8> \
--write-envNotes:
--client-idis used as JWTsuband must match your Apple OAuthclient_id(usually Services ID for web flows).--app-idcan be supplied as an alias; if--client-idis omitted the script uses--app-id.- The script enforces Apple's max client-secret lifetime and prints expiry in UTC.
postgres: Railway PostgreSQL serviceapi: public FastAPI service (root directory:api, config:api/railway.toml)frontend: public Next.js service (root directory:frontend, config:frontend/railway.toml)
Production deploys are handled by GitHub Actions from published GitHub Releases (non-prerelease).
- Disable automatic deploys from GitHub pushes in Railway for both
apiandfrontend. - Keep Railway connected to the repo for build context, but do not allow push-triggered deploys.
- Deploy production by publishing a GitHub Release.
Required GitHub repository secrets for release deploys:
RAILWAY_TOKENRAILWAY_API_PROJECT_IDRAILWAY_API_ENVIRONMENT_IDRAILWAY_API_SERVICE_IDRAILWAY_FRONTEND_PROJECT_IDRAILWAY_FRONTEND_ENVIRONMENT_IDRAILWAY_FRONTEND_SERVICE_ID
If API and frontend share the same Railway project/environment, set both API and frontend project/environment secrets to the same values.
- Create a Railway project.
- Add
Postgresfrom Railway templates. - Add
apiservice from this repo with root directoryapi. - Add
frontendservice from this repo with root directoryfrontend.- Do not prefix these with
/in Railway. Useapiandfrontend, not/apior/frontend.
- Do not prefix these with
Set these in Railway for the api service:
DATABASE_URL=${{Postgres.DATABASE_URL}}AUTH_SECRET_KEY=<strong-random-value>AUTH_COOKIE_SECURE=TrueAUTH_COOKIE_SAMESITE=lax(ornonefor true cross-site deployments)FRONTEND_URL=https://<frontend-domain>.up.railway.appALLOWED_ORIGINS=["https://<frontend-domain>.up.railway.app"]SPOTIFY_CLIENT_ID=<spotify-client-id>SPOTIFY_CLIENT_SECRET=<spotify-client-secret>SPOTIFY_REDIRECT_URI=https://<api-domain>.up.railway.app/api/v1/auth/callback/spotifySOUNDCLOUD_CLIENT_ID=<soundcloud-client-id>SOUNDCLOUD_CLIENT_SECRET=<soundcloud-client-secret>SOUNDCLOUD_REDIRECT_URI=https://<api-domain>.up.railway.app/api/v1/auth/callback/soundcloudAPPLE_CLIENT_ID=<apple-client-id>APPLE_CLIENT_SECRET=<apple-client-secret>APPLE_REDIRECT_URI=https://<api-domain>.up.railway.app/api/v1/auth/callback/appleAPPLE_MUSIC_TEAM_ID=<apple-team-id>APPLE_MUSIC_KEY_ID=<apple-key-id>APPLE_MUSIC_PRIVATE_KEY=<apple-private-key>TIDAL_CLIENT_ID=<tidal-client-id>TIDAL_CLIENT_SECRET=<tidal-client-secret>TIDAL_REDIRECT_URI=https://<api-domain>.up.railway.app/api/v1/auth/callback/tidalUSER_FILES_DIR=/app/user_filesRAILWAY_RUN_UID=0
Set these in Railway for the frontend service:
NEXT_PUBLIC_API_URL=https://<api-domain>.up.railway.app
NEXT_PUBLIC_API_URL is required at build time in production image builds.
Attach a volume to the api service and mount it at:
/app/user_files
This keeps uploaded avatar files across deploys.
- Deploy
apiand generate its public domain. - Set
NEXT_PUBLIC_API_URLinfrontendto the API domain. - Deploy
frontendand generate its public domain. - Update API
FRONTEND_URLandALLOWED_ORIGINSwith the frontend domain and redeployapi. - In Spotify developer settings, set callback URL to:
<url>/api/v1/auth/callback/spotify
- In SoundCloud developer settings, set callback URL to:
<url>/api/v1/auth/callback/soundcloud
- In Apple developer settings, set callback URL to:
<url>/api/v1/auth/callback/apple
- In TIDAL developer settings, set callback URL to:
<url>/api/v1/auth/callback/tidal
- Ensure provider redirect URIs match exactly, then redeploy
api. - After bootstrap, use GitHub Releases for production deploys:
- Publish a non-prerelease GitHub Release.
- GitHub Actions runs quality checks, then deploys both Railway services.
- API health:
GET /healthreturns healthy. - Frontend loads and can fetch authenticated user state.
- Spotify/SoundCloud/Apple Music/TIDAL login redirects back to app and sets auth cookie.
- Playlist listing/details load.
- Suggest/add/vote flows work.
- Upload avatar, redeploy API, verify avatar still exists.
From api/:
alembic revision --autogenerate -m "describe_change"
alembic upgrade head
alembic historyFrontend:
cd frontend
npm run lint
npm run buildBackend:
cd api
python -m ruff check main.py app tests
python -m black --check main.py app tests
pytest -qDocker test profile:
docker compose --profile test up --build api_tests/api/v1/auth/*- OAuth login/callback/logout/api/v1/users/*- current user profile, settings, avatar/api/v1/playlists/*- provider playlist listing/creation/api/v1/votuna/*- Votuna playlists, settings, suggestions, votes, members, invites, management transfer endpoints
- Root
.envis used by both Docker Compose and backend settings loading. - In local development, ensure
ALLOWED_ORIGINSincludes your frontend host. - Frontend login buttons expose Spotify, SoundCloud, Apple Music, and TIDAL.