____ _ _ __ ____ _ _ _ _
/ ___| _ __ ___ | |_(_)/ _|_ _ | _ \| | __ _ _ _| (_)___| |_
\___ \| '_ \ / _ \| __| | |_| | | | | |_) | |/ _` | | | | | / __| __|
___) | |_) | (_) | |_| | _| |_| | | __/| | (_| | |_| | | \__ \ |_
|____/| .__/ \___/ \__|_|_| \__, | |_| |_|\__,_|\__, |_|_|___/\__|
|_| |___/ |___/
____ _
/ ___|_ __ ___ __ _| |_ ___ _ __
| | | '__/ _ \/ _` | __/ _ \| '__|
| |___| | | __/ (_| | || (_) | |
\____|_| \___|\__,_|\__\___/|_|
Spotify Playlist Creator is a local-first Next.js app that automates Spotify playlist creation from natural-language prompts. Describe the playlist you want, and the app uses Claude to translate that intent into Spotify searches, gather matching tracks, and create a private playlist in your Spotify account.
- Turns plain-English playlist ideas into structured playlist plans.
- Uses Claude to generate playlist names, descriptions, moods, genres, and track-search queries.
- Searches Spotify for matching tracks through the Spotify Web API.
- Deduplicates results and creates private Spotify playlists by default.
- Supports local encrypted credential storage or environment-variable configuration.
- Add Spotify and Anthropic credentials through the local setup screen or
.env. - Authorize Spotify through the OAuth callback route.
- Submit a playlist prompt such as
late-night electronic focus music with no vocals. - Claude generates search terms and playlist metadata.
- Spotify search results are collected, deduplicated, and inserted into a new private playlist.
The repo is intentionally small and follows a standard Next app layout:
src/app/
api/credentials/ Local credential check, save, and clear routes
api/playlist/ Playlist generation endpoint
api/spotify/ Spotify OAuth callback endpoint
playlist/ Playlist creation UI
setup/ Local credential setup UI
src/lib/
claude.ts Claude playlist-planning service
spotify.ts Spotify OAuth, search, and playlist service
credentials.ts Local encrypted credential storage
config.ts Runtime configuration loader
Generated build output, dependency installs, local credentials, encryption keys, and environment files are ignored by Git.
This app is designed to run on your own machine. The setup flow stores credentials in ignored local files: .credentials.json and .encryption.key. Do not deploy the credential setup flow as a shared public service without adding user authentication, per-user storage, CSRF protection, rate limiting, and production secret management.
Requires Node.js 20.9 or newer.
git clone https://github.com/a2z2k26/spotify-playlist-creator.git
cd spotify-playlist-creator
npm install
npm run build
npm run startOpen http://localhost:3000, then enter:
- Spotify Client ID
- Spotify Client Secret
- Claude API key from Anthropic
In the Spotify Developer Dashboard, add this redirect URI:
http://localhost:3000/api/spotify/callback
The UI setup is the simplest path. If you prefer environment variables:
cp .env.example .envThen fill in the Spotify and Anthropic values in .env.
npm run dev # Start Next.js in development mode
npm run build # Build production assets
npm run start # Start the built app
npm run lint # Run ESLint
npm run type-check # Generate Next route types and run TypeScript checksThe included helper scripts are optional:
./setup.sh
./start.sh.env,.credentials.json, and.encryption.keyare ignored by Git.- The local encryption key is created lazily only when credentials are saved or decrypted.
- Spotify OAuth tokens are stored in HTTP-only cookies.
- Playlists are created as private by default.
- Claude receives only the playlist prompt and track-search context needed for generation.
- The local encrypted credential store is convenience-oriented; use managed environment secrets for production deployments.
- Next.js 16
- React 18
- TypeScript
- Tailwind CSS
- Anthropic Claude API
- Spotify Web API
MIT