0
Challenge · 15Data & Reads
Reading data with Prisma in RSC
Dataused in ~88% of apps
Half of all Next.js tutorials teach this wrong: they spin up an /api/route, then fetch() it from the page just to read a row. In the App Router that is a pointless network hop. The senior move is to call your database directly inside an async Server Component — no API route, no extra latency, and your connection string never leaves the server.
Core idea. An async Server Component runs only on the server, so you can `await prisma.job.findMany()` right inside it. Internal reads need no API route, no fetch(), and no client-side data layer — the query runs at render time and only the serializable result is sent to the browser. Your DATABASE_URL and Prisma client stay server-side, always.
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
CRUD ↔ HTTP verb
POSTCreateGETReadPATCHUpdateDELETEDelete
local list (React state)2 items
#1Ship the feed
#2Review PRs
network — request / response
Add, edit, or delete an item. Watch the HTTP verb fire, then the local list update after the response.
Each mutation waits for the server's response, then updates the local list immutably (map / filter / spread) — no full refetch. Showing the change before the response is optimistic UI (#71).
↑ play a little first, then dig in