A next-generation music platform combining AI, real-time social features, and a seamless artist experience
TunePal is a full-stack, microservices-based music streaming platform that leverages cutting-edge AI technologies to revolutionize how users discover and interact with music. The platform features:
- π§ AI-Powered Mood Detection using real-time facial expression analysis
- π€ Conversational AI Assistant (TunePal Agent) built with LangChain & Google Gemini
- π§ Real-Time Live Sessions for synchronized music listening with friends
- π¨ Dedicated Artist Dashboard for music upload and analytics
- π§ Event-Driven Notifications via RabbitMQ message queue
| Feature | Description | Technology |
|---|---|---|
| Mood Detection | Analyzes user facial expressions via webcam to recommend mood-matching songs | face-api.js, TinyFaceDetector, FaceExpressionNet |
| Song Mood Analysis | Automatically detects mood of uploaded songs using AI | Google Gemini 2.5 Flash |
| TunePal AI Agent | Conversational assistant that can create playlists, play songs, and recommend music | LangChain, LangGraph, Gemini |
| Smart Recommendations | AI-powered song suggestions based on mood, activity, and preferences | Gemini Generative AI |
| Feature | Description |
|---|---|
| Live Sessions (Control Room) | Create password-protected listening rooms where friends join and listen together in perfect sync |
| Check User Online | Real-time presence detection to see which friends are currently active |
| Synchronized Playback | Host controls playback (play, pause, skip) - all members stay in sync |
| Queue Management | Collaborative song queue that updates in real-time for all room members |
| Feature | Description |
|---|---|
| Music Upload | Upload tracks with cover art; AI automatically detects song mood |
| Playlist Management | Create and curate playlists for fans |
| Artist Profile | Customize your artist profile and bio |
| Analytics Dashboard | Track your music performance and listener engagement |
| Google OAuth | Easy login via Google authentication |
| Feature | Description |
|---|---|
| Home Feed | Discover trending songs with infinite scroll pagination |
| Liked Songs | Personal library of favorite tracks |
| User Playlists | Create your own custom playlists |
| Artist Playlists | Explore curated playlists from artists |
| Global Search | Find songs by title, artist, or mood |
| Mood-Based Browsing | Get songs filtered by detected or selected mood |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND LAYER β
βββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ€
β π€ Users Frontend β π¨ Artist Frontend β
β React 19 + Vite + Redux β React 18 + Vite + Redux β
β face-api.js (Mood Detection) β Music Upload + Dashboard β
β Socket.io-client β β
βββββββββββββββββββ¬ββββββββββββββββ΄ββββββββββββββββββββ¬ββββββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β API GATEWAY β
β (NGINX / Docker Network) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MICROSERVICES LAYER β
ββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββ¬βββββββββββββββββββββββββ€
β π Auth β π΅ Music β π€ TunePal β π§ Notification β
β Service β Service β Agent β Service β
ββββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββΌβββββββββββββββββββββββββ€
β β’ JWT Auth β β’ CRUD Songs β β’ LangChain β β’ RabbitMQ Consumer β
β β’ Google OAuth β β’ Playlists β β’ LangGraph β β’ Email Templates β
β β’ Bcrypt Hash β β’ Like/Unlike β β’ Gemini AI β β’ Nodemailer β
β β’ Passport.js β β’ Socket.io β β’ Tool Calling β β
β β β’ ImageKit CDN β β β
βββββββββ¬βββββββββ΄βββββββββ¬βββββββββ΄βββββββββ¬βββββββββ΄ββββββββββββ¬βββββββββββββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATA LAYER β
βββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββ€
β ποΈ MongoDB Atlas β π° RabbitMQ β
β (Users, Music, Playlists) β (Event-Driven Messaging) β
βββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββ
tunepal/
βββ Artist/ # π¨ Artist Dashboard (React + Vite)
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Dashboard, Upload, Playlists, Profile
β β βββ store/ # Redux slices & actions
β β βββ config/ # API configuration
β βββ Dockerfile # Multi-stage build with Nginx
β
βββ Users/ # π€ User Platform (React + Vite)
β βββ public/models/ # face-api.js AI models
β βββ src/
β β βββ components/ # MusicPlayer, Sidebar, Cards, ControlRoom
β β βββ pages/ # Home, MoodDetector, TunePal, ControlRoom
β β βββ services/ # Socket services
β β βββ contexts/ # Music context provider
β β βββ Store/ # Redux state management
β βββ Dockerfile # Multi-stage build with Nginx
β
βββ auth/ # π Authentication Service
β βββ src/
β β βββ controllers/ # Register, Login, Google OAuth
β β βββ middleware/ # JWT validation, input validation
β β βββ model/ # User schema (Mongoose)
β β βββ routes/ # Auth API routes
β β βββ broker/ # RabbitMQ publisher
β βββ Dockerfile
β
βββ music/ # π΅ Music Service (Core API)
β βββ src/
β β βββ controllers/ # Music CRUD, Playlists, Likes, Search
β β βββ middlewares/ # Auth middleware, Mood detection
β β βββ model/ # Music, Playlist, LikeSong, UserPlaylist
β β βββ routes/ # REST API + Agent routes
β β βββ services/ # Gemini AI, ImageKit storage
β β βββ sockets/ # Live Session Socket.io server
β βββ Dockerfile
β
βββ TunePal/ # οΏ½οΏ½ AI Agent Service
β βββ src/
β β βββ agent/
β β β βββ agent.js # LangGraph state machine
β β β βββ tools/ # CreatePlaylist, PlaySong, Recommend, SongDetails
β β βββ model/ # Chat history schema
β β βββ sockets/ # TunePal WebSocket server
β βββ Dockerfile
β
βββ notification/ # π§ Notification Service
β βββ src/
β β βββ broker/ # RabbitMQ subscriber
β β βββ utils/ # Email templates (Nodemailer)
β βββ Dockerfile
β
βββ docker-compose.yml # π³ Full orchestration config| Technology | Purpose |
|---|---|
| React 18/19 | UI Library |
| Vite | Build Tool & Dev Server |
| Redux Toolkit | Global State Management |
| Tailwind CSS | Utility-First Styling |
| Framer Motion | Animations |
| face-api.js | Facial Expression Detection |
| Socket.io-client | Real-time Communication |
| Axios | HTTP Client |
| React Hook Form | Form Management |
| Technology | Purpose |
|---|---|
| Node.js 20 | Runtime Environment |
| Express 5 | Web Framework |
| MongoDB + Mongoose | Database & ODM |
| Socket.io | WebSocket Server |
| JWT | Authentication Tokens |
| Passport.js | OAuth Strategies |
| Multer | File Upload Handling |
| ImageKit | Media CDN & Storage |
| Technology | Purpose |
|---|---|
| LangChain | AI Agent Framework |
| LangGraph | State Machine for Agents |
| Google Gemini 2.5 Flash | LLM for Chat & Analysis |
| face-api.js | Browser-Based Face Detection |
| TinyFaceDetector | Lightweight Face Detection Model |
| FaceExpressionNet | Emotion Recognition Model |
| Technology | Purpose |
|---|---|
| Docker | Containerization |
| Docker Compose | Multi-Container Orchestration |
| Nginx | Static File Serving (Frontend) |
| RabbitMQ | Message Queue (Events) |
- Docker & Docker Compose
- Node.js 18+ (for local development)
- MongoDB Atlas account (or local MongoDB)
- Google Gemini API Key
- ImageKit Account (for media storage)
Create .env files in each service directory:
auth/.env
PORT=3000
MONGO_URI=mongodb+srv://...
JWT_SECRET=your_super_secret_key
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
RABBITMQ_URL=amqp://localhost:5672music/.env
PORT=3001
MONGO_URI=mongodb+srv://...
JWT_SECRET=your_super_secret_key
IMAGEKIT_PUBLIC_KEY=your_imagekit_public
IMAGEKIT_PRIVATE_KEY=your_imagekit_private
IMAGEKIT_URL_ENDPOINT=https://ik.imagekit.io/your_id
GEMINI_API_KEY=your_gemini_api_keyTunePal/.env
PORT=3005
MONGO_URI=mongodb+srv://...
JWT_SECRET=your_super_secret_key
GEMINI_API_KEY=your_gemini_api_key# Clone the repository
git clone https://github.com/your-username/tunepal.git
cd tunepal
# Start all services
docker-compose up --build
# Access the applications
# User Platform: http://localhost:5174
# Artist Dashboard: http://localhost:5173
# RabbitMQ Manager: http://localhost:15672# Terminal 1 - Auth Service
cd auth && npm install && node server.js
# Terminal 2 - Music Service
cd music && npm install && node server.js
# Terminal 3 - TunePal Agent
cd TunePal && npm install && node server.js
# Terminal 4 - Notification Service
cd notification && npm install && node server.js
# Terminal 5 - User Frontend
cd Users && npm install && npm run dev
# Terminal 6 - Artist Frontend
cd Artist && npm install && npm run dev| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
User registration |
| POST | /api/auth/login |
User login |
| GET | /api/auth/google |
Google OAuth initiation |
| GET | /api/auth/google/callback |
Google OAuth callback |
| GET | /api/auth/user/me |
Get current user |
| GET | /api/auth/logout |
Logout user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/music/ |
Get all songs (paginated) |
| GET | /api/music/get-details/:id |
Get song by ID |
| POST | /api/music/upload |
Upload new song (Artist) |
| GET | /api/music/artist-music |
Get artist's songs |
| GET | /api/music/allPlaylist |
Get all public playlists |
| POST | /api/music/playlist |
Create playlist (Artist) |
| GET | /api/music/playlist/:id |
Get playlist by ID |
| POST | /api/music/createUserPlaylist |
Create user playlist |
| GET | /api/music/userPlaylists |
Get user's playlists |
| POST | /api/music/likeSong/:id |
Like/unlike a song |
| GET | /api/music/all/likedSongs |
Get liked songs |
| GET | /api/music/mood-dectect |
Get songs by mood |
| GET | /api/music/search/:query |
Search songs |
| Tool | Description |
|---|---|
CreatePlaylist |
Creates a new playlist with specified songs |
PlayPlaylistSong |
Plays songs from a playlist |
SongDetails |
Fetches detailed information about a song |
RecommendSong |
Recommends songs based on mood/activity |
| Event | Direction | Description |
|---|---|---|
createroom |
Client β Server | Create a new listening room |
joinroom |
Client β Server | Join existing room with code |
play |
Bidirectional | Sync play action across room |
check-user-online |
Client β Server | Check if user is online |
user-status |
Server β Client | Online status response |
| Event | Direction | Description |
|---|---|---|
user-message |
Client β Server | Send message to AI |
ai-response |
Server β Client | Receive AI response |
// LangGraph State Machine Flow
START β CHAT (Gemini) β [Function Call?] β TOOLS β CHAT β END
// Available Tools
1. CreatePlaylist β Creates playlist via Music API
2. PlayPlaylistSong β Streams playlist songs
3. SongDetails β Fetches song metadata
4. RecommendSong β AI recommendations by moodExample Conversation:
User: "I'm feeling sad, can you recommend some songs?"
Agent: [Calls RecommendSong tool with mood="sad"]
β Returns: "Here are some comforting songs for you: ..."
User: "Create a playlist called 'Rainy Day' with those songs"
Agent: [Calls CreatePlaylist tool]
β Returns: "I've created your 'Rainy Day' playlist! π΅"
- Progressive Web App (PWA) support
- Offline mode with cached songs
- Lyrics display with karaoke mode
- Artist verification system
- Social features (follow artists, share playlists)
- Advanced analytics dashboard
- Multi-language support
- Podcast support
[Your Name]
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ using React, Node.js, LangChain & Gemini AI
β Star this repo if you found it helpful!