Public
Full-text search across all your Spotify playlists
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data ā all from the browser, and deployed in milliseconds.
Full-text search across all your Spotify playlists. Search by track name, artist, album, or playlist name.
- Go to the Spotify Developer Dashboard
- Click Create app
- Fill in any name/description
- Set the Redirect URI to:
https://spotify-search.val.run/auth/callback - Accept the terms and create
- Open the app settings and copy your Client ID and Client Secret
š Add SPOTIFY_CLIENT_ID here: https://www.val.town/x/tod/spotify-playlist-search/environment-variables?key=SPOTIFY_CLIENT_ID
š Add SPOTIFY_CLIENT_SECRET here: https://www.val.town/x/tod/spotify-playlist-search/environment-variables?key=SPOTIFY_CLIENT_SECRET
- Visit spotify-search.val.run
- Click Connect Spotify and authorize
- Click Sync to fetch all your playlists
- Search across all your tracks!
- Spotify OAuth ā Authorization Code flow with
playlist-read-privateandplaylist-read-collaborativescopes - SQLite FTS5 ā Full-text search index across track name, artist, album, and playlist name
- Sync ā Fetches all playlists and tracks from Spotify, indexes them in SQLite with BM25 ranking
- Tokens ā Refresh token stored in blob storage; access tokens auto-refresh when expired
spotify.ts ā Spotify API client (OAuth, pagination, token refresh)
db.ts ā SQLite FTS5 schema + search with BM25 ranking
sync.ts ā Orchestration: fetch all playlists ā fetch all tracks ā reindex
main.ts ā Hono HTTP server (routes for auth, sync, search, UI)
index.html ā Search UI (dark Spotify-themed, debounced live search)