The Spotify Playlist Generator is a full-stack application that leverages AI and the Spotify API to create personalized playlists based on user prompts and audio feature sliders. With a React.js frontend and a FastAPI backend, users can fine-tune attributes like danceability, energy, and tempo, or start with a specific track seed.
- Features
- Prerequisites
- Installation
- Environment Variables
- Running the Application
- Project Structure
- Technologies Used
- License
- Contact
- AI-Powered Playlist Curation: Uses OpenAI GPT-4 to suggest audio feature targets and genres from user prompts.
- Audio Feature Sliders: Fine-tune attributes like acousticness, danceability, energy, instrumentalness, valence, and tempo.
- Track Seed Search: Optionally seed playlist generation with a specific Spotify track.
- Dynamic Recommendations: Fetches recommendations via Spotify's Web API.
- Interactive UI: Responsive React frontend with real-time previews of selected tracks.
- Node.js (v16+)
- npm (v8+)
- Python (3.9+)
- pip (Python package manager)
- A Spotify Developer account (Client ID & Client Secret)
- An OpenAI API key
-
Clone the repository
git clone https://github.com/yourusername/spotify-playlist-generator.git cd spotify-playlist-generator -
Setup the Backend
cd server python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install --upgrade pip pip install fastapi "uvicorn[standard]" python-dotenv spotipy openai pydantic
-
Setup the Frontend
cd ../client npm install
Create a .env file in the server root (/server) with the following variables:
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
OPENAI_API_KEY=your_openai_api_keyEnsure these values are kept secure and never committed to version control.
- Activate your virtual environment:
cd server source venv/bin/activate
- Start the FastAPI server:
npm run dev # or: uvicorn src.app:app --reload --port 8080 - The API will be available at:
http://localhost:8080
- In a separate terminal:
cd client npm start - Open your browser and navigate to:
http://localhost:3000
spotify-playlist-generator/
├── client/ # React frontend
│ ├── public/ # Static assets and HTML template
│ └── src/ # React components, CSS, and entry point
├── server/ # FastAPI backend
│ └── src/app.py # API routes and playlist logic
├── .gitignore
├── LICENSE # MIT License
└── README.md # Project documentation
- Frontend: React.js, React Router, CSS3
- Backend: Python, FastAPI, Uvicorn
- AI: OpenAI GPT-4 API
- Music API: Spotify Web API via
spotipy - Environment Management:
python-dotenv
This project is licensed under the MIT License.
Created by Richard Augustine.
For questions or feedback, please open an issue or reach out at your.email@example.com.
