A mood-based playlist generator that starts with a song you love and creates playlists based on mood directions.
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.env.exampleto.env - Add your Spotify API credentials (get them from Spotify Developer Dashboard)
- Copy
-
Create folder structure:
project/ ├── server.js ├── package.json ├── .env ├── vercel.json └── public/ └── index.html -
Move your HTML file:
- Create a
public/folder - Move
index.htmlinto thepublic/folder
- Create a
-
Start the server:
npm run dev
-
Open browser:
- Go to
http://localhost:3001
- Go to
-
Prepare files:
- Ensure folder structure is correct (HTML file in
public/folder) - Make sure
vercel.jsonis in root directory
- Ensure folder structure is correct (HTML file in
-
Deploy to Vercel:
- Install Vercel CLI:
npm i -g vercel - Run:
vercel - Follow prompts
- Install Vercel CLI:
-
Set environment variables in Vercel:
- Go to your Vercel dashboard
- Click on your project
- Go to Settings → Environment Variables
- Add:
SPOTIFY_CLIENT_ID= your client IDSPOTIFY_CLIENT_SECRET= your client secret
-
Update Spotify Redirect URI:
- In Spotify Developer Dashboard
- Add your Vercel URL to Redirect URIs:
https://your-app.vercel.app
- ✅ CORS Issues: Backend proxy handles all Spotify API calls
- ✅ Security: Client secret stays on server, not exposed in browser
- ✅ Authentication: Proper token management with automatic refresh
- ✅ Error Handling: Better error messages and retry logic
- ✅ Performance: Token caching and reuse
corriente-sound/
├── server.js # Express backend proxy
├── package.json # Dependencies
├── .env # Environment variables (local)
├── vercel.json # Vercel configuration
└── public/
└── index.html # Your frontend app
- Frontend makes requests to your backend (
/api/...) - Backend handles authentication and proxies requests to Spotify
- Spotify API returns data to backend
- Backend sends clean data back to frontend
- Frontend displays results and handles audio playback
POST /api/auth- Authenticate with SpotifyGET /api/search?q=query- Search for songsGET /api/audio-features/:trackId- Get song audio featuresGET /api/recommendations?params- Get song recommendations
- CORS errors: Make sure backend is running and frontend is calling correct API_BASE
- Auth errors: Check Spotify credentials in environment variables
- No audio: Some songs don't have preview URLs available
- Search not working: Verify authentication completed successfully