Skip to content

Form example using Next.js (Server Actions), Vercel Postgres, and shadcn/ui

Notifications You must be signed in to change notification settings

komzweb/nextjs-server-actions-form

Repository files navigation

Next.js Server Actions Form

This example is based on Forms with Next.js and Server Actions published by Next.js, with the following additions:

Run locally

First, create .env.local in the root and set your Vercel Postgres secrets to it:

POSTGRES_URL="************"
POSTGRES_PRISMA_URL="************"
POSTGRES_URL_NON_POOLING="************"
POSTGRES_USER="************"
POSTGRES_HOST="************"
POSTGRES_PASSWORD="************"
POSTGRES_DATABASE="************"

Then, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.