A personal blog page server for displaying your Spotify music with a React frontend and Express API backend.
- 🎵 Now Playing - See what you're currently listening to
- 📝 Recently Played - View your recent listening history
- ⭐ Top Tracks - Display your most played tracks
- 🎨 Beautiful Spotify-themed UI
- Go to Spotify Developer Dashboard
- Create a new app
- Copy your Client ID and Client Secret
- Add
http://localhost:3001/callbackto Redirect URIs
You'll need to get a refresh token. You can use this URL (replace CLIENT_ID):
https://accounts.spotify.com/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http://localhost:3001/callback&scope=user-read-currently-playing%20user-read-recently-played%20user-top-read
Then exchange the code for a refresh token using curl or Postman.
Update the .env file with your credentials:
SPOTIFY_CLIENT_ID=your_client_id
SPOTIFY_CLIENT_SECRET=your_client_secret
SPOTIFY_REFRESH_TOKEN=your_refresh_token
PORT=3001npm installTerminal 1 - Start the API server:
npm run serverTerminal 2 - Start the React dev server:
npm run devVisit http://localhost:5173 to see your Spotify music blog!
GET /api/now-playing- Get currently playing trackGET /api/recently-played?limit=10- Get recently played tracksGET /api/top-tracks?limit=10&time_range=medium_term- Get top tracksGET /api/top-artists?limit=10&time_range=medium_term- Get top artists
npm run build
npm run preview