Turn your complete Last.fm listening history into Apple Music playlists — with a rule-based playlist engine (forgotten favorites, obsessions, rediscoveries, time capsules…), confidence-scored catalog matching, and a manual review step for anything uncertain.
npm install
cp .env.example .env.local # then fill in the credentials below
npm run dev # http://localhost:3210Create an API account at https://www.last.fm/api/account/create and put the
API key in .env.local as LASTFM_API_KEY. Optionally set
LASTFM_USERNAME (you can also enter it on the Sync page).
Requires an Apple Developer Program membership ($99/yr):
- developer.apple.com → Certificates, Identifiers & Profiles
- Identifiers → create a Media ID (e.g.
media.com.you.spotilast) - Keys → create a key with Media Services (MusicKit) enabled, associate
it with the Media ID, download the
.p8file (one-time download!) - In
.env.local, setAPPLE_TEAM_ID,APPLE_KEY_ID, andAPPLE_PRIVATE_KEY_PATH(absolute path to the.p8).
Secrets stay server-side; the browser only ever receives a signed short-lived
developer token. Your listening data, match memory, presets and playlist
history live in a SQLite database at data/spotilast.db.
For a public Railway deploy on lastfm.pokefinder.io, set:
APP_URL=https://lastfm.pokefinder.io
SPOTILAST_SESSION_SCOPED=true
SPOTILAST_DATA_DIR=/dataThen configure Spotify with the production callback shown in Settings and
mount a persistent volume at /data so each visitor keeps their own session
state across refreshes.
Sync (resumable, incremental) → Playlist Builder (rules/presets) → Preview (edit, reorder, add) → Match (exact / high / needs-review / unmatched) → Match Review (accept / choose / search / skip) → Create in Apple Music.
src/lib/lastfm.ts— throttled Last.fm client with retries/backoffsrc/lib/sync.ts— resumable page-walking sync enginesrc/lib/stats.ts+rules.ts— destination-agnostic analytics + rule enginesrc/lib/normalize.ts+matching.ts— title/artist normalization and confidence-scored Apple Music matching (cached in SQLite)src/lib/destinations/—PlaylistDestinationinterface; implement it to add Spotify or another destination without touching the analysis layers