Skip to content

yeabwang/spotify_ai

Repository files navigation

🎧 Spotify AI - Intelligent Music Discovery

Your personal AI DJ

πŸš€ Try Live Demo

Spotify Badge OpenAI Badge React Badge Typescript Badge

🌟 What is Spotify AI?

Spotify AI transforms how you discover music by combining the power of LLMs with Spotify's vast music catalog and your personal listening history. Simply describe what you need in plain language, and AI curates the perfect playlist tailored to your taste.

"I need focus music for coding" β†’ 🎡 10 perfectly matched tracks "Ethiopian chill vibes" β†’ 🎡 Authentic Amharic music "Energetic workout mix" β†’ 🎡 High-energy tracks that match your style

Main Screen

πŸš€ AI Features

🎯 Natural Language Generation

Describe your mood, activity, or feeling in plain language - no complex filters or searches needed.

AI Chatbot

Examples:

  • "Relaxing evening music for reading"
  • "Upbeat French rap for my morning run"
  • "Melancholic indie for a rainy day"
  • "K-pop dance tracks for a party"

🧠 Intelligent Mood Analysis

The AI understands context beyond just keywords:

  • ⏰ Time of Day - Morning energy vs. evening calm
  • πŸ“… Day of Week - Weekend vibes vs. weekday focus
  • 🌀️ Weather Conditions - Rainy day moods, sunny energy
  • πŸ’­ Emotional State - Detected from your description
  • 🎡 Music Psychology - Energy levels (0-1), Valence (-1 to 1)
Music Generation

🎨 Personalized to YOUR Taste

Unlike generic playlists, Spotify AI learns from your unique listening history:

✨ Taste Profile Analysis

  • Your top 50 artists
  • Favorite genres and sub-genres
  • Recent listening patterns
  • Energy/valence preferences
  • Preferred musical eras (2010s, 2020s, etc.)

✨ Smart Balancing

  • 60% Familiar - Artists and genres you love
  • 40% Discovery - New tracks aligned with your taste
  • Adjustable discovery level (familiar/balanced/discovery)

✨ Continuous Learning

  • Updates preferences after each generation
  • Learns your favorite vibes and genres
  • Adapts to your evolving taste
Generated Playlist

πŸ”„ Instant Regeneration

Not satisfied? Get a completely different playlist with the same vibe in one click:

  • Same mood and style
  • Fresh track selection
  • New AI ranking
  • Same personalization
Generated Playlist

🎭 Transparent Explanations

Every track comes with detailed reasoning:

Track: "Yedi Gosh" by Aster Aweke
Overall Match: 98%

Why selected:
β€’ Authentic Ethiopian/Amharic artist matching your request
β€’ Soft, contemplative energy perfect for the mood
β€’ Artist appears in your recent listening history
β€’ High popularity ensures quality

Taste Alignment: 95% - "Matches your Ethiopian music taste"
Mood Fit: 92% - "Perfect for cloudy day introspection"
Selection Reasoning

πŸ’Ύ Smart Preferences Management

Your AI assistant remembers and learns:

  • 🎡 Saved Vibes - Keep your last 5 favorite moods
  • 🎸 Genre Preferences - Top 10 genres you enjoy
  • ⚑ Energy Levels - Your preferred intensity (0-1)
  • 🎭 Mood Preferences - Valence from melancholic to uplifting
  • πŸ“ Playlist Length - 5-50 tracks (default: 10)
  • πŸ” Discovery Level - How adventurous you want to be
  • πŸ“Š Generation History - Total playlists created
Save and Play

🎡 Spotify Web Client Features

Built on top of a Spotify Web Client with:

Core Features

  • ▢️ Real-time Playback - Spotify Playback SDK integration
  • πŸŽ›οΈ Full Controls - Play, pause, skip, shuffle, repeat
  • πŸ” Search & Browse - Explore millions of tracks, artists, albums
  • πŸ“ Playlist Management - Create, edit, delete playlists
  • ❀️ Liked Songs - Save and access your favorites
  • πŸ“± Multi-Device - Switch between devices seamlessly
  • πŸ‘€ Artist Pages - Full discography and related artists
  • πŸ’Ώ Album Views - Track listings and details

Note: Premium Spotify account required for playback features


πŸ›  Technology Stack

AI & Intelligence

  • πŸ€– OpenAI - Natural language understanding and curation
  • 🧠 Custom Generation Service - Intelligent playlist creation
  • πŸ“Š Taste Profiling - User listening history analysis
  • 🎯 Smart Ranking - Multi-factor track scoring

Frontend

  • βš›οΈ React 19 - Modern UI framework
  • πŸ“˜ TypeScript - Type-safe development
  • 🎨 Ant Design - Professional UI components
  • πŸ”„ Redux - State management
  • πŸ’Ύ Redux Persist - Persistent storage

Spotify Integration

  • 🎡 Spotify Web API - Music data and user info
  • πŸ”Š Spotify Playback SDK - Real-time playback control

πŸ“Έ AI Feature Showcase

AI Chatbot
Natural Language Input
Generating
AI Processing
Generated
Curated Playlist
Reasoning
Selection Reasoning
Emotion Map
Emotion Mapping
Save Play
Save & Play

βš™οΈ Installation & Setup

Prerequisites

  • Node.js 16+ and Yarn
  • Spotify Premium account
  • Spotify Developer App credentials
  • OpenAI API key

Quick Start (Local Development)

  1. Clone the repository

    git clone https://github.com/yeabwang/spotify_ai.git
    cd spotify_ai
  2. Install dependencies

    yarn install
  3. Configure environment variables

    Copy .env.dist to .env and fill in the required values:

    cp .env.dist .env

    Edit .env with your credentials:

    # Required: Spotify API Configuration
    REACT_APP_SPOTIFY_CLIENT_ID=<your_spotify_client_id>
    REACT_APP_SPOTIFY_REDIRECT_URL=http://localhost:3000
    
    # Optional: OpenAI API Key (can also be entered in Settings page)
    REACT_APP_OPENAI_API_KEY=<your_openai_api_key>

    Get your Spotify credentials:

    • Go to Spotify Developer Dashboard
    • Create a new app
    • Copy the Client ID
    • Add http://localhost:3000 as a Redirect URI in your app settings
  4. Start the development server

    yarn start
  5. Open your browser

    Navigate to http://localhost:3000

  6. Configure your OpenAI API key

    If you didn't set it in .env, go to Settings (βš™οΈ) in the app and enter your OpenAI API key.

    Get your API key:

Self-Hosting / Production Deployment

For self-hosted deployments, the following environment variables are required:

Variable Required Description
REACT_APP_SPOTIFY_CLIENT_ID Yes Your Spotify app's Client ID
REACT_APP_SPOTIFY_REDIRECT_URL Yes Must match your deployment URL exactly
REACT_APP_OPENAI_API_KEY No Optional; users can enter in Settings
REACT_APP_OPENAI_MODEL No Defaults to gpt-5.2-chat-latest

Important: The REACT_APP_SPOTIFY_REDIRECT_URL must exactly match:

  1. The URL where your app is deployed (e.g., https://your-domain.com)
  2. A Redirect URI configured in your Spotify Developer Dashboard

Customize AI behavior (optional): Modify src/config/ai.config.ts to adjust:

  • Model selection and parameters
  • Scoring weights (taste, mood, popularity, play frequency)
  • Generation defaults (track count, discovery level)
  • Preference storage settings

Production Build

yarn build

The build files will be in the build/ directory.


🎯 How to Use AI Features

1. Describe Your Need

Simply type what you want in natural language:

  • "Chill music for studying"
  • "Upbeat workout tracks"
  • "Relaxing Ethiopian music"

2. AI Analyzes

The system:

  • Loads your Spotify listening history
  • Analyzes your taste profile
  • Understands the mood and context
  • Creates a personalized music plan

3. Get Your Playlist

Receive 10 perfectly curated tracks with:

  • Overall match scores
  • Detailed explanations
  • Play/Save options

4. Refine (Optional)

  • Regenerate for different tracks
  • Adjust discovery level
  • Update preferences
  • Save favorite vibes

πŸ“š Documentation


🀝 Shout out

This project is built upon the excellent Spotify React Web Client created by Franco Borrelli.

πŸ™ Original Project: francoborrelli/spotify-react-web-client

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Important Notes

Spotify Premium Required

  • Playback features require a Spotify Premium subscription
  • Free accounts can browse but cannot play music

OpenAI API Costs

  • AI features use OpenAI's API (configurable model)
  • Each playlist generation makes 3-4 API calls
  • Estimated cost varies by model
  • Configure model and timeouts in src/config/ai.config.ts
  • Consider implementing rate limiting for production

API Rate Limits

  • Spotify API: 180 requests per minute
  • OpenAI API: Depends on your tier
  • Built-in delays to prevent rate limiting

πŸ’¬ Support

If you encounter any issues or have questions:

AI Features (Generation, OpenAI, Preferences)

  1. Check the AI Documentation
  2. Review existing Issues
  3. Open a new issue in this repository

Web Client Features (Playback, UI, Spotify Integration)

  1. Check the original repository
  2. Review existing Issues
  3. Open a new issue in Franco's repository

🌟 Show Your Support

If you find this project useful, please consider:

  • ⭐ Starring the repository
  • πŸ› Reporting bugs
  • πŸ’‘ Suggesting new features
  • 🀝 Contributing code
  • πŸ“’ Sharing with others

Made with ❀️

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors