A beautiful, customizable Spotify overlay for OBS Studio that displays your currently playing track in real-time with stunning animations and dynamic styling.
Watch the Spotify OBS Overlay in action with default settings on OBS Studio:
📹 Direct link: Watch on GitHub
- Node.js (v14 or higher)
- A Spotify Account
- OBS Studio (for using the overlay)
-
Clone the repository
git clone https://github.com/DrSaeedHub/OBS-Spotify-Overlay.git cd OBS-Spotify-Overlay -
Install dependencies
npm install
-
Set up environment variables
Create a
.envfile in the root directory:SPOTIFY_CLIENT_ID=your_spotify_client_id_here SPOTIFY_CLIENT_SECRET=your_spotify_client_secret_here BASE_URL=http://localhost:3000 REDIRECT_URI=http://localhost:3000/auth/callback PORT=3000
- Go to Spotify Developer Dashboard
- Click "Create App"
- Fill in the app details:
- App name: Your app name
- Description: Spotify OBS Overlay
- Website:
http://localhost:3000 - Redirect URI:
http://localhost:3000/auth/callback
- Click "Add" and save
- Copy your Client ID and add it to your
.envfile - Click "Settings" in your app
- Under "Redirect URIs", add:
http://localhost:3000/auth/callback
-
Start the server
npm start
-
Open your browser
http://localhost:3000 -
Login with Spotify
- Click "Login with Spotify"
- Authorize the application
- You'll be redirected back to the dashboard
-
Get Your Widget URL
- After logging in, you'll see your unique widget URL
- Click the "Copy" button to copy it
- Keep the full URL (including anything after
#)
-
Add to OBS
- Open OBS Studio
- Click the "+" button in Sources
- Select "Browser Source"
- Click "OK" without entering anything
- In the Properties dialog:
- URL: Paste your widget URL
- Width: 800px
- Height: 600px
- Enable "Shutdown source when not visible"
- Enable "Refresh browser when scene becomes active"
- Click "OK"
-
Position and Customize
- Move and resize the overlay as needed
- Return to the web interface to customize appearance
- Show/Hide Elements: Toggle visibility of song name, artist, progress bar, Spotify badge, and album cover
- Widget Styles: Choose between Default, Horizontal, and Retro themes
- Transparent - No background
- Solid Color - Customizable color and opacity
- Liquid Glass - Glassmorphism effect with blur and tinting
- Text Color - Customize song and artist text colors
- Text Shadow - Add depth with customizable shadows
- Text Glow - Add a glowing effect to the text
- Use Track Colors - Automatically apply dominant colors from album artwork
- Enable Border - Add a border around the widget
- Border Styles:
- Solid - Single color border
- Gradient - Two-color gradient border
Enable "Use Track Color" for any element to automatically apply the dominant color from the current album artwork:
- Background
- Glass tint
- Text color
- Shadow color
- Glow color
- Border colors
The overlay automatically extracts and applies colors from album artwork for dynamic, vibrant styling
- Authentication: Uses Spotify OAuth 2.0 with PKCE (Proof Key for Code Exchange) for secure authentication
- Real-time Updates: Polls Spotify API every 10 seconds by default (
refreshSecondsorrefreshMsURL params to change it) - Dynamic Theming: Extracts dominant colors from album artwork using the ColorThief library
- Progress Tracking: Local progress calculation based on API timestamps (smooth progress between API polls)
- Token Management: Automatic token refresh before expiration
- Pause/Idle Behavior: Pausing freezes the progress bar and auto-hides the widget after 5 seconds (configurable via
hideOnPause+pauseHideSeconds/pauseHideMs)
GET /auth/login- Initiates OAuth flowGET /auth/callback- OAuth callback handlerGET /api/current-track- Fetches currently playing trackPOST /api/refresh-token- Refreshes access token
OBS-Spotify-Overlay/
├── public/
│ ├── app.js # Login page logic
│ ├── widget.js # Widget display logic
│ ├── index.html # Main dashboard
│ ├── widget.html # Widget overlay
│ └── styles.css # All styling
├── server.js # Express server
├── package.json # Dependencies
└── README.md # This file
- Make sure Spotify is playing a track
- Check that the browser source in OBS isn't paused
- Verify your internet connection
- Click "Disconnect Spotify" and log in again
- Check that your refresh token is valid
- Verify the URL is correct in OBS
- Check that the server is running (
npm start) - Ensure the browser source size matches (800x600 for default)
Render offers free hosting for web services with automatic HTTPS.
Steps to deploy:
- Push your code to GitHub
- Sign up at render.com (free with GitHub)
- Click "New +" → "Web Service"
- Connect your GitHub repository
- Configure the service:
- Name: spotify-obs-overlay (or any name)
- Environment: Node
- Build Command:
npm install - Start Command:
npm start
- Go to "Environment" tab and add:
BASE_URL- https://your-app-name.onrender.comSPOTIFY_CLIENT_ID- Your Spotify Client IDSPOTIFY_CLIENT_SECRET- Optional (not required for PKCE)REDIRECT_URI- https://your-app-name.onrender.com/auth/callbackPORT- Leave empty (Render sets it automatically)
- Click "Create Web Service"
- Once deployed, update your Spotify app's Redirect URI to:
https://your-app-name.onrender.com/auth/callback - Your site will be available at:
https://your-app-name.onrender.com
Important Notes:
- Free tier may spin down after 15 minutes of inactivity (services auto-wake on requests)
- First request after spin-down can take 30-60 seconds
- Your OBS overlay URL is shown on the dashboard after login (copy/paste it into OBS and keep the full URL, including anything after
#)
Fly.io offers free hosting with fast cold starts.
Steps to deploy:
- Install Fly CLI: https://fly.io/docs/getting-started/installing-flyctl/
- Run in your project:
fly launch - Follow prompts, select your region
- Set environment variables:
fly secrets set BASE_URL=https://your-app.fly.dev fly secrets set SPOTIFY_CLIENT_ID=your_client_id fly secrets set REDIRECT_URI=https://your-app.fly.dev/auth/callback
- Deploy:
fly deploy - Your site will be at:
https://your-app.fly.dev
Railway offers $5/month free credit (enough for light usage).
Steps to deploy:
- Sign up at railway.app
- Click "New Project" → "Deploy from GitHub repo"
- Connect your repository
- Railway auto-detects Node.js projects
- Add environment variables in the dashboard:
BASE_URL- https://your-app-name.up.railway.appSPOTIFY_CLIENT_ID- Your Spotify Client IDREDIRECT_URI- https://your-app-name.up.railway.app/auth/callback
- Deploy automatically happens on push to main
Heroku offers free dynos with limitations.
Steps to deploy:
- Install Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli
- Login:
heroku login - Create app:
heroku create your-app-name - Set environment variables:
heroku config:set BASE_URL=https://your-app-name.herokuapp.com heroku config:set SPOTIFY_CLIENT_ID=your_client_id heroku config:set REDIRECT_URI=https://your-app-name.herokuapp.com/auth/callback
- Deploy:
git push heroku main - Your site will be at:
https://your-app-name.herokuapp.com
After deploying, update your Spotify Developer Dashboard:
- Go to your app settings
- Under "Redirect URIs", add your deployed URL:
- Render:
https://your-app-name.onrender.com/auth/callback - Fly.io:
https://your-app-name.fly.dev/auth/callback - Railway:
https://your-app-name.up.railway.app/auth/callback - Heroku:
https://your-app-name.herokuapp.com/auth/callback
- Render:
- Save changes
Once deployed, get your widget URL for OBS:
- Go to
https://your-deployed-url.com - Log in with Spotify
- Copy your unique widget URL
- Keep the full URL (including anything after
#) - Add it as a Browser Source in OBS
npm startThe server will run on http://localhost:3000
- Add a new class to
styles.css(e.g.,.widget-container.your-style) - Add a style option in
index.html - Update
selectStyle()function inapp.js
- Tokens are handled client-side (URL hash for OBS/incognito support, localStorage when available); the server does not store user tokens
- The server only acts as a proxy to avoid CORS issues
- Never commit your
.envfile with credentials - The application uses HTTPS-ready redirect URIs
- Spotify Account: Free or Premium
- Spotify Scopes Required:
user-read-currently-playinguser-read-playback-stateuser-read-email
MIT License - See LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and feature requests, please open an issue on GitHub.
- Spotify Web API
- ColorThief for color extraction
- OBS Studio
Made with ❤️ for streamers and music lovers
