Skip to content

feat: add bun guide#7092

Merged
ankur-arch merged 9 commits intomainfrom
DC-4955
Sep 1, 2025
Merged

feat: add bun guide#7092
ankur-arch merged 9 commits intomainfrom
DC-4955

Conversation

@ankur-arch
Copy link
Contributor

@ankur-arch ankur-arch commented Sep 1, 2025

Summary by CodeRabbit

  • New Features

    • Added a comprehensive guide: "How to use Prisma ORM in Bun," with an end-to-end Bun workflow, sample data seeding, and instructions to run and build a Bun HTTP service.
  • Documentation

    • Detailed Bun + Prisma Postgres walkthrough covering prerequisites, setup, adapter configuration, migrations/generation/seed commands, and environment-variable guidance.
    • Updated Guides sidebar (Development Tools) to include the new Bun guide for easier discovery.

@ankur-arch ankur-arch self-assigned this Sep 1, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

Walkthrough

Adds a new Bun + Prisma + Postgres guide at content/800-guides/370-bun.mdx and updates the Guides sidebar to include the new guides/bun entry.

Changes

Cohort / File(s) Summary
New guide: Bun + Prisma
content/800-guides/370-bun.mdx
Adds an end-to-end guide for using Prisma with Bun and Postgres: prerequisites, Bun project setup, Prisma install/init, schema updates (generator provider set to prisma-client, previewFeatures enabling driverAdapters and queryCompiler), User model, environment variables including DIRECT_URL, db.ts using PrismaPg adapter, prisma/seed.ts, prisma.config.ts with seed wiring, migrate/generate/seed commands, example index.ts Bun HTTP server, build/run and build-to-executable instructions, deployment notes and references.
Sidebar update
sidebars.ts
Inserts "guides/bun" into the Development Tools items list of the Guides sidebar; only static sidebar data changed (no export/type signature changes).

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant BunServer as Bun Server (index.ts)
    participant Prisma as PrismaClient (PrismaPg adapter)
    participant Postgres as PostgreSQL

    User->>BunServer: HTTP GET /
    activate BunServer
    BunServer->>Prisma: findMany(User) & count()
    activate Prisma
    Prisma->>Postgres: SQL (via PrismaPg, using DIRECT_URL)
    activate Postgres
    Postgres-->>Prisma: rows, count
    deactivate Postgres
    Prisma-->>BunServer: users[], total
    deactivate Prisma
    BunServer-->>User: JSON { users, total }
    deactivate BunServer

    note over Prisma,Postgres: Adapter configured via PrismaPg and DIRECT_URL
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • clerk updates #7073: Changes the Prisma generator provider from prisma-client-js to prisma-client, overlapping with generator/provider edits in the new guide.

Suggested reviewers

  • mhessdev
  • nikolasburk
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch DC-4955

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

Dangerous URL check

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

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

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 Sep 1, 2025

Images automagically compressed by Calibre's image-actions

Compression reduced images by 78.1%, saving 245.3 KB.

Filename Before After Improvement Visual comparison
static/img/guides/prisma-bun-cover.png 314.0 KB 68.7 KB 78.1% View diff

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 1, 2025

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 11ea75c
Status: ✅  Deploy successful!
Preview URL: https://950eb90d.docs-51g.pages.dev
Branch Preview URL: https://dc-4955.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: 3

🧹 Nitpick comments (2)
content/800-guides/370-bun.mdx (2)

183-191: Fix duplicate numbering (“3.2” appears twice).

Rename this heading to keep the sequence consistent.

- ### 3.2. Create Prisma Config file to run the seed script
+ ### 3.3. Create Prisma Config file to run the seed script

17-18: US English and minor grammar cleanups.

  • “installed in your system” → “installed on your system”
  • “initialise” → “initialize”
  • Consider shortening “work exactly the same as before” → “work the same as before”.
- - [Bun](https://bun.sh/docs/installation) installed in your system
+ - [Bun](https://bun.sh/docs/installation) installed on your system

- Then, initialise a new Bun project:
+ Then, initialize a new Bun project:

- ...work exactly the same as before.
+ ...work the same as before.

Also applies to: 30-36, 274-299

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c161461 and 41da55e.

⛔ Files ignored due to path filters (1)
  • static/img/guides/prisma-bun-cover.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • content/800-guides/370-bun.mdx (1 hunks)
  • sidebars.ts (1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/370-bun.mdx

[grammar] ~17-~17: There might be a mistake here.
Context: ...s/installation) installed in your system - A Prisma Postgres database ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...abase](/postgres) (created during setup) - Basic knowledge of JavaScript/TypeScript...

(QB_NEW_EN)


[uncategorized] ~49-~49: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...@prisma/adapter-pg dotenv ``` ### 2.2. Initialize Prisma ORM with Prisma Postgres Initia...

(EN_WORD_COHERENCY)


[uncategorized] ~50-~50: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...ialize Prisma ORM with Prisma Postgres Initialize Prisma ORM with Prisma Postgres in your...

(EN_WORD_COHERENCY)


[grammar] ~65-~65: There might be a mistake here.
Context: ...directory with your schema.prisma file - A new Prisma Postgres database - A `.env...

(QB_NEW_EN)


[grammar] ~66-~66: There might be a mistake here.
Context: ...afile - A new Prisma Postgres database - A.envfile with yourDATABASE_URL` ...

(QB_NEW_EN)


[grammar] ~183-~183: There might be a mistake here.
Context: ...isma.$disconnect(); }); ``` ### 3.2. Create Prisma Config file to run the seed scri...

(QB_NEW_EN)


[style] ~298-~298: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...message, and your application will work exactly the same as before. The executable includes all ...

(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)


[grammar] ~317-~317: There might be a mistake here.
Context: ...with additional models and relationships - Implementing authentication and authoriz...

(QB_NEW_EN)


[grammar] ~318-~318: There might be a mistake here.
Context: ...menting authentication and authorization - Adding input validation and error handli...

(QB_NEW_EN)


[grammar] ~319-~319: There might be a mistake here.
Context: ...ding input validation and error handling - Exploring Bun's built-in testing tools -...

(QB_NEW_EN)


[grammar] ~320-~320: There might be a mistake here.
Context: ...- Exploring Bun's built-in testing tools - Deploying your executable to production ...

(QB_NEW_EN)


[grammar] ~325-~325: There might be a mistake here.
Context: ...ers ### More info - Bun Documentation - [Prisma Driver Adapters](/orm/overview/da...

(QB_NEW_EN)


[grammar] ~326-~326: There might be a mistake here.
Context: ...//bun.sh/docs) - Prisma Driver Adapters - [Prisma Config File](/orm/reference/prism...

(QB_NEW_EN)


[grammar] ~327-~327: There might be a mistake here.
Context: .../database-drivers) - Prisma Config File - [Prisma Client without the Rust engine](/...

(QB_NEW_EN)

🔇 Additional comments (5)
sidebars.ts (1)

432-439: LGTM: Added “guides/bun” entry fits the sorted list.

Alphabetical order is preserved via .sort(). Please just verify the MDX doc resolves to id "guides/bun"; if there’s any mismatch, add slug: /guides/bun in the page frontmatter.

content/800-guides/370-bun.mdx (4)

193-202: Good use of prisma.config.ts for seeding.

migrations.seed is the correct place for the command in Prisma Config GA.

Ref: Prisma Config reference and 6.13 release notes (migrations.seed). (prisma.io, newreleases.io)


96-109: Generator config looks right for Bun + adapters (preview features).

provider: "prisma-client", output, runtime = "bun", and previewFeatures include driverAdapters + queryCompiler. Make sure project uses Prisma >= 6.7.0.

Refs: No-Rust engine + generator/runtime docs. (prisma.io)


85-90: Nice: DIRECT_URL usage with Prisma Postgres direct TCP + adapter.

The env var guidance and adapter instantiation are consistent with direct connections.

Refs: Direct connections overview and adapter instantiation examples. (prisma.io)

Also applies to: 131-141


6-6: Cover image path verified. The file static/img/guides/prisma-bun-cover.png exists.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

Images automagically compressed by Calibre's image-actions

Compression reduced images by 22%, saving 15.1 KB.

Filename Before After Improvement Visual comparison
static/img/guides/prisma-bun-cover.png 68.7 KB 53.6 KB 22.0% View diff

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 1, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 1, 2025
nurul3101
nurul3101 previously approved these changes Sep 1, 2025
Co-authored-by: Nurul Sundarani <sundarani@prisma.io>
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 1, 2025
nurul3101
nurul3101 previously approved these changes Sep 1, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

Images automagically compressed by Calibre's image-actions

Compression reduced images by 21%, saving 11.3 KB.

Filename Before After Improvement Visual comparison
static/img/guides/prisma-bun-cover.png 53.6 KB 42.3 KB 21.0% View diff

@github-actions github-actions bot dismissed stale reviews from nurul3101 and coderabbitai[bot] via ea51c63 September 1, 2025 11:32
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 (2)
content/800-guides/370-bun.mdx (2)

217-221: Remove the “generate again” step; migrate dev already generates artifacts.

prisma migrate dev applies migrations and triggers Client generation. Keep a note only if users changed generator config afterward.

-Because you are using the `node-postgres` driver adapter, you will need to generate the `PrismaClient` again. The client automatically produced by `migrate dev` is optimized for Prisma Postgres, but the adapter requires a client built specifically for the driver:
-
-```terminal
-bun prisma generate
-```
+<!-- Optional: If you changed the generator configuration after running `migrate dev`, run `bun prisma generate` to regenerate the client. -->

Ref: migrate dev “triggers the generation of artifacts (for example, Prisma Client)”. (prisma.io)


148-151: Seed script will fail without the adapter-backed client.

With driver adapters enabled, new PrismaClient() must receive the adapter; reuse the configured client from db.ts.

-import { PrismaClient } from "../generated/prisma/client";
-
-const prisma = new PrismaClient();
+import { prisma } from "../db";

This aligns with Prisma’s driver adapter requirements. (prisma.io)

🧹 Nitpick comments (4)
content/800-guides/370-bun.mdx (4)

136-141: Validate DIRECT_URL and avoid coerced “undefined”.

Guard the env var to fail fast and improve DX.

-const connectionString = `${process.env.DIRECT_URL}`;
+const connectionString = process.env.DIRECT_URL;
+if (!connectionString) {
+  throw new Error('Missing DIRECT_URL in .env');
+}

211-216: Add a short note that Node.js must be present for generate/migrate.

Prisma’s generation still requires Node.js even when using Bun; a brief callout prevents confusion.

 This command:
 
 - Creates the database tables based on your schema
 - Generates the Prisma client in the `generated/prisma` directory
+
+:::note
+Prisma CLI generation currently requires Node.js to be installed (18+), even when using Bun, for commands like `prisma generate` and `migrate dev`.
+:::

(bun.com, github.com, prisma.io)


30-34: Standardize to American English (“initialize”).

-Then, initialise a new Bun project:
+Then, initialize a new Bun project:

183-186: Fix duplicated step number (3.2 → 3.3).

-### 3.2. Create Prisma Config file to run the seed script
+### 3.3. Create Prisma Config file to run the seed script
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 41da55e and 7ad5a09.

⛔ Files ignored due to path filters (1)
  • static/img/guides/prisma-bun-cover.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • content/800-guides/370-bun.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/370-bun.mdx

[grammar] ~17-~17: There might be a mistake here.
Context: ...s/installation) installed in your system - A Prisma Postgres database ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...abase](/postgres) (created during setup) - Basic knowledge of JavaScript/TypeScript...

(QB_NEW_EN)


[uncategorized] ~49-~49: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...@prisma/adapter-pg dotenv ``` ### 2.2. Initialize Prisma ORM with Prisma Postgres Initia...

(EN_WORD_COHERENCY)


[uncategorized] ~50-~50: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...ialize Prisma ORM with Prisma Postgres Initialize Prisma ORM with Prisma Postgres in your...

(EN_WORD_COHERENCY)


[grammar] ~65-~65: There might be a mistake here.
Context: ...directory with your schema.prisma file - A new Prisma Postgres database - A `.env...

(QB_NEW_EN)


[grammar] ~66-~66: There might be a mistake here.
Context: ...afile - A new Prisma Postgres database - A.envfile with yourDATABASE_URL` ...

(QB_NEW_EN)


[grammar] ~183-~183: There might be a mistake here.
Context: ...isma.$disconnect(); }); ``` ### 3.2. Create Prisma Config file to run the seed scri...

(QB_NEW_EN)


[style] ~298-~298: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...message, and your application will work exactly the same as before. The executable includes all ...

(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)


[grammar] ~317-~317: There might be a mistake here.
Context: ...with additional models and relationships - Implementing authentication and authoriz...

(QB_NEW_EN)


[grammar] ~318-~318: There might be a mistake here.
Context: ...menting authentication and authorization - Adding input validation and error handli...

(QB_NEW_EN)


[grammar] ~319-~319: There might be a mistake here.
Context: ...ding input validation and error handling - Exploring Bun's built-in testing tools -...

(QB_NEW_EN)


[grammar] ~320-~320: There might be a mistake here.
Context: ...- Exploring Bun's built-in testing tools - Deploying your executable to production ...

(QB_NEW_EN)


[grammar] ~325-~325: There might be a mistake here.
Context: ...ers ### More info - Bun Documentation - [Prisma Driver Adapters](/orm/overview/da...

(QB_NEW_EN)


[grammar] ~326-~326: There might be a mistake here.
Context: ...//bun.sh/docs) - Prisma Driver Adapters - [Prisma Config File](/orm/reference/prism...

(QB_NEW_EN)


[grammar] ~327-~327: There might be a mistake here.
Context: .../database-drivers) - Prisma Config File - [Prisma Client without the Rust engine](/...

(QB_NEW_EN)

⏰ 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). (1)
  • GitHub Check: runner / linkspector
🔇 Additional comments (4)
content/800-guides/370-bun.mdx (4)

96-109: Generator block looks correct for Bun + adapters.

Using provider = "prisma-client", output, runtime = "bun", and preview features is consistent with current guidance.

(prisma.io)


193-202: Good use of Prisma Config migrations.seed.

Configuring seeding via migrations.seed in prisma.config.ts is the supported shape.

(prisma.io, newreleases.io)


85-90: DIRECT_URL guidance is accurate for Prisma Postgres + pg adapter.

Keeping DATABASE_URL for Prisma Postgres and DIRECT_URL for direct TCP is the right setup.

(prisma.io)


233-264: Server sample is clean and uses the shared client correctly.

Imports the singleton client and handles basic routing; good example for Bun users.

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: 0

♻️ Duplicate comments (4)
content/800-guides/370-bun.mdx (4)

54-55: Confirm CLI invocation: bunx prisma (or plain prisma) vs bun prisma.

Bun typically runs package CLIs via bunx. If you intentionally use a global/local prisma, prefer plain prisma. Otherwise, switch to bunx and pin init to @latest.

-bun prisma init --db
+bunx prisma@latest init --db
@@
-bun prisma migrate dev --name init
+bunx prisma migrate dev --name init
@@
-bun prisma generate
+bunx prisma generate
@@
-bun prisma db seed
+bunx prisma db seed

Also applies to: 209-210, 220-221, 226-227


217-221: “Generate again” isn’t required; migrate dev already generates.

Make this optional note only if generator config changed.

-Because you are using the `node-postgres` driver adapter, you will need to generate the `PrismaClient` again. The client automatically produced by `migrate dev` is optimized for Prisma Postgres, but the adapter requires a client built specifically for the driver:
-
-```terminal
-bun prisma generate
-```
+<!-- Optional: If you modified your generator config after running `migrate dev`, run `bunx prisma generate` to regenerate the client. -->

44-47: Missing pg dependency for adapter-pg (will crash at runtime).

Install pg alongside @prisma/adapter-pg.

 bun add -d prisma
-bun add @prisma/client @prisma/adapter-pg dotenv
+bun add @prisma/client @prisma/adapter-pg pg dotenv

148-151: Seed script bypasses the adapter; reuse the configured client.

Use the prisma from db.ts; otherwise seeding fails with driver adapters.

-import { PrismaClient } from "../generated/prisma/client";
-
-const prisma = new PrismaClient();
+// Reuse adapter-backed client
+import { prisma } from "../db";
@@
 main()
   .catch((e) => {
     console.error(e);
     process.exit(1);
   })
   .finally(async () => {
     await prisma.$disconnect();
   });

Also applies to: 173-181

🧹 Nitpick comments (6)
content/800-guides/370-bun.mdx (6)

183-185: Fix step numbering (duplicate “3.2”).

Rename to 3.3 to keep sequence consistent.

-### 3.2. Create Prisma Config file to run the seed script
+### 3.3. Create Prisma Config file to run the seed script

30-34: Unify English variant (“initialise” vs “Initialize”).

Use one variant consistently; docs elsewhere use American English.

-Then, initialise a new Bun project:
+Then, initialize a new Bun project:

Also applies to: 49-51


17-19: Minor grammar.

“on your system” reads more natural.

-- [Bun](https://bun.sh/docs/installation) installed in your system
+- [Bun](https://bun.sh/docs/installation) installed on your system

85-90: .env code fence contains //add markers (invalid in .env).

Ensure the site’s renderer strips these. If not, switch to # comments or remove markers.


131-141: Guard missing DIRECT_URL.

Fail fast if env is absent to aid debugging.

 import "dotenv/config";
 import { PrismaClient } from "./generated/prisma/client";
 import { PrismaPg } from "@prisma/adapter-pg";
 
-const connectionString = `${process.env.DIRECT_URL}`;
+const connectionString = process.env.DIRECT_URL;
+if (!connectionString) {
+  throw new Error("DIRECT_URL is not set in .env");
+}
 
 const adapter = new PrismaPg({ connectionString });
 
 export const prisma = new PrismaClient({ adapter });

246-257: Reduce roundtrips: fetch users and count together.

Use a transaction to parallelize queries.

-    // Return all users
-    const users = await prisma.user.findMany()
-
-    // Count all users
-    const count = await prisma.user.count()
+    // Fetch users and count concurrently
+    const [users, count] = await prisma.$transaction([
+      prisma.user.findMany(),
+      prisma.user.count(),
+    ])
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7ad5a09 and 5b18660.

⛔ Files ignored due to path filters (1)
  • static/img/guides/prisma-bun-cover-image.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • content/800-guides/370-bun.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/370-bun.mdx

[grammar] ~17-~17: There might be a mistake here.
Context: ...s/installation) installed in your system - A Prisma Postgres database ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...abase](/postgres) (created during setup) - Basic knowledge of JavaScript/TypeScript...

(QB_NEW_EN)


[uncategorized] ~49-~49: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...@prisma/adapter-pg dotenv ``` ### 2.2. Initialize Prisma ORM with Prisma Postgres Initia...

(EN_WORD_COHERENCY)


[uncategorized] ~50-~50: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...ialize Prisma ORM with Prisma Postgres Initialize Prisma ORM with Prisma Postgres in your...

(EN_WORD_COHERENCY)


[grammar] ~65-~65: There might be a mistake here.
Context: ...directory with your schema.prisma file - A new Prisma Postgres database - A `.env...

(QB_NEW_EN)


[grammar] ~66-~66: There might be a mistake here.
Context: ...afile - A new Prisma Postgres database - A.envfile with yourDATABASE_URL` ...

(QB_NEW_EN)


[grammar] ~183-~183: There might be a mistake here.
Context: ...isma.$disconnect(); }); ``` ### 3.2. Create Prisma Config file to run the seed scri...

(QB_NEW_EN)


[style] ~298-~298: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...message, and your application will work exactly the same as before. The executable includes all ...

(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)


[grammar] ~317-~317: There might be a mistake here.
Context: ...with additional models and relationships - Implementing authentication and authoriz...

(QB_NEW_EN)


[grammar] ~318-~318: There might be a mistake here.
Context: ...menting authentication and authorization - Adding input validation and error handli...

(QB_NEW_EN)


[grammar] ~319-~319: There might be a mistake here.
Context: ...ding input validation and error handling - Exploring Bun's built-in testing tools -...

(QB_NEW_EN)


[grammar] ~320-~320: There might be a mistake here.
Context: ...- Exploring Bun's built-in testing tools - Deploying your executable to production ...

(QB_NEW_EN)


[grammar] ~325-~325: There might be a mistake here.
Context: ...ers ### More info - Bun Documentation - [Prisma Driver Adapters](/orm/overview/da...

(QB_NEW_EN)


[grammar] ~326-~326: There might be a mistake here.
Context: ...//bun.sh/docs) - Prisma Driver Adapters - [Prisma Config File](/orm/reference/prism...

(QB_NEW_EN)


[grammar] ~327-~327: There might be a mistake here.
Context: .../database-drivers) - Prisma Config File - [Prisma Client without the Rust engine](/...

(QB_NEW_EN)

⏰ 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). (3)
  • GitHub Check: runner / linkspector
  • GitHub Check: Check internal links
  • GitHub Check: Lost Pixel
🔇 Additional comments (2)
content/800-guides/370-bun.mdx (2)

106-108: Verify previewFeatures and runtime fields.

driverAdapters/queryCompiler may no longer require preview flags; runtime = "bun" may be inferred in recent Prisma. Please confirm against current Prisma docs and drop flags if GA.


6-6: Verify cover image path.

Confirm /img/guides/prisma-bun-cover-image.png exists in the site assets.

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 1, 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: 2

♻️ Duplicate comments (4)
content/800-guides/370-bun.mdx (4)

54-55: CLI usage: Prefer bunx prisma (pin @latest for init) or document the local alias.

For general readers, bunx prisma is the safest default; pin init to @latest to avoid cache issues. If you intentionally use a local alias, add a snippet showing the package.json script.

- bun prisma init --db
+ bunx prisma@latest init --db
- bun prisma migrate dev --name init
+ bunx prisma migrate dev --name init
- bun prisma generate
+ bunx prisma generate
- bun prisma db seed
+ bunx prisma db seed

Optional (if keeping local): add to package.json
{
"scripts": { "prisma": "prisma" }
}
and use bun run prisma ....

Also applies to: 209-210, 220-221, 226-227


44-47: 必修: Install the pg driver with the adapter.

The PostgreSQL adapter requires the pg package; without it, the app/seed will fail at runtime.

 bun add -d prisma
-bun add @prisma/client @prisma/adapter-pg dotenv
+bun add @prisma/client @prisma/adapter-pg pg dotenv

148-151: Seed script must reuse the adapter-configured client.

With driver adapters enabled, new PrismaClient() without the adapter will fail. Import the configured client.

-import { PrismaClient } from "../generated/prisma/client";
-
-const prisma = new PrismaClient();
+// Reuse Prisma Client configured with @prisma/adapter-pg
+import { prisma } from "../db";

Also applies to: 173-181


214-221: Remove the “generate again” step; migrate dev already generates the client.

Generation is automatic; only re-run if you changed generator config after migration.

-This command:
-
-- Creates the database tables based on your schema
-- Generates the Prisma client in the `generated/prisma` directory
-
-Because you are using the `node-postgres` driver adapter, you will need to generate the `PrismaClient` again. The client automatically produced by `migrate dev` is optimized for Prisma Postgres, but the adapter requires a client built specifically for the driver:
-
-```terminal
-bun prisma generate
-```
+This command:
+
+- Creates the database tables based on your schema
+- Generates the Prisma client in the `generated/prisma` directory
+
+<!-- Optional: If you modified the generator config after running `migrate dev`, run `bunx prisma generate` to regenerate the client. -->
🧹 Nitpick comments (5)
content/800-guides/370-bun.mdx (5)

185-185: Fix internal link path consistency.

Other internal links omit /docs; this one likely 404s. Align path.

-Create a [`prisma.config.ts` file](/docs/orm/reference/prisma-config-reference#migrationsseed)
+Create a [`prisma.config.ts` file](/orm/reference/prisma-config-reference#migrationsseed)

30-34: US/UK spelling: Standardize on “Initialize.”

-Then, initialise a new Bun project:
+Then, initialize a new Bun project:

17-20: Minor grammar: “installed on your system.”

-- [Bun](https://bun.sh/docs/installation) installed in your system
+- [Bun](https://bun.sh/docs/installation) installed on your system

298-298: Tighten wording.

-... will work exactly the same as before.
+... will work the same as before.

280-299: Executable + env: document runtime env var expectations.

Compiled binaries won’t find .env if run from a different CWD; recommend exporting env vars or co-locating .env with the working directory in deployment notes.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5b18660 and 1999d7d.

📒 Files selected for processing (1)
  • content/800-guides/370-bun.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/370-bun.mdx

[grammar] ~17-~17: There might be a mistake here.
Context: ...s/installation) installed in your system - A Prisma Postgres database ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...abase](/postgres) (created during setup) - Basic knowledge of JavaScript/TypeScript...

(QB_NEW_EN)


[uncategorized] ~49-~49: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...@prisma/adapter-pg dotenv ``` ### 2.2. Initialize Prisma ORM with Prisma Postgres Initia...

(EN_WORD_COHERENCY)


[uncategorized] ~50-~50: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...ialize Prisma ORM with Prisma Postgres Initialize Prisma ORM with Prisma Postgres in your...

(EN_WORD_COHERENCY)


[grammar] ~65-~65: There might be a mistake here.
Context: ...directory with your schema.prisma file - A new Prisma Postgres database - A `.env...

(QB_NEW_EN)


[grammar] ~66-~66: There might be a mistake here.
Context: ...afile - A new Prisma Postgres database - A.envfile with yourDATABASE_URL` ...

(QB_NEW_EN)


[grammar] ~183-~183: There might be a mistake here.
Context: ...isma.$disconnect(); }); ``` ### 3.3. Create Prisma Config file to run the seed scri...

(QB_NEW_EN)


[style] ~298-~298: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...message, and your application will work exactly the same as before. The executable includes all ...

(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)


[grammar] ~317-~317: There might be a mistake here.
Context: ...with additional models and relationships - Implementing authentication and authoriz...

(QB_NEW_EN)


[grammar] ~318-~318: There might be a mistake here.
Context: ...menting authentication and authorization - Adding input validation and error handli...

(QB_NEW_EN)


[grammar] ~319-~319: There might be a mistake here.
Context: ...ding input validation and error handling - Exploring Bun's built-in testing tools -...

(QB_NEW_EN)


[grammar] ~320-~320: There might be a mistake here.
Context: ...- Exploring Bun's built-in testing tools - Deploying your executable to production ...

(QB_NEW_EN)


[grammar] ~325-~325: There might be a mistake here.
Context: ...ers ### More info - Bun Documentation - [Prisma Driver Adapters](/orm/overview/da...

(QB_NEW_EN)


[grammar] ~326-~326: There might be a mistake here.
Context: ...//bun.sh/docs) - Prisma Driver Adapters - [Prisma Config File](/orm/reference/prism...

(QB_NEW_EN)


[grammar] ~327-~327: There might be a mistake here.
Context: .../database-drivers) - Prisma Config File - [Prisma Client without the Rust engine](/...

(QB_NEW_EN)

⏰ 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). (3)
  • GitHub Check: Check internal links
  • GitHub Check: runner / linkspector
  • GitHub Check: Lost Pixel

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

♻️ Duplicate comments (3)
content/800-guides/370-bun.mdx (3)

54-55: Prefer bunx prisma (pin @latest for init), or confirm local CLI resolution.

If you intend local CLI, ensure prisma is installed and Bun resolves node_modules/.bin. Otherwise use bunx to avoid PATH/caching issues and to ensure --db support.

Option A (safer/cross-env):

- bun prisma init --db
+ bunx prisma@latest init --db
- bun prisma migrate dev --name init
+ bunx prisma migrate dev --name init
- bun prisma generate
+ bunx prisma generate
- bun prisma db seed
+ bunx prisma db seed

Option B (keep local): please verify devDependencies.prisma exists and bun --version supports resolving local bins via bun prisma.

Also applies to: 209-210, 220-221, 226-227


217-221: Remove/reword “generate again”; migrate dev already runs generate.

prisma migrate dev applies migrations and generates Prisma Client. Only run generate if you changed generator config afterward.

-Because you are using the `node-postgres` driver adapter, you will need to generate the `PrismaClient` again. The client automatically produced by `migrate dev` is optimized for Prisma Postgres, but the adapter requires a client built specifically for the driver:
-
-```terminal
-bun prisma generate
-```
+<!-- Optional: If you modified the generator config after running `migrate dev`, run `bunx prisma generate` to regenerate the client. -->

131-141: Validate DIRECT_URL and avoid coercing undefined to the string "undefined".

Read the env var directly, fail fast if missing, and pass the raw value to the adapter.

 import "dotenv/config";
 import { PrismaClient } from "./generated/prisma/client";
 import { PrismaPg } from "@prisma/adapter-pg";
 
-const connectionString = `${process.env.DIRECT_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
+const { DIRECT_URL } = process.env;
+if (!DIRECT_URL) {
+  throw new Error("DIRECT_URL is not set. Add it to your .env.");
+}
+const adapter = new PrismaPg({ connectionString: DIRECT_URL });
 
 export const prisma = new PrismaClient({ adapter });
🧹 Nitpick comments (2)
content/800-guides/370-bun.mdx (2)

30-34: Use a consistent English variant (“Initialize” vs “initialise”).

Mixing variants reads inconsistent. Docs elsewhere use US English.

-Then, initialise a new Bun project:
+Then, initialize a new Bun project:

Also applies to: 49-52


17-18: Minor grammar: “on your system”.

-- [Bun](https://bun.sh/docs/installation) installed in your system
+- [Bun](https://bun.sh/docs/installation) installed on your system
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1999d7d and 11ea75c.

📒 Files selected for processing (1)
  • content/800-guides/370-bun.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/370-bun.mdx

[grammar] ~17-~17: There might be a mistake here.
Context: ...s/installation) installed in your system - A Prisma Postgres database ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...abase](/postgres) (created during setup) - Basic knowledge of JavaScript/TypeScript...

(QB_NEW_EN)


[uncategorized] ~49-~49: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...@prisma/adapter-pg dotenv ``` ### 2.2. Initialize Prisma ORM with Prisma Postgres Initia...

(EN_WORD_COHERENCY)


[uncategorized] ~50-~50: Do not mix variants of the same word (‘initialize’ and ‘initialise’) within a single text.
Context: ...ialize Prisma ORM with Prisma Postgres Initialize Prisma ORM with Prisma Postgres in your...

(EN_WORD_COHERENCY)


[grammar] ~65-~65: There might be a mistake here.
Context: ...directory with your schema.prisma file - A new Prisma Postgres database - A `.env...

(QB_NEW_EN)


[grammar] ~66-~66: There might be a mistake here.
Context: ...afile - A new Prisma Postgres database - A.envfile with yourDATABASE_URL` ...

(QB_NEW_EN)


[grammar] ~183-~183: There might be a mistake here.
Context: ...isma.$disconnect(); }); ``` ### 3.3. Create Prisma Config file to run the seed scri...

(QB_NEW_EN)


[style] ~298-~298: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...message, and your application will work exactly the same as before. The executable includes all ...

(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)


[grammar] ~317-~317: There might be a mistake here.
Context: ...with additional models and relationships - Implementing authentication and authoriz...

(QB_NEW_EN)


[grammar] ~318-~318: There might be a mistake here.
Context: ...menting authentication and authorization - Adding input validation and error handli...

(QB_NEW_EN)


[grammar] ~319-~319: There might be a mistake here.
Context: ...ding input validation and error handling - Exploring Bun's built-in testing tools -...

(QB_NEW_EN)


[grammar] ~320-~320: There might be a mistake here.
Context: ...- Exploring Bun's built-in testing tools - Deploying your executable to production ...

(QB_NEW_EN)


[grammar] ~325-~325: There might be a mistake here.
Context: ...ers ### More info - Bun Documentation - [Prisma Driver Adapters](/orm/overview/da...

(QB_NEW_EN)


[grammar] ~326-~326: There might be a mistake here.
Context: ...//bun.sh/docs) - Prisma Driver Adapters - [Prisma Config File](/orm/reference/prism...

(QB_NEW_EN)


[grammar] ~327-~327: There might be a mistake here.
Context: .../database-drivers) - Prisma Config File - [Prisma Client without the Rust engine](/...

(QB_NEW_EN)

⏰ 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). (3)
  • GitHub Check: runner / linkspector
  • GitHub Check: Check internal links
  • GitHub Check: Lost Pixel

@ankur-arch ankur-arch merged commit 8336c9f into main Sep 1, 2025
10 of 12 checks passed
@ankur-arch ankur-arch deleted the DC-4955 branch September 1, 2025 14:35
@coderabbitai coderabbitai bot mentioned this pull request Sep 1, 2025
jlecordier pushed a commit to jlecordier/docs-1 that referenced this pull request Sep 3, 2025
* feat: add bun guide

* Optimised images with calibre/image-actions

* Optimised images with calibre/image-actions

* Update content/800-guides/370-bun.mdx

Co-authored-by: Nurul Sundarani <sundarani@prisma.io>

* Optimised images with calibre/image-actions

* fix: change image name

* fix: numbering of thesections

* fix: internal link

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nurul Sundarani <sundarani@prisma.io>
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.

2 participants