šŸŽ§ Discovery Radar

A personal Spotify discovery app that breaks you out of the same 50 artists.

Discovery runs on the Last.fm API (open, read-only with an API key). It computes your sound profile from Last.fm genre/mood tags, then crawls the similar-artist graph for under-discovered acts (ranked by tag-match and listener-count obscurity). Because you listen on Spotify, the app maps each Last.fm track to a real Spotify track URI (via search) and writes your picks to a Spotify playlist — and the weekly cron keeps it fresh.

How it works

Rendering mermaid diagram...
  • index.ts — Hono server: Spotify OAuth, session cookie, /api/me, /api/profile, /api/discover, /api/save.
  • lib/spotify.ts — OAuth + Spotify API client. Used for your top artists (discovery seeds), mapping tracks to Spotify URIs, and writing playlists.
  • lib/lastfm.ts — Last.fm client: similar artists, tags, listener counts, top tracks.
  • lib/taste.ts — taste profile (Last.fm tags), discovery, Spotify playlist writer.
  • lib/db.ts — SQLite storage for per-user Spotify tokens + playlist id.
  • frontend/ — React app with a constellation map + grid views.
  • cron/refresh.ts — weekly job that refreshes each user's "Discovery Radar" playlist (Sundays 12:00 UTC).

Setup

  1. Create a Last.fm API account at https://www.last.fm/api/account/create and copy your API key.
  2. Set the Last.fm key below.

šŸ‘‰ Add LASTFM_API_KEY here: https://www.val.town/x/test_account_001/discovery-radar/environment-variables?key=LASTFM_API_KEY

  1. Spotify (needed only for your listening): create a Spotify app at https://developer.spotify.com/dashboard, add the redirect URI https://discovery-radar.val.run/auth/callback, and set the two env vars below.

šŸ‘‰ Add SPOTIFY_CLIENT_ID here: https://www.val.town/x/test_account_001/discovery-radar/environment-variables?key=SPOTIFY_CLIENT_ID

šŸ‘‰ Add SPOTIFY_CLIENT_SECRET here: https://www.val.town/x/test_account_001/discovery-radar/environment-variables?key=SPOTIFY_CLIENT_SECRET

SPOTIFY_REDIRECT_URI is optional — it defaults to the callback URL above.

  1. Open the app, hit Connect Spotify, authorize, and your taste profile and a galaxy of discovered artists appear. Hit Save to write them to a private "Discovery Radar" Spotify playlist.

Notes

  • Discovery = Last.fm; playlists = Spotify. This app's Spotify grant is restricted (no audio-features / recommendations / browse), so discovery moved entirely to Last.fm's open API. Spotify read is only used for your top artists and for mapping tracks to URIs — and Spotify write (playlists) works fine.
  • Obscurity is driven by Last.fm listener counts (logged to a 0–100 "Popularity").
  • The match % is tag overlap with your taste profile; the radar is your tag profile vs each artist's tags.
  • The weekly cron refreshes the playlist for every connected user.
  • If "Save" errors with "Spotify blocked playlist access", the token is missing playlist-modify-* scopes — disconnect and reconnect Spotify to re-consent.