-
Notifications
You must be signed in to change notification settings - Fork 876
docs(docs): added bun workspace guide #7469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Linear: DR-6971
Dangerous URL checkNo absolute URLs to prisma.io/docs found. |
WalkthroughAdds 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Redirect checkThis PR probably requires the following redirects to be added to static/_redirects:
|
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 250-postgres/350-integrations/200-vercel.mdx
|
Deploying docs with
|
| 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 |
There was a problem hiding this 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.
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.)."♻️ 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, +});Also applies to: 190-200
|
Images automagically compressed by Calibre's image-actions ✨ Compression reduced images by 84.5%, saving 340.4 KB.
|
There was a problem hiding this 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
| - 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..."`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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.
Linear: DR-6971
Summary by CodeRabbit