A modern TypeScript Next.js application for curating and discovering Spotify playlists. Built with production-grade practices and ready to deploy on Vercel.
- 🎵 View your recent top tracks
- ⭐ See your long-term favorite tracks
- 🎧 Get personalized recommendations based on your listening history
- 🎤 Browse tracks from your favorite artists
- 📜 Discover forgotten playlists (Your Top Songs from past years)
- 🎮 Built-in Spotify Web Playback SDK player
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- Spotify API: spotify-web-api-node
- Spotify Player: Official Spotify Web Playback SDK (latest version)
- Deployment: Vercel
- A Spotify Developer account
- Node.js 18+ installed
- npm or yarn
-
Clone the repository (or navigate to the project directory)
-
Install dependencies:
npm install
-
Set up environment variables:
Create a
.env.localfile in the root directory:NEXT_PUBLIC_SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret SPOTIFY_REDIRECT_URI=http://localhost:3000 NEXT_PUBLIC_SPOTIFY_REDIRECT_URI=http://localhost:3000
Important Notes:
NEXT_PUBLIC_SPOTIFY_CLIENT_IDis prefixed withNEXT_PUBLIC_because it's used in client-side codeNEXT_PUBLIC_SPOTIFY_REDIRECT_URIshould match exactly what you set in Spotify app settings- The client secret should NEVER be exposed to the client
- For production, use HTTPS URLs (e.g.,
https://your-app.vercel.app)
To get your Spotify credentials:
- Go to Spotify Developer Dashboard
- Create a new app
- Copy the Client ID and Client Secret
- Add your redirect URI to the "Redirect URIs" field - this must match EXACTLY:
- For local development:
http://localhost:3000 - For production:
https://your-app.vercel.app(or your production URL)
- For local development:
- Important: The redirect URI in your Spotify app settings must match exactly what you use in the environment variables
-
Run the development server:
npm run dev
-
Open your browser: Navigate to http://localhost:3000
-
Push your code to GitHub
-
Import to Vercel:
- Go to Vercel
- Click "New Project"
- Import your GitHub repository
-
Configure Environment Variables: In Vercel project settings, add:
NEXT_PUBLIC_SPOTIFY_CLIENT_ID(your Spotify Client ID)SPOTIFY_CLIENT_SECRET(your Spotify Client Secret)SPOTIFY_REDIRECT_URI(your Vercel deployment URL, e.g.,https://your-app.vercel.app)NEXT_PUBLIC_SPOTIFY_REDIRECT_URI(same as above, must match exactly)
-
Update Spotify App Settings:
- Go to your Spotify app settings
- Add your Vercel URL to Redirect URIs (e.g.,
https://your-app.vercel.app) - Critical: The redirect URI in Spotify must match EXACTLY what you set in
NEXT_PUBLIC_SPOTIFY_REDIRECT_URI - Make sure to use HTTPS (not HTTP) for production URLs
- You can add multiple redirect URIs (one for localhost, one for production)
-
Deploy: Vercel will automatically deploy your app!
spotify-playlist-curator/
├── app/
│ ├── api/ # API routes (Next.js API routes)
│ │ ├── auth/ # Authentication endpoints
│ │ ├── tracks/ # Track-related endpoints
│ │ ├── artists/ # Artist-related endpoints
│ │ └── playlists/ # Playlist endpoints
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Home page
│ └── globals.css # Global styles
├── components/ # React components
│ ├── Dashboard.tsx # Main dashboard
│ ├── Login.tsx # Login page
│ ├── Player.tsx # Spotify player
│ ├── TrackCard.tsx # Individual track card
│ ├── TrackCollection.tsx # Collection of tracks
│ └── TabContent.tsx # Tab content wrapper
├── lib/ # Utility functions
│ └── spotify.ts # Spotify API helpers
├── types/ # TypeScript type definitions
│ └── spotify.ts # Spotify API types
└── package.json
POST /api/auth/login- Exchange authorization code for access tokenPOST /api/auth/refresh- Refresh access tokenGET /api/tracks/recent- Get user's top tracksGET /api/tracks/recommendations- Get track recommendationsGET /api/artists/top- Get user's top artistsGET /api/artists/tracks- Get top tracks for an artistGET /api/playlists/forgotten- Get forgotten playlists
MIT