- Cache Components cache each query with
'use cache', name the data withcacheTag, and set its lifetime withcacheLife, so repeated reads come from the cache until a tag is invalidated. - Partial Prefetching prefetches one shared App Shell per route. Links with
prefetch={true}also resolve dynamicparamsandsearchParams, including the cached content behind them while uncached data streams after navigation. - Hover-triggered prefetch delays URL-specific prefetches in long track lists until the pointer or focus reaches a link, avoiding a separate prefetch for every destination in view.
- Server Functions run mutations such as favoriting a track or creating a playlist on the server, and invalidate only the tags they change with
updateTag, which re-prefetches the affected routes so they stay instant and reflect the change. - React Compiler memoizes components and hooks automatically, so the code needs no manual
useMemooruseCallback. - View Transitions animate content updates and route changes as you move through the player.
- Async React keeps the UI interactive during server work with
Suspense,useOptimistic,useTransition,useActionState,useFormStatus, anduse. - vGPU cover art pairs theme-matched, beat-reactive shaders with instant pre-rendered fallbacks.
- Fast Link starts eligible mouse navigation on press. The sidebar still prefetches playlist details on hover or focus, and keyboard, touch, and modified clicks keep their usual behavior.
NextBeats runs on Postgres. Set DATABASE_URL in .env.local, then:
pnpm install
pnpm run prisma.push
pnpm run prisma.seed
pnpm run devTo regenerate a compact track, playlist, and genre cover from the current database:
pnpm covers:iconsRun locally without Postgres
Drop this prompt into your agent to swap the datasource for SQLite:
Set up NextBeats to run locally on SQLite instead of Postgres. Swap
provider = "postgresql"toprovider = "sqlite"inprisma/schema.prisma. Replace@prisma/adapter-pgwith@prisma/adapter-better-sqlite3inlib/db.tsandprisma/seed.ts, usingnew PrismaBetterSqlite3({ url })whereurlisprocess.env.DATABASE_URLwith thefile:prefix stripped. Remove anymode: 'insensitive'Prisma filter options since SQLite doesn't support them. Install@prisma/adapter-better-sqlite3andbetter-sqlite3, uninstall@prisma/adapter-pg,pg, and@types/pg. WriteDATABASE_URL=file:./prisma/dev.dbto.env.local.
The schema is otherwise identical, so the rest of the app behaves the same as production.
The end-to-end tests use @next/playwright with the instant() API to assert that loading states appear and that navigations stay instant, and they run in CI.
pnpm test:e2e- Next.js 16.3: App Router, Cache Components, Server Functions
- React 19 with React Compiler: Suspense, View Transitions,
useOptimistic - TypeScript and Tailwind CSS v4
- Prisma 7 on PostgreSQL
- vGPU for animated WebGPU cover art and pre-rendered first frames
- Web Audio API for procedural per-genre synthesis