These examples are runnable TypeScript files for local development.
Install dependencies first:
bun installFill in the example credential file:
examples/.envUses Spotify's client credentials flow, then searches public catalog data.
Required environment variables:
SPOTIFY_CLIENT_ID=your-client-id
SPOTIFY_CLIENT_SECRET=your-client-secretOptional:
SPOTIFY_QUERY="Daft Punk"
SPOTIFY_MARKET=USRun:
bun run example:client-credentials-searchFetches the current Spotify profile and recent playlists.
Run OAuth once first. It opens Spotify in your browser and writes the tokens into
examples/.env automatically:
bun run example:oauth-loginRequired before OAuth login:
SPOTIFY_CLIENT_ID=your-client-id
SPOTIFY_REDIRECT_URI=http://127.0.0.1:5173/callbackRun:
bun run example:user-profile-playlists