Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Simple Next.js template that uses a Postgres database.
Postgres Next.js Starter is a minimal Next.js boilerplate from Vercel that connects a Next.js app to a Vercel Postgres database, giving developers a runnable starting point for full-stack applications.
The Postgres Next.js Starter is a starter template that pairs the Next.js framework with a Vercel Postgres database. It takes database connection details from environment variables and produces a working web application ready for further development. The template is published in the Vercel examples repository and can be deployed directly to Vercel through a one-click deploy flow.
The template is aimed at developers who want a fast start with Next.js and a relational database. It suits React developers learning how to wire server-side data fetching to Postgres, teams prototyping a new product idea with minimal setup, and anyone who wants a reference implementation of Vercel Postgres integration.
You can use one of two paths. The first is to click the "Deploy with Vercel" button, which clones the repository into your Vercel account and links the Postgres integration. The second is to run pnpm create next-app using the example URL, copy .env.example to .env.local, fill in the database credentials from your Vercel Storage Dashboard, and run pnpm dev for local development.
The same Vercel examples repository offers related starters: postgres-prisma, which uses the Prisma ORM to interact with Postgres, postgres-kysely, which uses the Kysely query builder, and postgres-sveltekit, which pairs Vercel Postgres with the SvelteKit framework instead of Next.js.
Yes, deploying to Vercel requires an account, but you can also run the project locally by setting the environment variables yourself. The template itself is open source from the Vercel examples repository.
It uses Vercel Postgres, a serverless Postgres database offering from Vercel. The starter reads the connection information from environment variables, so you can point it at any Postgres instance by changing those values.
After deploying to Vercel, the Postgres integration automatically provides the environment variables. If you clone the repo, you copy .env.example to .env.local and fill in the values from your Vercel Storage Dashboard.
Yes, because the connection is driven by environment variables, you can replace the Vercel Postgres credentials with any Postgres connection string, though the template is optimized for Vercel Postgres.
