Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e35e705
DC-5044 `prisma-client-js` deprecated (#7219)
aidankmcalister Nov 4, 2025
f8c32d1
DC-5040 Env Vars via Config (#7227)
aidankmcalister Nov 5, 2025
87eba65
urls deprecated (#7226)
aidankmcalister Nov 5, 2025
ac89f6a
minimum version uodated (#7234)
aidankmcalister Nov 7, 2025
3bf085d
DC-5043 Middleware removed from docs (#7233)
aidankmcalister Nov 7, 2025
1b1cf8a
docs(metrics): remove metrics API
mhartington Nov 11, 2025
a4cffaf
DC-6174: Remove adapter, engine, directUrl, studio from config (#7256)
ankur-arch Nov 15, 2025
c2671d7
feat: restructure getting started side nav (#7245)
ankur-arch Nov 15, 2025
32e3082
feat: update .env docs DC-6204 (#7259)
ankur-arch Nov 17, 2025
1db29fe
fix: clarify config file path better (#7261)
ankur-arch Nov 17, 2025
8d21ba4
Update ORM docs (#7260)
AmanVarshney01 Nov 17, 2025
a72eb21
Update guides to use prisma.config.ts (#7243)
nurul3101 Nov 17, 2025
05b7cb0
feat: update ppg for other dbs section (#7264)
ankur-arch Nov 17, 2025
5c857d7
feat: update prisma init related changes in other parts (#7267)
ankur-arch Nov 17, 2025
f489364
Update docs to perform migrations with connection pooling and Prisma …
AmanVarshney01 Nov 17, 2025
50b8d99
feat: add mentions of new Prisma Studio (#7270)
ankur-arch Nov 17, 2025
311bc16
feat: add mention of mongo support coming for P7 (#7271)
ankur-arch Nov 17, 2025
7e77180
Restore content/200-orm/200-prisma-client/600-observability-and-loggi…
mhartington Nov 18, 2025
ef1bea8
docs(): update based on feedback
mhartington Nov 18, 2025
e65a404
Merge branch 'prisma-7' into metrics-removal-v2
mhartington Nov 18, 2025
83ccec0
Update content/200-orm/200-prisma-client/000-setup-and-configuration/…
mhartington Nov 18, 2025
8c77313
Merge branch 'prisma-7' into metrics-removal-v2
AmanVarshney01 Nov 19, 2025
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
2 changes: 2 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
# yaml template to refer to https://docs.coderabbit.ai/reference/yaml-template#enterprise
language: "en-US"
tone_instructions: "You are a principal engineer with natural teaching abilities. You detect issues and clearly explain why."
reviews:
collapse_walkthrough: false
profile: "chill"
Expand All @@ -14,6 +15,7 @@ reviews:
auto_review:
enabled: true
drafts: false
base_branches: [".*"]
finishing_touches:
docstrings:
enabled: false
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/lychee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
--cache
--cache-exclude-status 429,500,502,503,504
--max-cache-age 5m
--verbose
--no-progress
--accept 200,201,204,304,403,429
--timeout 20
Expand All @@ -50,7 +49,6 @@ jobs:
args: >
--cache
--max-cache-age 5m
--verbose
--no-progress
--accept 200,201,204,304,403,429
--cache-exclude-status 429,500,502,503,504
Expand Down Expand Up @@ -79,8 +77,8 @@ jobs:
fi

if [ -n "$REPORT_FILE" ]; then
# Read the original output
ORIGINAL=$(cat "$REPORT_FILE")
# Read the original output and remove everything after 'Redirects per input'
ORIGINAL=$(cat "$REPORT_FILE" | sed '/^##* Redirects per input/,$d')

# Create formatted output
cat > lychee/formatted.md << EOF
Expand All @@ -92,7 +90,7 @@ jobs:

EOF

# Append the original content with title replacement
# Append the cleaned content with title replacement
echo "$ORIGINAL" | sed 's/^# Summary$//' | sed 's/^## Summary$//' >> lychee/formatted.md
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ metaDescription: 'Data sources enable Prisma to connect to your database. This p

A data source determines how Prisma ORM connects to your database, and is represented by the [`datasource`](/orm/reference/prisma-schema-reference#datasource) block in the Prisma schema. The following data source uses the `postgresql` provider and includes a connection URL:

::::note
As of Prisma ORM v7, the `url`, `directUrl`, and `shadowDatabaseUrl` fields in the Prisma schema `datasource` block are deprecated. Configure these fields in [Prisma Config](/orm/reference/prisma-config-reference) instead.
::::

```prisma
datasource db {
provider = "postgresql"
Expand Down
145 changes: 74 additions & 71 deletions content/200-orm/100-prisma-schema/10-overview/03-generators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,79 +15,10 @@ generator client {

A generator determines which assets are created when you run the `prisma generate` command.

There are two generators for Prisma Client:

- `prisma-client` (recommended): Newer and more flexible version of `prisma-client-js` with ESM support; it outputs plain TypeScript code and _requires_ a custom `output` path (read more about it [here](https://www.prisma.io/blog/why-prisma-orm-generates-code-into-node-modules-and-why-it-ll-change))
- `prisma-client-js`: Generates Prisma Client into `node_modules`
The default generator for Prisma Client is `prisma-client`, which outputs plain TypeScript code and _requires_ a custom `output` path (read more about it [here](https://www.prisma.io/blog/why-prisma-orm-generates-code-into-node-modules-and-why-it-ll-change)).

Alternatively, you can configure any npm package that complies with our generator specification.

## `prisma-client-js`

The `prisma-client-js` is the default generator for Prisma ORM 6.X versions and before. It requires the `@prisma/client` npm package and generates Prisma Client into `node_modules`.

### Field reference

The generator for Prisma's JavaScript Client accepts multiple additional properties:

- `previewFeatures`: [Preview features](/orm/reference/preview-features) to include
- `binaryTargets`: Engine binary targets for `prisma-client-js` (for example, `debian-openssl-1.1.x` if you are deploying to Ubuntu 18+, or `native` if you are working locally)

```prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["sample-preview-feature"]
binaryTargets = ["debian-openssl-1.1.x"] // defaults to `"native"`
}
```

### Binary targets

:::note

As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine).

**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:

```prisma
generator client {
provider = "prisma-client-js" // or "prisma-client"
output = "../src/generated/prisma"
engineType = "client" // no Rust engine
}
```

Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.

When using Prisma ORM without Rust, the `binaryTargets` field is obsolete and not needed.

You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog.

:::

The `prisma-client-js` generator uses several [engines](https://github.com/prisma/prisma-engines). Engines are implemented in Rust and are used by Prisma Client in the form of executable, platform-dependent engine files. Depending on which platform you are executing your code on, you need the correct file. "Binary targets" are used to define which files should be present for the target platform(s).

The correct file is particularly important when [deploying](/orm/prisma-client/deployment/deploy-prisma) your application to production, which often differs from your local development environment.

#### The `native` binary target

The `native` binary target is special. It doesn't map to a concrete operating system. Instead, when `native` is specified in `binaryTargets`, Prisma Client detects the _current_ operating system and automatically specifies the correct binary target for it.

As an example, assume you're running **macOS** and you specify the following generator:

```prisma file=prisma/schema.prisma
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
```

In that case, Prisma Client detects your operating system and finds the right binary file for it based on the [list of supported operating systems](/orm/reference/prisma-schema-reference#binarytargets-options) .
If you use macOS Intel x86 (`darwin`), then the binary file that was compiled for `darwin` will be selected.
If you use macOS ARM64 (`darwin-arm64`), then the binary file that was compiled for `darwin-arm64` will be selected.

> **Note**: The `native` binary target is the default. You can set it explicitly if you wish to include additional [binary targets](/orm/reference/prisma-schema-reference#binarytargets-options) for deployment to different environments.

## `prisma-client`

The new `prisma-client` generator offers greater control and flexibility when using Prisma ORM across different JavaScript environments (such as ESM, Bun, Deno, ...).
Expand All @@ -104,7 +35,7 @@ Here are the main differences compared to `prisma-client-js`:
- More flexible thanks to additional [fields](#field-reference)
- Outputs plain TypeScript that's bundled just like the rest of your application code

The `prisma-client` generator has been Generally Available since [v6.16.0](https://pris.ly/releases/6.16.0) will become the new default with Prisma ORM v7.
The `prisma-client` generator has been Generally Available since [v6.16.0](https://pris.ly/releases/6.16.0) and is the default generator as of Prisma ORM v7.

### Getting started

Expand Down Expand Up @@ -396,6 +327,78 @@ To see what the new `prisma-client` generator looks like in practice, check out
| [`bun`](https://github.com/prisma/prisma-examples/tree/latest/generator-prisma-client/deno-deploy) | None | None | Deno 2 | n/a |
| [`deno`](https://github.com/prisma/prisma-examples/tree/latest/generator-prisma-client/deno-deploy) | None | None | Deno 2 | n/a |

## `prisma-client-js` (Deprecated)

:::warning Deprecated

The `prisma-client-js` generator is **deprecated as of Prisma 7**. It was the default generator for Prisma ORM 6.X and earlier versions. We recommend migrating to [`prisma-client`](#prisma-client) for new projects and updating existing projects when possible.

:::

The `prisma-client-js` generator requires the `@prisma/client` npm package and generates Prisma Client into `node_modules`.

### Field reference

The generator for Prisma's JavaScript Client accepts multiple additional properties:

- `previewFeatures`: [Preview features](/orm/reference/preview-features) to include
- `binaryTargets`: Engine binary targets for `prisma-client-js` (for example, `debian-openssl-1.1.x` if you are deploying to Ubuntu 18+, or `native` if you are working locally)

```prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["sample-preview-feature"]
binaryTargets = ["debian-openssl-1.1.x"] // defaults to `"native"`
}
```

### Binary targets

:::note

As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine).

**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:

```prisma
generator client {
provider = "prisma-client-js" // or "prisma-client"
output = "../src/generated/prisma"
engineType = "client" // no Rust engine
}
```

Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.

When using Prisma ORM without Rust, the `binaryTargets` field is obsolete and not needed.

You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog.

:::

The `prisma-client-js` generator uses several [engines](https://github.com/prisma/prisma-engines). Engines are implemented in Rust and are used by Prisma Client in the form of executable, platform-dependent engine files. Depending on which platform you are executing your code on, you need the correct file. "Binary targets" are used to define which files should be present for the target platform(s).

The correct file is particularly important when [deploying](/orm/prisma-client/deployment/deploy-prisma) your application to production, which often differs from your local development environment.

#### The `native` binary target

The `native` binary target is special. It doesn't map to a concrete operating system. Instead, when `native` is specified in `binaryTargets`, Prisma Client detects the _current_ operating system and automatically specifies the correct binary target for it.

As an example, assume you're running **macOS** and you specify the following generator:

```prisma file=prisma/schema.prisma
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
```

In that case, Prisma Client detects your operating system and finds the right binary file for it based on the [list of supported operating systems](/orm/reference/prisma-schema-reference#binarytargets-options) .
If you use macOS Intel x86 (`darwin`), then the binary file that was compiled for `darwin` will be selected.
If you use macOS ARM64 (`darwin-arm64`), then the binary file that was compiled for `darwin-arm64` will be selected.

> **Note**: The `native` binary target is the default. You can set it explicitly if you wish to include additional [binary targets](/orm/reference/prisma-schema-reference#binarytargets-options) for deployment to different environments.

## Community generators

:::note
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,35 @@ For improved compatibility with ECMAScript modules (ESM) and to ensure consisten

:::

## Loading environment variables

To load environment variables in your Prisma application, you can use the `prisma.config.ts` file along with the `env` helper from `prisma/config`. This approach provides better type safety and configuration management.

1. First, install the required dependency:

```bash
npm install dotenv --save-dev
```

2. Create a `.env` file in your project root (if it doesn't exist) and add your database connection string:

```env
DATABASE_URL="your_database_connection_string_here"
```

3. Update your `prisma.config.ts` file in your project root:

```ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
datasource: {
url: env("DATABASE_URL"),
},
});
```

## The `@prisma/client` npm package

The `@prisma/client` npm package consists of two key parts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ datasource db {

#### Viewing the connection pool size

The number of connections Prisma Client uses can be viewed using [logging](/orm/prisma-client/observability-and-logging/logging) and [metrics](/orm/prisma-client/observability-and-logging/metrics).
The number of connections Prisma Client uses can be viewed using [logging](/orm/prisma-client/observability-and-logging/logging) and built in APIs provided by the Prisma Postgres Driver.

Using the `info` [logging level](/orm/reference/prisma-client-reference#log-levels), you can log the number of connections in a connection pool that are opened when Prisma Client is instantiated.

Expand Down Expand Up @@ -127,78 +127,6 @@ Note that the output generated by `log: ['info']` can change in any release with

</Admonition>

If you need even more insights into the size of your connection pool and the amount of in-use and idle connection, you can use the [metrics](/orm/prisma-client/observability-and-logging/metrics) feature (which is currently in Preview).

Consider the following example:

<CodeWithResult expanded="{true}">
<cmd>

```ts
import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

async function main() {
await Promise.all([prisma.user.findMany(), prisma.post.findMany()])

const metrics = await prisma.$metrics.json()
console.dir(metrics, { depth: Infinity })
}

main()
```

</cmd>
<cmdResult>

```json no-copy
{
"counters": [
// ...
{
"key": "prisma_pool_connections_open",
"labels": {},
"value": 2,
"description": "Number of currently open Pool Connections"
}
],
"gauges": [
// ...
{
"key": "prisma_pool_connections_busy",
"labels": {},
"value": 0,
"description": "Number of currently busy Pool Connections (executing a datasource query)"
},
{
"key": "prisma_pool_connections_idle",
"labels": {},
"value": 21,
"description": "Number of currently unused Pool Connections (waiting for the next datasource query to run)"
},
{
"key": "prisma_pool_connections_opened_total",
"labels": {},
"value": 2,
"description": "Total number of Pool Connections opened"
}
],
"histograms": [
/** ... **/
]
}
```

</cmdResult>
</CodeWithResult>

<Admonition type="info">

For more details on what is available in the metrics output, see the [About metrics](/orm/prisma-client/observability-and-logging/metrics#about-metrics) section.

</Admonition>

### Connection pool timeout

#### Default pool timeout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ To get started, follow the [integration guide](/optimize/getting-started) and ad

You can also [log query events at the client level](/orm/prisma-client/observability-and-logging/logging#event-based-logging) to view the generated queries, their parameters, and execution times.

If you are particularly focused on monitoring query duration, consider using [logging middleware](/orm/prisma-client/client-extensions/middleware/logging-middleware).

:::

## Using bulk queries
Expand Down
Loading
Loading