> Site index for LLMs: https://www.nandan.fyi/llms.txt

# Music

> A music streaming app - search songs and albums, build playlists, and download for offline listening.

- Published: 2023-06-14
- Source: https://github.com/nandan-varma/songs
- Live: https://songs.nandanvarma.com
- Canonical: https://www.nandan.fyi/projects/music

I wanted a clean music app with no ads, no subscription walls, and the ability to actually download songs. So I built the full stack - a middleware layer, API surface, and a proper web client on top.

## Features

- Search songs, albums, and playlists
- Stream directly in the browser
- Download tracks for offline use, cached in IndexedDB
- Playlist management with drag-and-drop reordering
- Login to save your library across devices
- Server-side data fetching with TanStack Query

## Key decisions

- **Three-layer architecture (client → middleware → data source)** — the middleware layer insulates the client from the upstream data shape; if the source changes, only the middleware needs updating and the client remains unchanged
- **IndexedDB over the Cache API for downloaded tracks** — IndexedDB gives structured, queryable storage with larger quotas than localStorage; the Cache API is designed for HTTP responses, not binary audio blobs that need to be looked up by track ID
- **Zustand for player state, TanStack Query for server state** — keeping them separate avoids the temptation to put server data in the player store; TanStack Query handles staleness and refetching, Zustand handles playback position and queue without coupling

## Future directions

- Export and import playlists
- Recommendation system based on listening history

## Built with

- [Next.js](https://nextjs.org)
- [Drizzle ORM](https://orm.drizzle.team/) + [Neon](https://neon.tech/) - PostgreSQL
- [Better Auth](https://www.better-auth.com/) - authentication
- [Zustand](https://zustand-demo.pmnd.rs/) - client state
- [TanStack Query](https://tanstack.com/query) - server state
- [tailwindcss](https://tailwindcss.com)
- Deployed on [Vercel](https://vercel.com)
