betterlist is a Spotify playlist management app built with TanStack Start.
- Create, rename, and edit playlists
- Add, remove, and bulk delete tracks
- Remove duplicate tracks
- Browse saved albums, artists, and liked songs
- Search across all content
- View artist discographies and album details
- Personal listening stats (short, medium, and long-term)
- Recently played tracks and top artists
Frontend
Backend
- Cloudflare Workers - Edge computing platform
- Better Auth - Authentication library
- Drizzle ORM - Database ORM
- Cloudflare D1 - SQLite database
- Spotify Web API - Music data API
- Node.js 18+
- Wrangler CLI
- Cloudflare account
- Spotify Developer account
-
Clone the repository:
git clone https://github.com/yourusername/betterlist.git cd betterlist -
Install dependencies:
bun install # or npm install -
Authenticate with Cloudflare:
npx wrangler login
-
Create a D1 database:
npx wrangler d1 create betterlist
-
Create a
.dev.varsfile in the root directory:# Cloudflare (Required) CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id CLOUDFLARE_DATABASE_ID=your_d1_database_id CLOUDFLARE_D1_TOKEN=your_cloudflare_api_token # Better Auth (Required) BETTER_AUTH_SECRET=your_random_secret_key BETTER_AUTH_URL=<ngrok_url> # Spotify OAuth (Required) SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
-
Set up the database schema:
npx drizzle-kit push
-
Start ngrok tunnel (in a separate terminal):
ngrok http 3000
-
Run the development server:
bun run dev # or npm run dev -
Open your browser and navigate to your ngrok URL
Deploy to Cloudflare Workers:
bun run deploy
# or
npm run deployThis builds the app and deploys it to Cloudflare Workers using the configuration in wrangler.jsonc.
- Install ngrok and authenticate it
- In a new terminal, create a tunnel:
ngrok http 3000
- Copy the HTTPS URL (e.g.,
https://abc123.ngrok-free.app)
- Go to Spotify Developer Dashboard
- Select your app and click Edit Settings
- Add the following Redirect URI:
https://<YOUR_NGROK_URL>/api/auth/callback/spotify - Save the changes
dev- Start the development serverbuild- Build for productionpreview- Preview the production build locallydeploy- Build and deploy to Cloudflare Workerscf-typegen- Generate Cloudflare Workers typesfmt- Format code with oxfmtfmt:check- Check code formatting
Issues: GitHub Issues