Skip to content

Conversation

@aidankmcalister
Copy link
Member

@aidankmcalister aidankmcalister commented Feb 3, 2026

Linear: DR-6971

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive guide on using Prisma ORM with Postgres in Bun workspaces monorepos (setup, shared DB package patterns, configuration, seeding, monorepo scripts, Next.js integration, and tooling).
    • Added the new guide to the Guides sidebar.
    • Removed the "Postgres + Nuxt Starter" template link from the Vercel integration docs.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Dangerous URL check

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Walkthrough

Adds a new guide explaining how to use Prisma with Bun workspaces, registers the guide in the site sidebar, and removes a template link from the Vercel + Postgres integration doc.

Changes

Cohort / File(s) Summary
Bun workspaces guide
content/800-guides/460-bun-workspaces.mdx
New documentation file providing step‑by‑step setup for Prisma in a Bun workspaces monorepo: project layout, shared Prisma package, schema/client configuration, seeding, root scripts, Next.js integration, and runtime commands.
Navigation configuration
sidebars.ts
Added guides/bun-workspaces to the Development Tools guides list so the new guide appears in the site sidebar.
Vercel integration doc
content/250-postgres/350-integrations/200-vercel.mdx
Removed the "Postgres + Nuxt Starter" template link from the Templates list (content deletion).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • feat: add bun guide #7092 — Adds another Bun-related guide with corresponding sidebar registration in the same navigation structure.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changeset: adding a new Bun workspace guide to the documentation. It is concise, specific, and directly reflects the primary change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

🍈 Lychee Link Check Report

Note: Links are cached for 5 minutes. Failed links (timeouts, rate limits) are retried in a second run with longer timeout.

📊 Results Overview

Status Count
🔍 Total 2314
✅ Successful 2282
⏳ Timeouts 0
🔀 Redirected 4
👻 Excluded 26
❓ Unknown 0
🚫 Errors 1
⛔ Unsupported 1

Errors per input

Errors in 250-postgres/350-integrations/200-vercel.mdx

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 3, 2026

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6cc48a0
Status: ✅  Deploy successful!
Preview URL: https://6e1c7f30.docs-51g.pages.dev
Branch Preview URL: https://docs-docs--bun-workspace-gui.docs-51g.pages.dev

View logs

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

🤖 Fix all issues with AI agents
In `@content/800-guides/460-bun-workspaces.mdx`:
- Around line 100-108: The Prisma schema's datasource block (datasource db) is
missing the required url field; update the datasource db block in
prisma/schema.prisma to include a url that references the environment variable
(use env("DATABASE_URL")) so Prisma schema validation and CLI commands succeed.
🧹 Nitpick comments (1)
content/800-guides/460-bun-workspaces.mdx (1)

155-176: Align connection string examples with docs convention.

Use the template-literal pattern for env-based connection strings in adapter examples for consistency.

♻️ Suggested update (apply in both client.ts and seed.ts snippets)
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
-  connectionString: process.env.DATABASE_URL,
-});
+import { PrismaPg } from "@prisma/adapter-pg";
+
+const connectionString = `${process.env.DATABASE_URL}`;
+const adapter = new PrismaPg({
+  connectionString,
+});
Based on learnings, "In Prisma docs, when showing examples of instantiating driver adapters with connection strings from environment variables, use the template literal pattern `const connectionString = `${process.env.DATABASE_URL}`` for consistency across all database adapter examples (PostgreSQL, MySQL/MariaDB, etc.)."

Also applies to: 190-200

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 3, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Images automagically compressed by Calibre's image-actions

Compression reduced images by 84.5%, saving 340.4 KB.

Filename Before After Improvement Visual comparison
static/img/guides/prisma-bun-workspaces-cover.png 402.9 KB 62.5 KB 84.5% View diff

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

🤖 Fix all issues with AI agents
In `@content/800-guides/460-bun-workspaces.mdx`:
- Around line 94-97: Update the description for prisma.config.ts to reflect
Prisma v7's generated template: state that the file imports "dotenv/config" and
uses env("DATABASE_URL") from the prisma/config module (not process.env),
replacing the prior claim that it "uses process.env and expects dotenv";
reference prisma.config.ts, the env("DATABASE_URL") call, and the
"dotenv/config" import so the text matches the actual output of prisma init
--db.
🧹 Nitpick comments (1)
content/800-guides/460-bun-workspaces.mdx (1)

160-162: Use the standard connectionString template-literal pattern in adapter examples.
Keeps consistency across docs and avoids mixing styles in adjacent snippets.

Proposed edit (client.ts and seed.ts)
-const adapter = new PrismaPg({
-  connectionString: process.env.DATABASE_URL,
-});
+const connectionString = `${process.env.DATABASE_URL}`;
+const adapter = new PrismaPg({
+  connectionString,
+});
@@
-const adapter = new PrismaPg({
-  connectionString: process.env.DATABASE_URL!,
-});
+const connectionString = `${process.env.DATABASE_URL}`;
+const adapter = new PrismaPg({
+  connectionString,
+});

Based on learnings: In Prisma docs, when showing examples of instantiating driver adapters with connection strings from environment variables, use the template literal pattern const connectionString = ${process.env.DATABASE_URL}`` for consistency across all database adapter examples (PostgreSQL, MySQL/MariaDB, etc.).

Also applies to: 196-198

Comment on lines +94 to +97
- Connects your CLI to your [Prisma Data Platform](https://console.prisma.io) account. If you're not logged in or don't have an account, your browser will open to guide you through creating a new account or signing into your existing one.
- Creates a `prisma` directory containing a `schema.prisma` file for your database models.
- Creates a `prisma.config.ts` file (which uses `process.env["DATABASE_URL"]` and expects `dotenv`).
- Creates a `.env` file with your `DATABASE_URL` (e.g., for Prisma Postgres it should have something similar to `DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=eyJhbGciOiJIUzI..."`).
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n content/800-guides/460-bun-workspaces.mdx | sed -n '85,105p'

Repository: prisma/docs

Length of output: 1292


🌐 Web query:

Prisma v7 prisma init --db generated prisma.config.ts template

💡 Result:

If you run Prisma ORM v7+:

npx prisma@latest init --db

…it will create prisma.config.ts (plus prisma/schema.prisma, etc.). If --db “is not recognized”, it’s usually npx caching—use npx prisma@latest init --db explicitly. [3]

Typical prisma.config.ts template (Node)

This is the shape Prisma expects (and matches what Prisma’s guides show after init --db):

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

export default defineConfig({
  schema: "prisma/schema.prisma",
  migrations: {
    path: "prisma/migrations",
  },
  // (you may see engine in some templates/guides)
  engine: "classic",
  datasource: {
    url: env("DATABASE_URL"),
  },
});

Prisma config files support prisma.config.ts (and other extensions/locations), and .env is not auto-loaded when using prisma.config.ts—so importing dotenv/config (in Node) is the common fix. [4][5][2]

Note on Bun vs Node

As of Prisma ORM 7.2.0 (Dec 17, 2025), prisma init generates runtime-specific config output (e.g., it won’t assume dotenv is needed for Bun). [1]

Sources: Prisma ORM 7.2.0 announcement [1], Prisma “React Router 7” guide showing init --db + config example [2], Prisma docs troubleshooting for --db not recognized / npx caching [3], Prisma config reference (file names + .env loading behavior) [4], Prisma config patterns (defineConfig, env()) [5].


Update the prisma.config.ts description to match Prisma v7's actual generated template.

The generated file uses env("DATABASE_URL") from the prisma/config module (not process.env), and it explicitly imports "dotenv/config" rather than simply "expecting" it. Update line 96 to:

- Creates a `prisma.config.ts` file (which uses `process.env["DATABASE_URL"]` and expects `dotenv`).
+ Creates a `prisma.config.ts` file (which uses `env("DATABASE_URL")` from `prisma/config` and includes `import "dotenv/config"`).

This matches the actual template generated by prisma init --db in Prisma v7.

🤖 Prompt for AI Agents
In `@content/800-guides/460-bun-workspaces.mdx` around lines 94 - 97, Update the
description for prisma.config.ts to reflect Prisma v7's generated template:
state that the file imports "dotenv/config" and uses env("DATABASE_URL") from
the prisma/config module (not process.env), replacing the prior claim that it
"uses process.env and expects dotenv"; reference prisma.config.ts, the
env("DATABASE_URL") call, and the "dotenv/config" import so the text matches the
actual output of prisma init --db.

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.

1 participant