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.
Prisma Next is the next major version of Prisma ORM, available now in Early Access. It’s the cutting-edge version of Prisma ORM and will become the future of Prisma, so we’d love for you to try it, explore what’s new, and share your feedback in Discord.
If you want to stay on the current generally available version of Prisma ORM, you can continue with Prisma 7.
Quick start
bunx create-prisma@next --provider mongodbRun 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.
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:upSkip 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 init4. Apply the migration
Apply the planned migration to MongoDB.
bun run migrate5. Seed data
db:seed inserts sample users so the first query has data to show.
bun run db:seed6. Run the app
Start the app and confirm the sample query runs successfully.
bun run devUse the URL or terminal output shown by your template. You should see the seeded users returned from MongoDB.
Next steps
- Open
src/prisma/contract.prismaorsrc/prisma/contract.tsand 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.