Skip to content

AKRAMSOUIDA/AI-Music-Recommender

Repository files navigation

AI Music Recommendation & Playlist Generator

An intelligent music recommendation system that uses Amazon Bedrock AI to analyze user listening patterns and generate personalized playlists through event-driven architecture.

📊 System Architecture

For a complete visual diagram and detailed explanation of how the system works, see:

🎯 Quick Overview

🎧 User Listening → 🎵 Spotify API → ⚡ EventBridge → 🧠 AI Analysis → 🎵 Personalized Playlists

Components

Core Services

  • EventBridge: Central event router for music events
  • Lambda Functions: AI processing and playlist generation
  • Amazon Bedrock: Claude/Titan models for music analysis
  • SQS Queues: Async processing and retry handling
  • DynamoDB: User profiles and music preferences storage
  • SNS: User notifications and recommendations

External Integrations

  • Spotify Web API
  • Apple Music API
  • Last.fm API (optional)

💰 Cost Analysis

Current Testing Status

  • Spent so far: $0.00 (all within AWS free tier)
  • Projected for 20 playlists: $10-15 (with Bedrock access)
  • Cost optimization: Using Titan model (70% cheaper than Claude)

Cost Breakdown

Component Free Tier With Bedrock
Lambda $0.00 $0.00
DynamoDB $0.00 $0.00
EventBridge $0.00 $0.00
SQS $0.00 $0.00
Bedrock AI $0.00 ~$0.50/song

See TESTING_SUMMARY.md for detailed cost analysis.

🚀 Quick Start Testing

Option 1: Interactive Testing (Recommended)

cd /home/ubuntu/ai-music-recommender
python3 test-interface.py

Option 2: Connect Real Spotify Data

# Set up Spotify credentials (see SYSTEM_OVERVIEW.md for details)
export SPOTIFY_CLIENT_ID="your_client_id"
export SPOTIFY_CLIENT_SECRET="your_client_secret"

# Install required package
pip install spotipy

# Sync your real listening history
python3 spotify-connector.py

Option 3: Manual Testing

# Send custom test events
python3 manual-test.py

# Run cost analysis
python3 test-cost-optimized.py

🎯 Key Features

Real-time Music Analysis - Process listening activity as it happens
AI-Powered Insights - Bedrock AI analyzes mood, genre, and patterns
Personalized Playlists - Generate custom playlists based on your taste
Cost-Optimized - Smart model selection (Titan vs Claude)
Event-Driven Architecture - Scalable and fault-tolerant
Cross-Platform Support - Works with Spotify, Apple Music, and more
Smart Notifications - Get notified when new playlists are ready

📁 Project Structure

ai-music-recommender/
├── 📋 SYSTEM_OVERVIEW.md          # Complete system diagram & explanation
├── 🏗️ ARCHITECTURE.md            # Technical architecture details  
├── 🧪 TESTING_SUMMARY.md          # Testing results & cost analysis
├── 🚀 deploy.sh                   # Automated deployment script
├── 🧪 test-interface.py           # Interactive testing interface
├── 🎵 spotify-connector.py        # Real Spotify data integration
├── infrastructure/
│   ├── cloudformation.yaml        # Full AWS infrastructure
│   └── minimal-testing.yaml       # Cost-optimized testing version
├── lambda-functions/
│   ├── listening-analyzer/        # AI-powered music analysis
│   ├── playlist-generator/        # Playlist creation logic
│   └── notification-sender/       # User notifications
└── tests/
    └── sample-events/             # Test data and examples

🔧 Monitoring & Management

Check System Status

# View stored data
aws dynamodb scan --table-name ai-music-recommender-user-profiles --limit 5

# Monitor Lambda logs  
aws logs tail /aws/lambda/ai-music-recommender-listening-analyzer --follow

# Check costs
aws ce get-cost-and-usage --time-period Start=2024-06-01,End=2024-06-30 --granularity DAILY --metrics BlendedCost

Clean Up Resources

# Delete all resources when done testing
aws cloudformation delete-stack --stack-name ai-music-recommender-testing-stack

📚 Documentation

🎉 Ready to Test!

The system is deployed and ready for cost-optimized testing. Start with the interactive interface:

python3 test-interface.py

Estimated testing cost: $10-15 for 20 AI-generated playlists (vs $180+ with non-optimized setup)

About

AI Music Recommendation & Playlist Generator - Event-Driven Architecture

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors