How ahmedsheikh27/ai-mood-music works
Mood Music is a web app where a user connects Spotify, starts an AI chat, shares a mood, and receives a playlist suggestion. The frontend handles OAuth token handoff and chat; FastAPI routes coordinate authentication and agent requests, while the agent can search Spotify through a tool. The README also identifies Spotify recommendations and the modern web UI as core capabilities. Edges follow sampled calls and documented capabilities; unsampled internals are not expanded.
Main entry points: routes.py Chat and auth routes · page.tsx Mood chat · spotify_oauth.py Spotify OAuth · chat_agent.py Chat agent
Components 15
Web experience
- Connect screen
ai-mood-music-frontend/app/page.tsx - Mood chat
ai-mood-music-frontend/app/chat/page.tsx - Chat message view
ai-mood-music-frontend/components/chat-message.tsx - HTTP client
ai-mood-music-frontend/lib/api.ts
Backend API
- FastAPI app
ai-mood-music-backend/app/main.py - Chat and auth routes
ai-mood-music-backend/app/api/routes.py - Mood request schema
ai-mood-music-backend/app/models/request_models.py - Spotify OAuth
ai-mood-music-backend/app/auth/spotify_oauth.py - Credentials config
ai-mood-music-backend/app/config.py
Recommendation
- Chat agent
ai-mood-music-backend/app/agents/chat_agent.py - Mood agent module
ai-mood-music-backend/app/agents/mood_agent.py - Playlist search client
ai-mood-music-backend/app/services/spotify_client.py
External services
- Spotify
- Gemini model service
Other components
- Music seeker
Connections 19
- Music seeker → Connect screen: connects Spotify
ai-mood-music-frontend/app/page.tsx - Connect screen → Chat and auth routes: opens login
ai-mood-music-frontend/app/page.tsx - Chat and auth routes → Spotify OAuth: gets auth URL
ai-mood-music-backend/app/api/routes.py - Spotify OAuth → Credentials config: reads settings
ai-mood-music-backend/app/auth/spotify_oauth.py - Spotify OAuth → Spotify: requests authorization
ai-mood-music-backend/app/auth/spotify_oauth.py - Chat and auth routes → Spotify OAuth: exchanges code
ai-mood-music-backend/app/api/routes.py - Chat and auth routes → Mood chat: redirects token
ai-mood-music-backend/app/api/routes.py - Music seeker → Mood chat: shares mood
ai-mood-music-frontend/app/chat/page.tsx - Mood chat → HTTP client: sends chat requests
ai-mood-music-frontend/app/chat/page.tsx - HTTP client → Chat and auth routes: calls chat endpoints
- FastAPI app → Chat and auth routes: registers routes
ai-mood-music-backend/app/main.py - Chat and auth routes → Mood request schema: validates mood
ai-mood-music-backend/app/api/routes.py - Chat and auth routes → Chat agent: starts and queries
ai-mood-music-backend/app/api/routes.py - Chat agent → Gemini model service: runs model
ai-mood-music-backend/app/agents/chat_agent.py - Chat agent → Playlist search client: invokes search tool
ai-mood-music-backend/app/agents/chat_agent.py - Playlist search client → Spotify: searches playlists
ai-mood-music-backend/app/services/spotify_client.py - Mood chat → Chat message view: renders messages
ai-mood-music-frontend/app/chat/page.tsx - Mood chat → Music seeker: shows playlist result
ai-mood-music-frontend/app/chat/page.tsx - Mood agent module → Chat agent: possible mood handling