finds.dev← search

// the find

rauchg/how-is-this-not-illegal

★ 631 · JavaScript · updated Dec 2025

A demo of using RSC and Vercel Postgres, legally

A one-file joke-turned-demo from Guillermo Rauch showing you can query Vercel Postgres directly inside a React Server Component, riffing on a Dan Abramov tweet that said this should be illegal. It's for developers curious what RSC data fetching looks like with zero API layer in between.

The entire point lives in app/page.js — you can read the whole thing in under five minutes and see exactly how a server component awaits a SQL query and renders the result. It uses real App Router conventions (layout.tsx, opengraph-image.js, loading.js) so it doubles as a minimal skeleton for a Next.js project. It ships init.sql and destroy.sql so you can actually stand up the demo against a real database instead of just reading code.

There's no error handling, connection pooling, or access control around the direct DB call — copy this into a real app and you'll hit pool exhaustion or leak credentials the first time something goes wrong. It's hardwired to Vercel Postgres's connection format, so it's not a portable pattern for other Postgres hosts without rewriting the setup. No tests, no discussion of mutations, caching, or revalidation — it shows the happy path for a read and stops there. It's a snapshot of early App Router RSC conventions, not something that's been kept current as the pattern matured.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →