Skip to content
Tate Clothier

03

Discoverify

Problem
Spotify closed its recommendation, related-artist and audio-feature endpoints to new apps, and Development Mode caps search and sign-ins. Recommending unheard songs means building the engine yourself.
My role
Designed and built all of it: the AI guide, the dashboard, the recommendation engine, the Manual Builder and the public demo.
Stack
Next.js 16 · React 19 · TypeScript · Zod · Claude via the Anthropic SDK · Spotify Web API · Last.fm · Wikipedia · Vercel
Outcome
Live, with a public demo anyone can open without a Spotify account. Development Mode limits the full app to five allowlisted Spotify accounts.
Discoverify demo dashboard for the sample listener Sam: “mostly indie, and lately more jazz”, a chart of genres heating up and cooling off, and the guide panel.
01

Problem

Discoverify finds songs you haven't heard yet, picked from what you already play on Spotify. In November 2024 Spotify stopped giving new apps the three endpoints that would have made that easy: recommendations, related artists and audio features.

In February 2026 it tightened Development Mode further: at most 10 search results per request, no batch lookups and no popularity data. Development Mode apps don't get artist genres either.

Development Mode also limits an app to five allowlisted Spotify accounts, and Spotify now grants wider access only to organizations with 250,000+ monthly active users. So almost nobody who wants to try the app can sign in to it.

02

What I built

The guide is a chat that knows your listening. Ask it what genre Crystal Castles is or who your top artist has been lately, or have it build a playlist of songs you've never played. Replies stream in as they're written, and nothing goes to Spotify until you click Save. The Discover dashboard charts your top genres, the genres heating up or cooling off, your favorite decades, and your top artists and tracks over three time ranges. The Manual Builder does the playlist job as a form, for people who'd rather not chat.

Under the guide and the builder is a recommendation engine I built myself. It weights genres and artists across three time ranges into a taste profile, gathers candidates through Spotify search with genre and year filters, scores artists on genre overlap, Last.fm similarity to your favorites and search rank, then draws them in score-weighted random order and drops anything you've already heard. A 25-song playlist costs about 25 Spotify API calls. A public demo runs the whole app on a recorded sample listener, so anyone can try it without a Spotify account.

Next.js 16 App Router on Vercel
Landing page, the /discover app, and nine route handlers with Zod 4 request validation
MusicService interface
The only path from routes, guide tools and UI to a music provider: Spotify in production, a recorded catalog in the demo
Recommendation engine
Taste profile → genre- and year-filtered search → artist scoring and score-weighted sampling → heard-song filter
Heard-song filter
Top tracks, the last 50 plays, up to 500 liked songs and followed artists, matched by track ID and by artist + title
Last.fm and Wikipedia
Similar artists, listener tags and genre backfill from Last.fm; artist bios from Wikipedia's REST API
Claude guide
Tool-use loop streamed as NDJSON events, with nine tools: top items, artist and discography lookups, genre exploration, song finding, playlist edits, save offers, suggested replies and screen changes
Session
AES-256-GCM encrypted httpOnly cookie, no database; the conversation stays in the browser tab
Demo mode
In-memory fake of the Spotify Web API serving a recorded sample listener: 240 artists and 1,279 songs
03

Technical decisions

  1. 01

    Put every music provider behind one MusicService interface.

    Routes, guide tools and UI components only ever talk to that interface. Spotify is one implementation and the demo's recorded catalog is another, so demo mode needed no changes to the routes or the guide's tools.

  2. 02

    Write my own recommendation engine.

    Spotify's recommendation, related-artist and audio-feature endpoints are closed to new apps, and search returns 10 results at a time, so candidates come from genre- and year-filtered search. The depth setting decides whether the engine samples the top of the results or the long tail, and artists are drawn in score-weighted random order so every batch is different.

    Trade-offWithout audio features there's no matching on tempo or energy; similarity comes from genres, Last.fm and search position.

  3. 03

    Match heard songs by artist and title as well as track ID.

    A remaster has a different track ID from the original, so an ID check alone would recommend songs people already know. The filter can also drop known artists, explicit tracks, intros and skits.

  4. 04

    Send Claude only the current reply's tool calls.

    Earlier turns go back as plain text, plus a summary of the user's taste and the current playlist draft. Requests stay small, and their fixed parts stay identical from turn to turn, so prompt caching keeps working.

    Trade-offThe guide can't re-read raw tool results from earlier turns, so anything it needs later has to be in the summary.

  5. 05

    Run the demo on recorded data through the real engine.

    Canned results would only prove the UI renders. Instead, an in-memory fake of the Spotify Web API serves a recording of a made-up listener (30 real artists across six genres; 240 artists and 1,279 songs in all), and the real profile builder and recommendation engine run on it unchanged. Demo results respond to genre, era and depth like the real thing. A script records the data with the app's own client-credentials token, so no user account is involved.

    Trade-offThe recording is a fixed catalog. Artist lookups outside it go to Spotify live (read-only, a 6-second timeout, capped at 30 a minute so public traffic can't use up the rate limit real users share); song picks never do.

  6. 06

    Keep the public demo away from real users and real spend.

    Demo visitors get their own session type, so trying the demo never replaces a real user's session. Saves are simulated and nothing is written to Spotify. The guide uses a separate Anthropic key from a spend-limited workspace and runs Sonnet 5.5 at low effort, with a 10-message cap per visitor counted in the encrypted session cookie.

  7. 07

    Keep the session in an encrypted cookie instead of a database.

    Sessions live in an AES-256-GCM encrypted httpOnly cookie and the conversation stays in the browser tab, so there is no database to host or secure.

    Trade-offNothing lives server-side, so history doesn't follow a user to another device.

04

Outcome

  • Live at discoverify-nine.vercel.app. The public demo opens the whole app on a sample listener with no sign-in: dashboard, artist pages, Manual Builder, playlist editor and a live AI guide capped at 10 messages.
  • 72 tests on Node's built-in test runner cover the engine, taste profile, agent loop, service layer, Last.fm client, chart layout and the demo's fake Spotify API. They run the real engine against in-memory fakes of Spotify.
  • Signing in with your own Spotify account is open to five allowlisted accounts while the app is in Development Mode; everyone else uses the demo.
05

Stack

TypeScript
End to end, including the MusicService interface that Spotify and the demo both implement
React
React 19 dashboard, artist pages, builder, playlist editor and guide panel
Next.js
Next.js 16 App Router for the pages and nine route handlers
Node.js
Runtime for the route handlers; 72 tests on Node's built-in test runner
REST API design
Route handlers with Zod 4 request validation; the chat route streams NDJSON events
OAuth 2.0
Spotify Authorization Code flow for users; client credentials for the demo's read-only catalog data
Vercel
Hosting
Spotify Web API
Top items, recent plays, liked songs and follows; genre- and year-filtered search; playlist creation
Claude API
Opus 5.5 with streaming, tool use, prompt caching and adaptive thinking; the demo runs Sonnet 5.5 at low effort
Agentic workflow design
A guide with nine tools that looks up artists, explores genres and edits a playlist draft; it saves only when the user clicks Save
Recommendation systems
Taste profile, filtered candidate search, score-weighted sampling and a heard-song filter, in place of Spotify's removed endpoints
AES-256-GCM encryption
The session lives in an encrypted httpOnly cookie, so there is no database