Turn 5–12 songs into a perfectly sequenced Spotify playlist. Search tracks → pick favorites → AI expands & orders them → Add to Spotify in one click.
Search & pick tracks — quick picks for IL artists included
AI-ordered playlist with one-click “Add to Spotify”
This app uses a Spotify Developer application in Development mode. Spotify limits usage to 25 allowlisted users.
Want access? Email me at noamelisha21@gmail.com with your Spotify account email and I’ll add you. After approval, log in with the same account you sent.
🔎 Live Spotify search in the input (artist + track suggestions).
⚡ Top tracks preview per artist — add with a single click.
🧠 Smart expansion: for every artist you picked, the app fetches popular songs to build a bigger pool.
🎚️ AI sequencing with Claude using Spotify audio features (energy, valence, tempo, danceability) for a smooth Warm-up → Peak → Cooldown flow.
👥 Artist diversity rules: never more than 2 in a row by the same artist; at least 5 different artists in your seeds.
✅ Add to Spotify via OAuth (secure HttpOnly cookies + refresh flow).
Name your playlist.
Choose 5–12 songs (must include ≥ 5 different artists).
Click Generate Playlist:
The server collects candidate tracks per artist (your seeds + the artist’s top/popular tracks).
Fetches audio features for all candidates.
Sends them to Claude which returns only an order of the provided IDs (no hallucinated tracks).
Click Add to Spotify to create a private playlist in your account and add the tracks.
Frontend: React + Vite, clean dark UI (vanilla CSS)
Server: Node/Vercel API routes
APIs: Spotify Web API (search, artists’ top tracks, audio features, create playlists)
AI: Anthropic Claude (claude-3.5-sonnet-20240620) for sequencing
Auth: Spotify OAuth → HttpOnly cookies + refresh token
git clone https://github.com//ai-playlist-generator.git cd ai-playlist-generator && npm install
Create .env (local):
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=
SPOTIFY_REDIRECT_URI=http://localhost:3000/api/spotify/callback
ANTHROPIC_API_KEY=
SPOTIFY_MARKET=IL
In the Spotify Dashboard, add the exact same redirect URL.
Run:
npm run dev
Spotify tokens stored in HttpOnly cookies (SameSite=Lax, Secure in prod).
Refresh token support for seamless re-auth.
All Spotify/Anthropic calls are server-side. API keys are never exposed in the client bundle.
Dev-mode errors are humanized (e.g., “app in development / not whitelisted”).
“App in development / not whitelisted” → You must be added to the Spotify app’s allowlist. Email your@email.com.
“Auth/redirect/invalid_grant” → The SPOTIFY_REDIRECT_URI must exactly match Spotify settings and your .env.
“No songs added to Spotify” → The server searches by {track, artist} and adds the best match; typos/very obscure tracks may not resolve.
Claude error / rate limits → The server falls back to a deterministic “weaving” strategy that still respects quotas and streak limits.
Why do I need 5 different artists? To ensure variety and to let the algorithm expand your seed set per artist.
Does the AI invent songs? No. Claude only reorders the candidate tracks returned by the server. No new tracks are injected.
Will my playlist be public? No, created playlists are private by default (you can change them in Spotify later).
Want to be allowlisted? Email: noamelisha21@gmail.com I’ll add you to the Spotify app users (limit: 25) and reply once you’re in.