/react-postgres-components

An experiment on deploying remote functions that run inside Postgres using v8

Primary LanguageTypeScript

react-postgres-components

An experiment on deploying remote functions that run inside Postgres using v8, run React SSR, and are easily defined in a rpc/ directory.

export default function helloWorld () => {
  const [{version}] = sql`SELECT version()`; // no `await` needed!
  return <h1>Hello from <em>inside</em> Postgres: {version}</h1>;
}

Check out the demos & how it works.

Deployment

  • Make sure the Vercel project is connected to a Vercel Postgres (Neon) database.
  • Deploy!

Local dev

  • Run vc env pull to get a .env.local file with the POSTGRES_URL credential
  • Run pnpm dev to start developing

License & Credit