Prisma Next is in early access.Read the docs
Quickstart

MongoDB

Create a new Prisma Next project with MongoDB using create-prisma@next.

Create a Prisma Next app with MongoDB, seed it, and run your first query.

Quick start

bunx create-prisma@next --provider mongodb

Run this from a Node.js 24 or newer environment. The command preselects MongoDB. The generated local setup gives you a MongoDB replica set through db:up; if you use MongoDB Atlas or another existing deployment, set DATABASE_URL and skip db:up.

Setup gives you the app template, a starter contract, prisma-next.md, project-level Prisma Next skills for your coding agent, and package scripts for the database steps below.

For local development, use a replica set. MongoDB Atlas already provides one, and the generated db:up script starts one for you.

1. Check the database connection

Open .env and confirm that DATABASE_URL points to the MongoDB deployment you want Prisma Next to use.

.env
DATABASE_URL="mongodb://127.0.0.1:27017/app?replicaSet=rs0"

If you use MongoDB Atlas, replace this with the connection string from your Atlas cluster.

2. Start MongoDB

From the generated project directory, run db:up to start the local replica set.

bun run db:up

Skip this command when you use MongoDB Atlas or another existing deployment.

3. Create the migration plan

Create the first migration plan from the starter contract.

bun run migration:plan --name init

4. Apply the migration

Apply the planned migration to MongoDB.

bun run migrate

5. Seed data

db:seed inserts sample users so the first query has data to show.

bun run db:seed

6. Run the app

Start the app and confirm the sample query runs successfully.

bun run dev

Use the URL or terminal output shown by your template. You should see the seeded users returned from MongoDB.

Next steps

  • Open src/prisma/contract.prisma or src/prisma/contract.ts and change the starter model.
  • Use the MongoDB existing-project guide if you already have an app and database.
  • Read the Prisma Next overview when you want the concepts behind contracts, query APIs, and migrations.

On this page