How hassraza/mood-based-music-recommender-main works
This is a mood-based music recommender: a user submits a mood and language, the browser obtains a song or playlist suggestion, searches Spotify, and plays the result. The README describes Gemini-backed interpretation, but the sampled browser code calls /api/server, whose handler returns a mock mood mapping; a separate /server handler calls Gemini. The browser code also handles Spotify authentication/search, embedded playback, and album-art color updates. The HTML and CSS are represented from the tree and README; their source was not sampled.
Main entry points: index.js Browser workflow · server.js Mood routes · index.html Mood interface · style.css Responsive styling
Components 17
User experience
- Mood interface
index.html - Responsive styling
style.css - Browser workflow
index.js
Mood recommendation
- Express app
server.js - Mood routes
server.js - Gemini generation
server.js
Music delivery
- Spotify OAuth
index.js - Track search
index.js - Playlist search
index.js - Album color update
index.js - Embed playback
index.js
Other components
- Listener
- Google Gemini
- Spotify accounts
- Spotify Web API
- ColorThief
- Spotify player
Connections 21
- Listener → Mood interface: enters mood
- Mood interface → Browser workflow: loads interaction
- Responsive styling → Mood interface: styles
- Browser workflow → Mood routes: POST /api/server
- Mood routes → Browser workflow: returns suggestion and credentials
- Express app → Mood routes: dispatches routes
- Browser workflow → Spotify OAuth: requests token
- Spotify OAuth → Spotify accounts: OAuth request
- Spotify accounts → Spotify OAuth: returns token
- Browser workflow → Track search: searches suggestion
- Browser workflow → Playlist search: searches suggestion
- Track search → Spotify Web API: searches tracks
- Playlist search → Spotify Web API: searches playlists
- Browser workflow → Embed playback: plays selected URI
- Embed playback → Spotify player: loads and plays URI
- Track search → Album color update: passes album art
- Playlist search → Album color update: passes playlist art
- Album color update → ColorThief: extracts color
- Album color update → Mood interface: updates background
- Mood routes → Gemini generation: /server requests generation
- Gemini generation → Google Gemini: generates suggestion