Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7149a46
feat: add versioning
ankur-arch May 11, 2026
2a39d66
Merge branch 'main' into prisma-next-ea
ankur-arch May 11, 2026
c785d96
docs: flesh out Prisma Next docs
AmanVarshney01 May 15, 2026
fa8940e
docs: add Prisma Next getting started guides
AmanVarshney01 Jun 4, 2026
f61564d
docs: address Prisma Next getting started feedback
AmanVarshney01 Jun 4, 2026
eec325f
docs: add Prisma Next getting started section
AmanVarshney01 Jun 4, 2026
dbc420a
docs: refine Prisma Next quickstart steps
AmanVarshney01 Jun 8, 2026
a01db52
docs: streamline Prisma Next prerequisites
AmanVarshney01 Jun 8, 2026
ea29120
docs: simplify Prisma Next ORM pages
AmanVarshney01 Jun 8, 2026
059183b
docs: trim Prisma Next overview
AmanVarshney01 Jun 8, 2026
c42a2e4
docs: restore Prisma Next getting started pages
AmanVarshney01 Jun 8, 2026
7a4538a
docs: preselect Prisma Next database guides
AmanVarshney01 Jun 9, 2026
682098f
Added Prisma Next docs in ORM section
nurul3101 Jun 25, 2026
036c485
docs: reframe Prisma Next as Early Access and default docs entry to Next
ankur-arch Jul 1, 2026
6837bc3
docs: use finalized Early Access callout copy for Prisma Next
ankur-arch Jul 1, 2026
d899524
docs: redefine Early Access on the ORM and Console lifecycle pages
ankur-arch Jul 1, 2026
16ca11d
docs: soften Preview production language to match new Early Access me…
ankur-arch Jul 1, 2026
976fed5
docs: default /docs to Prisma Next and add callout title spacing
ankur-arch Jul 1, 2026
6d46119
docs: fold Prisma Next into the getting-started sidebar
ankur-arch Jul 2, 2026
d628bd9
Restore Prisma Next getting-started docs
nurul3101 Jul 3, 2026
b57d2fe
docs: add inspectable and arktype to cspell dictionary
nurul3101 Jul 3, 2026
2ce2792
fix(nav): point Docs link to /docs/orm instead of /docs/next
nurul3101 Jul 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ This command will set up Prisma Next in a new or existing project with a simple

Tell us what worked and what didn't on [Discord](https://pris.ly/discord) in the `#prisma-next` channel, and **star and watch [prisma/prisma-next](https://pris.ly/pn-gh) on GitHub** to follow development. We'd love to hear your feedback!

Be aware that Prisma Next is not production-ready yet. Prisma 7 is still the right choice for production today. When Prisma Next is ready for general use, it becomes Prisma 8.
Prisma Next is in Early Access. Prisma 7 is the current generally available release, so if you're using it, keep using it. When Prisma Next is ready for general use, it becomes Prisma 8.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ The ORM ecosystem has plenty of healthy competition, and we wanted to make sure

## Where we are, where we're going

Prisma Next is still in its early stages and isn't ready for production use yet. For production applications, Prisma 7 is still the recommended choice. Once Prisma Next is ready for general use, it will become Prisma 8, and upgrading will be a smooth process.
Prisma Next is in Early Access. Prisma 7 is the current generally available release, so if you're using it, keep using it. Once Prisma Next is ready for general use, it will become Prisma 8, and upgrading will be a smooth process.

**What works today**:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ Build it, then tell us about it in [`#prisma-next`](https://pris.ly/discord) on

Prisma Next is early, and the SPI is stable enough that the existing extensions are real proof of what's possible, though we expect to iterate as more of you build against it.

Prisma 7 remains the right choice for production today, and Prisma Next will become Prisma 8 once it's ready for general use.
Prisma Next is in Early Access, and Prisma 7 is the current generally available release, so if you're using it, keep using it. Prisma Next will become Prisma 8 once it's ready for general use.

The most interesting extensions will be the ones you'll write.
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ If you're shipping today while following this work, start with [Prisma ORM](http

## We’re working in the open

Today we’re publishing the Prisma Next repo so you can follow the work as it happens. Even though it's early and not yet production-ready, we’re sharing it now so the community can see where we’re headed and help shape the design.
Today we’re publishing the Prisma Next repo so you can follow the work as it happens. It’s in Early Access, and we’re sharing it now so the community can see where we’re headed and help shape the design.

If you want to stay close to the work, **star + watch** the repo.

Expand Down
6 changes: 6 additions & 0 deletions apps/docs/content/docs/(index)/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ npx create-db@latest
npx @prisma/cli@latest app deploy
```

:::note

Curious what's next? [Prisma Next](/next) is the next major version of Prisma ORM, available now in Early Access. Explore the new developer experience whenever you're ready.

:::

<Cards>
<Card
href="/prisma-compute/deploy"
Expand Down
6 changes: 6 additions & 0 deletions apps/docs/content/docs/(index)/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"---Getting Started---",
"index",
"getting-started",
"---Get started with Prisma Next---",
"next/index",
"next/getting-started",
"---Prisma Next---",
"next/quickstart",
"next/add-to-existing-project",
"---Prisma ORM---",
"...prisma-orm",
"---Prisma Postgres---",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "Add to Existing Project",
"pages": ["postgresql", "mongodb"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
---
title: MongoDB
description: Add Prisma Next to an existing MongoDB project.
url: /next/add-to-existing-project/mongodb
metaTitle: Add Prisma Next to an existing MongoDB project
metaDescription: Add Prisma Next to an existing MongoDB project.
---

This guide shows how to add Prisma Next to a project that already uses MongoDB. You will run `prisma-next init`, describe the collections you want to work with, emit the generated artifacts, and run a couple of queries.

Use this path when you already have an application and database. Make sure the app can already reach its MongoDB deployment and runs on Node.js 24 or newer. If you want Prisma Next to create a new app for you, use the [MongoDB quickstart](/next/quickstart/mongodb).

:::note[Prisma Next is in Early Access]

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](https://pris.ly/discord).

If you want to stay on the current generally available version of Prisma ORM, you can continue with [Prisma 7](/getting-started).

:::

For local development, use a replica set. MongoDB Atlas already gives you that.

## 1. Make sure you can run the example script

If your project already runs TypeScript scripts, you can skip this step.

Otherwise, install the script tooling:

```npm
npm install --save-dev tsx typescript
```

Later, `prisma-next init` will also add the Node.js types it needs and make sure the generated Prisma Next files can run as ES modules. If your project already declares `"type": "commonjs"`, Prisma Next leaves that choice alone and prints a warning so you can decide how to wire the generated helper into your app.

## 2. Initialize Prisma Next

From the root of your existing project, run:

```npm
npx prisma-next init --target mongodb
```

This is the existing-project path. It preselects MongoDB, adds Prisma Next files and package scripts to the app you already have, and does not scaffold a new framework project.

It also adds `prisma-next.md` and project-level Prisma Next skills for Cursor, Claude Code, Codex, and Windsurf so your agent can read the Prisma Next usage, upgrade, and extension-author guidance from the project.

When Prisma Next asks the remaining setup questions:

- choose `PSL`
- keep the default schema path, `prisma/contract.prisma`

## 3. Set your database connection string

Update `.env` with the connection string for the MongoDB deployment your app already uses:

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

## 4. Describe the collections you want Prisma Next to know about

This is the key adoption step for MongoDB, because you decide which part of the existing database Prisma Next should model first.

PostgreSQL has `contract infer`. MongoDB does not, so this step is manual.

Open `prisma/contract.prisma` and make it match the collections you want Prisma Next to query first. If your existing database already has `users` and `posts` collections with `email`, `name`, `title`, and `authorId`, the starter contract is already a useful first draft:

```prisma title="prisma/contract.prisma"
// use prisma-next

model User {
id ObjectId @id @map("_id")
email String @unique
name String?
posts Post[]
@@map("users")
}

model Post {
id ObjectId @id @map("_id")
title String
content String?
author User @relation(fields: [authorId], references: [id])
authorId ObjectId
@@map("posts")
}
```

You do not need to model every collection on day one. Start with the part of the database you want to read and write first.

## 5. Emit the generated artifacts

Once the contract looks right, this step turns it into the generated files the runtime and query APIs use.

Run:

```npm
npx prisma-next contract emit
```

This refreshes `prisma/contract.json` and `prisma/contract.d.ts` so the runtime and query APIs are aligned with the contract you just reviewed.

## 6. Run a simple high-level query

With the emitted artifacts in place, you can test the higher-level API first and confirm Prisma Next can read the existing collections.

Create a `script.ts` file:

```typescript title="script.ts"
import "dotenv/config";
import { db } from "./prisma/db";

async function main() {
const user = await db.orm.users.where({ email: "existing@example.com" }).first();
console.log(user);

await db.close();
}

main().catch((error) => {
console.error(error);
process.exit(1);
});
```

Run it:

```npm
npx tsx script.ts
```

## 7. Run a simple low-level query

After the ORM example, this step shows the lower-level MongoDB pipeline builder against the same existing collections.

Replace `script.ts` with this version:

```typescript title="script.ts"
import "dotenv/config";
import { db } from "./prisma/db";

async function main() {
const runtime = await db.runtime();
const plan = db.query
.from("users")
.match((fields) => fields.email.eq("existing@example.com"))
.project("email", "name")
.build();

const rows = await runtime.execute(plan);
console.log(rows);

await db.close();
}

main().catch((error) => {
console.error(error);
process.exit(1);
});
```

Run it again:

```npm
npx tsx script.ts
```

## 8. Next steps

When you change `prisma/contract.prisma`, emit the contract again:

```npm
npx prisma-next contract emit
```

You do not need a migration just to read collections that already exist. Use [migration plan](/cli/next/migration-plan) when you want Prisma Next to own a schema change.
Loading
Loading