How manasbir/spotify-redirect works
This is a Spotify share-link redirect tool: a visitor opens a track-specific page, sees track details, and can add that track to their Spotify queue. If not connected, the client starts Spotify authorization, the callback exchanges the code and stores tokens in browser storage, then returns to the track page. Track metadata uses server credentials; queue changes use the visitor’s access token. The README also names Cloudflare Workers and Next.js as the hosting framework. Wiring is based on sampled source; no database-backed behavior is evident.
Main entry points: addToQueue.tsx Queue control · auth.ts Spotify auth · callback/page.tsx OAuth callback · [trackId]/page.tsx Track page
Components 11
Track experience
- Track page
src/app/track/[trackId]/page.tsx - Queue control
src/app/track/[trackId]/addToQueue.tsx
Spotify connection
- OAuth callback
src/app/connect/callback/page.tsx - Browser tokens
- Spotify auth
src/app/spotify/auth.ts
Spotify integration
- Spotify exports
src/app/spotify/index.ts - Track lookup
src/app/spotify/track.ts - Queue request
src/app/spotify/playback.ts
Other components
- Visitor
- Spotify Accounts
- Spotify Web API
Connections 21
- Visitor → Track page: opens track
- Track page → Track lookup: loads metadata
- Track lookup → Spotify auth: gets server token
- Spotify auth → Spotify Accounts: requests token
- Track lookup → Spotify Web API: fetches track
- Track page → Queue control: renders control
- Visitor → Queue control: requests queue
- Queue control → Browser tokens: reads tokens
- Queue control → Spotify auth: creates auth URL
- Queue control → Spotify auth: refreshes token
- Spotify auth → Spotify Accounts: refreshes credentials
- Queue control → Browser tokens: stores refreshed tokens
- Queue control → OAuth callback: follows redirect
- OAuth callback → Browser tokens: checks state
- OAuth callback → Spotify auth: exchanges code
- Spotify auth → Spotify Accounts: exchanges code
- OAuth callback → Browser tokens: stores credentials
- OAuth callback → Track page: redirects to track
- Queue control → Spotify exports: calls queue export
- Spotify exports → Queue request: exports queue action
- Queue request → Spotify Web API: adds track to queue