Skip to content

Conversation

@mhartington
Copy link
Contributor

@mhartington mhartington commented Oct 21, 2025

Adds additional documentation for the upcoming 6.18 release

Summary by CodeRabbit

  • New Features

    • Added a configurable engine option supporting both classic (Rust) and JS engines.
    • Introduced an env helper for type-safe environment variable access.
  • Documentation

    • Updated configuration docs with engine usage examples, adapter guidance, and env-based patterns (replacing prior dotenv examples).
    • Added per-database metrics docs covering average response size, query duration, total egress, total operations, and cache utilization.

@mhartington mhartington requested a review from a team October 21, 2025 17:11
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

Adds a public env export from prisma/config, introduces engine: 'classic' | 'js' on PrismaConfig (with datasource vs driver-adapter requirements), updates examples to use env(...) instead of dotenv/config or process.env, and inserts per-database usage metrics text in Postgres and Workspace docs.

Changes

Cohort / File(s) Summary
Prisma Config Reference
content/200-orm/500-reference/325-prisma-config-reference.mdx
Exports env from prisma/config; adds `engine: 'classic'
Guides / Examples with PrismaConfig
content/200-orm/050-overview/500-databases/900-turso.mdx, content/800-guides/070-cloudflare-d1.mdx, ...content/**
Adds engine: 'js' property to example PrismaConfig exports in multiple guides/examples (Turso, Cloudflare D1, and other config examples), aligning examples with the new engine field and env usage.
Postgres docs — Usage metrics
content/250-postgres/100-introduction/250-overview.mdx
Inserts a paragraph describing per-database metrics reports and adds a bullet list of metrics: Average response size, Average query duration, Total egress, Total operations, Cache utilization.
Platform / Workspace docs
content/500-platform/10-about.mdx
Adds a "Database Metrics" subsection under Workspace describing that a workspace can host multiple databases and that per-database metrics reports are available (lists same metrics).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Pre-merge checks

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title "docs(): update for new release" is vague and generic, using non-descriptive language that fails to convey what specific documentation changes are being made. While it is technically related to the changeset (the PR does contain documentation updates), it provides minimal information about the actual content. A reviewer scanning the pull request history would not understand that the PR introduces an engine configuration option, type-safe environment variable patterns, and database metrics documentation without reading the full summary. Consider revising the title to be more specific and descriptive, such as "docs(): add engine option and database metrics documentation" or "docs(): document new Prisma engine configuration and metrics features". This would help reviewers quickly understand the primary focus of the changes without needing to review the full summary.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

Dangerous URL check

No absolute URLs to prisma.io/docs found.
No local URLs found.

@github-actions
Copy link
Contributor

Redirect check

This PR probably requires the following redirects to be added to static/_redirects:

  • This PR does not change any pages in a way that would require a redirect.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
content/200-orm/500-reference/325-prisma-config-reference.mdx (1)

380-382: Use env() helper for environment variables in adapter example.

The adapter example at lines 380–382 accesses environment variables via process.env directly. For consistency with the documented best practice emphasizing type-safe access via the env() helper (shown in sections at lines 427–444), consider updating this example to use the env() helper as well.

For example:

export default defineConfig({
  experimental: {
    adapter: true
  },
  engine: "js",
  async adapter() {
    return new PrismaD1({
-     CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN,
-     CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID,
-     CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID,
+     CLOUDFLARE_D1_TOKEN: env('CLOUDFLARE_D1_TOKEN'),
+     CLOUDFLARE_ACCOUNT_ID: env('CLOUDFLARE_ACCOUNT_ID'),
+     CLOUDFLARE_DATABASE_ID: env('CLOUDFLARE_DATABASE_ID'),
    });
  },
  schema: path.join("prisma", "schema.prisma"),
});
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c83fa74 and 58be6c7.

📒 Files selected for processing (2)
  • content/200-orm/500-reference/325-prisma-config-reference.mdx (6 hunks)
  • content/250-postgres/100-introduction/250-overview.mdx (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Documentation Checks
content/250-postgres/100-introduction/250-overview.mdx

[error] 37-37: Unknown word 'utilisation' detected by cspell.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Check internal links
  • GitHub Check: runner / linkspector
🔇 Additional comments (1)
content/200-orm/500-reference/325-prisma-config-reference.mdx (1)

427-443: Approve environment variable documentation updates.

The expanded section on using environment variables with the env() helper provides clear guidance on type-safe access patterns and demonstrates both the modern tsx --env-file approach and the legacy dotenv method for older Node versions. Examples are well-structured and instructive.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
content/200-orm/500-reference/325-prisma-config-reference.mdx (1)

101-104: Fix syntax error in PrismaConfig type definition.

Line 102 contains a critical syntax error. The union operator should be | not :.

Apply this diff to fix the type syntax:

  // Configuration for the `typedSql` preview feature.
  typedSql?: {
    path: string;
  };
  // Depending on the choice, you must provide either a `datasource` object or driver adapter
- engine: 'classic': 'js'
+ engine: 'classic' | 'js'
  
};
🧹 Nitpick comments (1)
content/200-orm/500-reference/325-prisma-config-reference.mdx (1)

149-156: Consider updating the adapter example to use env() helper.

The D1 adapter example for the adapter config option (lines 149–155) also uses direct process.env access. For consistency with the new env() helper pattern and the updated "Using environment variables" section, consider updating this example as well.

This example could be updated similarly to use env<Env>() for type-safe environment variable access, aligning with the new documentation guidance.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 58be6c7 and 7406f28.

📒 Files selected for processing (1)
  • content/200-orm/500-reference/325-prisma-config-reference.mdx (7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: runner / linkspector
  • GitHub Check: Check internal links
🔇 Additional comments (2)
content/200-orm/500-reference/325-prisma-config-reference.mdx (2)

17-34: Approve updated config examples with env() helper.

The first two code examples now correctly use the env() helper instead of process.env and include the new engine field. The examples are well-structured and consistent with the new guidance.

Also applies to: 52-57


427-444: Well-designed env() helper documentation.

The new section clearly demonstrates type-safe environment variable access using the env<Env>() pattern. The example is clear and follows TypeScript best practices.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 21, 2025

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4c863bd
Status: ✅  Deploy successful!
Preview URL: https://d5d8ee39.docs-51g.pages.dev
Branch Preview URL: https://mhartington-da-5617-docs-upd.docs-51g.pages.dev

View logs

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 21, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 22, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
content/200-orm/050-overview/500-databases/900-turso.mdx (1)

137-158: Inconsistent environment variable pattern across config examples.

This example uses import 'dotenv/config' (line 143) and accesses environment variables via process.env (lines 153–154), while the updated reference documentation now promotes the env() helper from prisma/config for type-safe access.

For consistency with the new guidance in the config reference, update this example to use the env() helper:

 import path from 'node:path'
 import { defineConfig } from 'prisma/config'
 import { PrismaLibSQL } from '@prisma/adapter-libsql'
 
-// import your .env file
-import 'dotenv/config'
+import { env } from 'prisma/config'
 
 export default defineConfig({
   experimental: {
     adapter: true,
   },
   schema: path.join('prisma', 'schema.prisma'),
   engine: 'js',
   async adapter() {
     return new PrismaLibSQL({
-      url: process.env.LIBSQL_DATABASE_URL,
-      authToken: process.env.LIBSQL_DATABASE_TOKEN,
+      url: env('LIBSQL_DATABASE_URL'),
+      authToken: env('LIBSQL_DATABASE_TOKEN'),
     })
   }
 })
content/800-guides/070-cloudflare-d1.mdx (1)

182-203: Inconsistent environment variable pattern in Prisma Config example.

Like the Turso guide, this example uses import 'dotenv/config' (line 187) and accesses environment variables via process.env (lines 197–199), which conflicts with the recommended env() helper pattern documented in the updated config reference.

For consistency and to promote best practices, update this example:

 import type { PrismaConfig } from 'prisma';
 import { PrismaD1 } from '@prisma/adapter-d1';
 
-// import your .env file
-import 'dotenv/config';
+import { env } from 'prisma/config';
 
 export default {
 	experimental: {
 		adapter: true,
 	},
 	schema: 'prisma/schema.prisma',
   engine: 'js',
 	async adapter() {
 		return new PrismaD1({
-			CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN!,
-			CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID!,
-			CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID!,
+			CLOUDFLARE_D1_TOKEN: env('CLOUDFLARE_D1_TOKEN'),
+			CLOUDFLARE_ACCOUNT_ID: env('CLOUDFLARE_ACCOUNT_ID'),
+			CLOUDFLARE_DATABASE_ID: env('CLOUDFLARE_DATABASE_ID'),
 		});
 	},
 } satisfies PrismaConfig;
content/500-platform/10-about.mdx (1)

48-57: Minor grammar issue in Database Metrics section.

Line 50 should use the plural form: "hosts several databases" instead of "database".

 You can have a single workspace that hosts several database. Within each database, you can view
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between daabff4 and 5597ef3.

📒 Files selected for processing (4)
  • content/200-orm/050-overview/500-databases/900-turso.mdx (1 hunks)
  • content/200-orm/500-reference/325-prisma-config-reference.mdx (7 hunks)
  • content/500-platform/10-about.mdx (1 hunks)
  • content/800-guides/070-cloudflare-d1.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-11T09:40:55.237Z
Learnt from: ankur-arch
PR: prisma/docs#7066
File: content/200-orm/200-prisma-client/700-debugging-and-troubleshooting/245-troubleshooting-binary-size-issues.mdx:8-22
Timestamp: 2025-08-11T09:40:55.237Z
Learning: When the queryCompiler preview feature is enabled in Prisma ORM (v6.7.0+), it does not require Rust engines for CLI tools like `prisma migrate` or `prisma db pull`. The previous understanding that CLI tools would still need Rust binaries even with queryCompiler enabled is incorrect.

Applied to files:

  • content/200-orm/500-reference/325-prisma-config-reference.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: runner / linkspector
  • GitHub Check: Check internal links
🔇 Additional comments (1)
content/200-orm/500-reference/325-prisma-config-reference.mdx (1)

415-444: Approve updated environment variables section with env() helper guidance.

The restructured "Using environment variables" section now properly documents the env() helper function and provides clear examples for both Node v20+ and older versions. The type-safe patterns shown here are consistent with best practices.

@mhartington mhartington merged commit 3db418c into main Oct 22, 2025
8 checks passed
@mhartington mhartington deleted the mhartington/DA-5617-docs-update branch October 22, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants