CockroachDB + Prisma + Next.js Starter is a fullstack boilerplate that demonstrates a REST API built with Next.js, React, Express, and Prisma Client on CockroachDB, with one-click deployment to Vercel.
What is this template?
This starter is a runnable example from the cockroachdb/prisma-examples repository. It wires together a React frontend served by Next.js, an Express backend exposing a REST API, Prisma Client for database access, and CockroachDB Serverless as the database. The example code lives under the javascript/rest-nextjs path and uses plain JavaScript rather than TypeScript. Its core function is to show exactly how these technologies integrate in a single deployable application.
Key features
- One-click Vercel deployment — The Deploy with Vercel button clones the repository, creates a new Vercel project, and hooks up a CockroachDB serverless integration automatically.
- Fullstack REST API — Express handles backend routing and exposes REST endpoints, while the Next.js React frontend consumes them.
- Prisma Client integration — Prisma Client is used to query and mutate CockroachDB tables, with the schema defined in Prisma's schema file.
- Automated database setup — The build command runs
yarn prisma db pushfollowed byyarn next build, which pushes the Prisma schema to the database and builds the Next.js app. - Distributed SQL database — CockroachDB is used as the cloud-native SQL database, and the deployment integration provisions a serverless instance.
- Ready-to-run example — Part of a maintained examples repository, so it stays current with Prisma and CockroachDB changes.
Who should use this template?
- Fullstack developers who want a minimal, working reference for combining Next.js, Express, and Prisma with CockroachDB.
- Teams adopting CockroachDB Serverless who need a simple application to test the database through a real REST API.
- Learners exploring how Prisma Client works with a non-Postgres SQL database, since CockroachDB has its own integration path.
Use cases
- Build a REST API backend: Use the Express and Prisma configuration as a starting point for your own API endpoints and database models.
- Prototype a serverless app on Vercel: Deploy the starter in one click to have a live fullstack app with a managed database in minutes.
- Evaluate CockroachDB Serverless: Connect the example to a CockroachDB cluster and inspect how Prisma generates queries for that database.
How does the one-click deployment work?
The Deploy button on the page points to a Vercel project that clones the repository URL github.com/cockroachdb/prisma-examples/tree/latest/javascript/rest-nextjs. During deployment, you select the CockroachDB serverless integration, and Vercel runs yarn prisma db push to create the database schema, then yarn next build to compile the application. After deployment, the REST API is live and connected to the provisioned database.
FAQ
Does this template use TypeScript?
No, this example is written in plain JavaScript. It lives in the javascript directory of the prisma-examples repository, and the code uses JavaScript files without type annotations.
What database does it use?
The template uses CockroachDB Serverless, which is provisioned automatically when you deploy with the Vercel integration. The Prisma schema defines the data model, and Prisma Client communicates with the CockroachDB cluster.
How do I deploy this to Vercel?
Click the "Deploy with Vercel" button on the repository page. Vercel will clone the repository, prompt you to connect a CockroachDB serverless instance, and run the build command yarn prisma db push && yarn next build. The app goes live after the build finishes.





