Skip to content

Repository files navigation

 ____              _   _  __         ____  _             _ _     _
/ ___| _ __   ___ | |_(_)/ _|_   _  |  _ \| | __ _ _   _| (_)___| |_
\___ \| '_ \ / _ \| __| | |_| | | | | |_) | |/ _` | | | | | / __| __|
 ___) | |_) | (_) | |_| |  _| |_| | |  __/| | (_| | |_| | | \__ \ |_
|____/| .__/ \___/ \__|_|_|  \__, | |_|   |_|\__,_|\__, |_|_|___/\__|
      |_|                    |___/                 |___/
  ____                _
 / ___|_ __ ___  __ _| |_ ___  _ __
| |   | '__/ _ \/ _` | __/ _ \| '__|
| |___| | |  __/ (_| | || (_) | |
 \____|_|  \___|\__,_|\__\___/|_|

Spotify Playlist Creator

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.


What It Does

  • 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.

How It Works

  1. Add Spotify and Anthropic credentials through the local setup screen or .env.
  2. Authorize Spotify through the OAuth callback route.
  3. Submit a playlist prompt such as late-night electronic focus music with no vocals.
  4. Claude generates search terms and playlist metadata.
  5. Spotify search results are collected, deduplicated, and inserted into a new private playlist.

Project Structure

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.


Local-First Boundary

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.


Quick Start

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 start

Open 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

Environment Setup

The UI setup is the simplest path. If you prefer environment variables:

cp .env.example .env

Then fill in the Spotify and Anthropic values in .env.


Scripts

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 checks

The included helper scripts are optional:

./setup.sh
./start.sh

Security Notes

  • .env, .credentials.json, and .encryption.key are 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.

Technology

  • Next.js 16
  • React 18
  • TypeScript
  • Tailwind CSS
  • Anthropic Claude API
  • Spotify Web API

License

MIT

About

Spotify Playlist Creator: a local-first Next.js app for automating private Spotify playlist creation from natural-language Claude prompts.

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages