Skip to content

fix: update cloudflare D1 guide #7055

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

fix: update cloudflare D1 guide #7055

wants to merge 7 commits into from

Conversation

ankur-arch
Copy link
Contributor

@ankur-arch ankur-arch commented Aug 5, 2025

Summary by CodeRabbit

  • Documentation
    • Expanded and restructured the guide for setting up Prisma ORM with Cloudflare D1, providing clearer step-by-step instructions, updated configuration examples, and improved procedural details.
    • Updated configuration examples for Cloudflare D1 adapter to improve formatting consistency and clarify environment variable usage.
    • Adjusted heading levels in the Prisma config reference for better readability.

@ankur-arch ankur-arch requested a review from nikolasburk August 5, 2025 10:19
Copy link

coderabbitai bot commented Aug 5, 2025

Walkthrough

The updates revise and expand documentation and configuration examples for integrating Prisma ORM with Cloudflare D1. The changes include improved formatting, updated configuration syntax, expanded step-by-step setup instructions, and corrections to code and headings for clarity and consistency across guides and reference materials.

Changes

Cohort / File(s) Change Summary
Cloudflare D1 ORM Setup Guide
content/800-guides/070-cloudflare-d1.mdx
Restructured and expanded the guide with step-by-step instructions for setting up Prisma ORM with Cloudflare D1. Updated project initialization using npm create cloudflare, schema configuration, dependency installation including dotenv and @prisma/adapter-d1, environment variable creation with detailed token setup, and Worker implementation with updated imports and formatting. Added instructions for local testing and deployment environment variables.
Prisma Config Example Update
content/200-orm/050-overview/500-databases/950-cloudflare-d1.mdx
Updated the Prisma config example for Cloudflare D1: improved import formatting by adding semicolons and removing unused imports, enforced environment variable presence with TypeScript non-null assertions, simplified schema path from path.join to a string literal, and reformatted the experimental adapter block with consistent indentation and tabs.
Reference Documentation Heading Correction
content/200-orm/500-reference/325-prisma-config-reference.mdx
Changed the markdown heading for the adapter section under migrate from a fourth-level heading (#### adapter) to a third-level heading (### adapter) for consistency; no content changes were made.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Cloudflare Worker
    participant Prisma Client
    participant Cloudflare D1

    Developer->>Cloudflare Worker: Deploys Worker with environment variables
    Cloudflare Worker->>Prisma Client: Initializes PrismaClient with D1 adapter
    Prisma Client->>Cloudflare D1: Executes queries (e.g., findMany)
    Cloudflare D1-->>Prisma Client: Returns query results
    Prisma Client-->>Cloudflare Worker: Returns data
    Cloudflare Worker-->>Developer: Responds to HTTP request with data
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

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

🪧 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
  • 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 src/utils.ts and explain its main purpose.
    • @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 comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai 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

Documentation and Community

  • 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.

Copy link
Contributor

github-actions bot commented Aug 5, 2025

Dangerous URL check

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

Copy link
Contributor

github-actions bot commented Aug 5, 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.

Copy link

cloudflare-workers-and-pages bot commented Aug 5, 2025

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: fa6dbba
Status: ✅  Deploy successful!
Preview URL: https://c3b6d786.docs-51g.pages.dev
Branch Preview URL: https://dc-4696.docs-51g.pages.dev

View logs

Copy link

@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: 4

🔭 Outside diff range comments (1)
content/800-guides/070-cloudflare-d1.mdx (1)

214-218: Section numbering is off

Inside “## 5. Set up database migrations” the sub-heading is labelled ### 4.3 Run your first migration.
Should be ### 5.3 to stay in sequence.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01995a4 and 9d381e7.

📒 Files selected for processing (3)
  • content/200-orm/050-overview/500-databases/950-cloudflare-d1.mdx (1 hunks)
  • content/200-orm/500-reference/325-prisma-config-reference.mdx (1 hunks)
  • content/800-guides/070-cloudflare-d1.mdx (6 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/070-cloudflare-d1.mdx

[grammar] ~24-~24: Use proper capitalization
Context: ...Cloudflare Worker and initialize Prisma ORM Run the following command to create a [n...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~32-~32: There might be a mistake here.
Context: ...` Then navigate into the newly created directory: bash cd d1-tutorial And initialize Prisma ORM in the pr...

(QB_NEW_EN_OTHER)


[grammar] ~38-~38: There might be a mistake here.
Context: ...l And initialize Prisma ORM in the project: bash npx prisma init --datasource-provider sqlite ``` And install the Prisma ORM CLI as a...

(QB_NEW_EN_OTHER)


[grammar] ~44-~44: There might be a mistake here.
Context: ...all the Prisma ORM CLI as a development dependency: bash npm install --save-dev prisma ## 2. Configure Prisma schema In your...

(QB_NEW_EN_OTHER)


[grammar] ~50-~50: There might be a mistake here.
Context: ...-dev prisma ``` ## 2. Configure Prisma schema In your Prisma schema, add the `driverAd...

(QB_NEW_EN_OTHER)


[grammar] ~52-~52: There might be a mistake here.
Context: ...re to add the following User model to it: prisma file=prisma/schema.prisma generator client { provider = "prisma-client-js" output = "../src/generated/prisma" //add-next-line previewFeatures = ["driverAdapters"] } datasource db { provider = "sqlite" url = env("DATABASE_URL") } //add-start model User { id Int @id @default(autoincrement()) email String @unique name String? } //add-end ## 3. Install depend...

(QB_NEW_EN_OTHER)


[grammar] ~76-~76: There might be a mistake here.
Context: ... String? } //add-end ``` ## 3. Install dependencies Next, install the required packages: ``...

(QB_NEW_EN_OTHER)


[grammar] ~78-~78: There might be a mistake here.
Context: ...ependencies Next, install the required packages: terminal npm install @prisma/adapter-d1 dotenv Also, be sure to use a version of t...

(QB_NEW_EN_OTHER)


[grammar] ~84-~84: Use correct spacing
Context: ...at's used in the next sections won't be available. ## 4. Create a D1 database Run the followi...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~86-~86: There might be a mistake here.
Context: ... won't be available. ## 4. Create a D1 database Run the following command to create a ne...

(QB_NEW_EN_OTHER)


[grammar] ~88-~88: There might be a mistake here.
Context: ...he following command to create a new D1 database: bash npx wrangler@latest d1 create __YOUR_D1_DATABASE_NAME__ :::note The `__YOUR_D1_DATABASE_NA...

(QB_NEW_EN_OTHER)


[grammar] ~96-~96: There might be a problem here.
Context: ...r D1 database. For example, you can use prisma-d1-example. ::: THis command will authenticate you with...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~100-~100: Ensure spelling is correct
Context: ...with Cloudflare and ask you to select a Cloduflare account. After that, it will create a n...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~100-~100: There might be a mistake here.
Context: ...database and output the database ID and name: terminal ✅ Successfully created DB '__YOUR_D1_DATABASE_NAME__' in region __REGION__ Created your new D1 database. { "d1_databases": [ { "binding": "DB", "database_name": "__YOUR_D1_DATABASE_NAME__", "database_id": "<unique-ID-for-your-database>" } ] } Copy the terminal output...

(QB_NEW_EN_OTHER)


[grammar] ~117-~117: Use correct spacing
Context: ...onfigure your Cloudflare Worker and its bindings. To connect your Workers with the D1 inst...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~120-~120: There might be a mistake here.
Context: ...ance, add the following binding to your wrangler.jsonc: json file=wrangler.jsonc { "$schema": "node_modules/wrangler/config-schema.json", "name": "d1-tutorial", "main": "src/index.ts", "compatibility_date": "2025-08-05", "d1_databases": [ { "binding": "DB", "database_name": "__YOUR_D1_DATABASE_NAME__" // to be replaced "database_id": "__YOUR_D1_DATABASE_ID__" // to be replaced } ] } :::note The `__YOUR_D...

(QB_NEW_EN_OTHER)


[grammar] ~141-~141: Use correct spacing
Context: ...the database name and ID of your own D1 instance. If you weren't able to grab the database...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~143-~143: There might be a problem here.
Context: ...info YOUR_D1_DATABASE_NAME` in your terminal. ::: ## 5. Set up database migrations :::note ...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~147-~147: There might be a problem here.
Context: ...r terminal. ::: ## 5. Set up database migrations :::note We recommend using prisma migrate in o...

(QB_NEW_EN_MERGED_MATCH)


[style] ~151-~151: Consider a more concise word here.
Context: ...te We recommend using prisma migrate in order to keep your data in D1 migrated. However,...

(IN_ORDER_TO_PREMIUM)


[grammar] ~151-~151: There might be a mistake here.
Context: ...r to use Cloudflare's migration system, [that workflow is also available](/orm/overvi...

(QB_NEW_EN_OTHER)


[grammar] ~151-~151: There might be a problem here.
Context: ...igration system, that workflow is also available ::: ### 5.1 Add needed environment variables In...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~155-~155: There might be a mistake here.
Context: ...i) ::: ### 5.1 Add needed environment variables In order to use the Prisma D1 adapter, y...

(QB_NEW_EN_OTHER)


[grammar] ~164-~164: Use prepositions correctly
Context: ...i-tokens 2. Click "Create Token" 3. On the Custom token section click on "G...

(QB_NEW_EN_OTHER_ERROR_IDS_7)


[grammar] ~164-~164: Use a comma after introductory words or phrases
Context: ...reate Token" 3. On the Custom token section click on "Get started". 4. Fill out ...

(QB_NEW_EN_OTHER_ERROR_IDS_19)


[grammar] ~164-~164: Use correct spacing
Context: ... 3. On the Custom token section click on "Get started". 4. Fill out the template: M...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~164-~164: There might be a mistake here.
Context: ...om token* section click on "Get started". 4. Fill out the template: Make sure y...

(QB_NEW_EN_OTHER)


[grammar] ~165-~165: There might be a mistake here.
Context: ...plate: Make sure you use a recognizable name 5. For the Permissions, add the `Account / ...

(QB_NEW_EN_OTHER)


[grammar] ~167-~167: There might be a mistake here.
Context: ...tinue to summary" and then "Create Token". 7. Click on "Copy" and store the toke...

(QB_NEW_EN_OTHER)


[grammar] ~168-~168: Use correct spacing
Context: ...on "Copy" and store the token in a safe place. You can now store these secrets to be us...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~180-~180: Use correct spacing
Context: ..."F8Cg..." ``` ### 5.2 Configure Prisma Config Ensure that you have a `prisma.config.ts...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~182-~182: Use correct spacing
Context: ...erence/prisma-config-reference#adapter) defined. ts import type { PrismaConfig } from 'prisma'; import { PrismaD1 } from '@prisma/adapter-d1'; // import your .env file import 'dotenv/config'; export default { experimental: { adapter: true, }, schema: 'prisma/schema.prisma', 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!, }); }, } satisfies PrismaConfig; :::note As of [Prisma ORM v6.11.0](http...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~208-~208: There might be a problem here.
Context: ...has been renamed from PrismaD1HTTP to PrismaD1. ::: This will allow prisma migrate to int...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~270-~270: There might be a problem here.
Context: ...onse(result); }, }; ``` ## 6. Run the Worker locally First copy the contents of your .env file t...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~272-~272: Use correct spacing
Context: ...nment variables when running the Worker locally. bash cp .env .dev.vars Next, you need to run the Worker locally...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~278-~278: There might be a mistake here.
Context: ...ommand available in your terminal, then run: With the database query in place and Pr...

(QB_NEW_EN_OTHER)


[grammar] ~302-~302: There might be a problem here.
Context: ...ded for the Worker to connect to the D1 database. ::: Your deployed Worker is accessible via ...

(QB_NEW_EN_MERGED_MATCH)

⏰ 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). (4)
  • GitHub Check: runner / linkspector
  • GitHub Check: Check internal links
  • GitHub Check: Lost Pixel
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
content/200-orm/500-reference/325-prisma-config-reference.mdx (1)

123-124: Heading-level change looks good

Switching from #### to ### for the adapter section keeps the heading hierarchy consistent with the surrounding options. No further action needed.

Copy link

@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

🔭 Outside diff range comments (1)
content/800-guides/070-cloudflare-d1.mdx (1)

214-214: Heading number is out of sequence (4.35.3)

You are inside section 5. Set up database migrations, so the sub-heading should be ### 5.3 Run your first migration to avoid confusion and broken automatic anchors.

♻️ Duplicate comments (1)
content/800-guides/070-cloudflare-d1.mdx (1)

251-252: Import path still points to non-existent client sub-folder

With output = "../src/generated/prisma" the generated entry file is src/generated/prisma/index.(ts|js).
From src/index.ts the correct relative import is ./generated/prisma, not ./generated/prisma/client.

-import { PrismaClient } from './generated/prisma/client';
+import { PrismaClient } from './generated/prisma';
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d381e7 and 0534f8e.

📒 Files selected for processing (1)
  • content/800-guides/070-cloudflare-d1.mdx (5 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/070-cloudflare-d1.mdx

[grammar] ~24-~24: Use proper capitalization
Context: ...Cloudflare Worker and initialize Prisma ORM Run the following command to create a [n...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~32-~32: There might be a mistake here.
Context: ...` Then navigate into the newly created directory: bash cd d1-tutorial And initialize Prisma ORM in the pr...

(QB_NEW_EN_OTHER)


[grammar] ~38-~38: There might be a mistake here.
Context: ...l And initialize Prisma ORM in the project: bash npx prisma init --datasource-provider sqlite ``` And install the Prisma ORM CLI as a...

(QB_NEW_EN_OTHER)


[grammar] ~44-~44: There might be a mistake here.
Context: ...all the Prisma ORM CLI as a development dependency: bash npm install --save-dev prisma ## 2. Configure Prisma schema In your...

(QB_NEW_EN_OTHER)


[grammar] ~50-~50: There might be a mistake here.
Context: ...-dev prisma ``` ## 2. Configure Prisma schema In your Prisma schema, add the `driverAd...

(QB_NEW_EN_OTHER)


[grammar] ~52-~52: There might be a mistake here.
Context: ...re to add the following User model to it: prisma file=prisma/schema.prisma generator client { provider = "prisma-client-js" output = "../src/generated/prisma" //add-next-line previewFeatures = ["driverAdapters"] } datasource db { provider = "sqlite" url = env("DATABASE_URL") } //add-start model User { id Int @id @default(autoincrement()) email String @unique name String? } //add-end ## 3. Install depend...

(QB_NEW_EN_OTHER)


[grammar] ~76-~76: There might be a mistake here.
Context: ... String? } //add-end ``` ## 3. Install dependencies Next, install the required packages: ``...

(QB_NEW_EN_OTHER)


[grammar] ~78-~78: There might be a mistake here.
Context: ...ependencies Next, install the required packages: terminal npm install @prisma/adapter-d1 dotenv Also, be sure to use a version of t...

(QB_NEW_EN_OTHER)


[grammar] ~84-~84: Use correct spacing
Context: ...at's used in the next sections won't be available. ## 4. Create a D1 database Run the followi...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~86-~86: There might be a mistake here.
Context: ... won't be available. ## 4. Create a D1 database Run the following command to create a ne...

(QB_NEW_EN_OTHER)


[grammar] ~88-~88: There might be a mistake here.
Context: ...he following command to create a new D1 database: bash npx wrangler@latest d1 create __YOUR_D1_DATABASE_NAME__ :::note The `__YOUR_D1_DATABASE_NA...

(QB_NEW_EN_OTHER)


[grammar] ~96-~96: There might be a problem here.
Context: ...r D1 database. For example, you can use prisma-d1-example. ::: This command will authenticate you with...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~100-~100: There might be a mistake here.
Context: ...database and output the database ID and name: terminal ✅ Successfully created DB '__YOUR_D1_DATABASE_NAME__' in region __REGION__ Created your new D1 database. { "d1_databases": [ { "binding": "DB", "database_name": "__YOUR_D1_DATABASE_NAME__", "database_id": "<unique-ID-for-your-database>" } ] } Copy the terminal output...

(QB_NEW_EN_OTHER)


[grammar] ~117-~117: Use correct spacing
Context: ...onfigure your Cloudflare Worker and its bindings. To connect your Workers with the D1 inst...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~120-~120: There might be a mistake here.
Context: ...ance, add the following binding to your wrangler.jsonc: json file=wrangler.jsonc { "$schema": "node_modules/wrangler/config-schema.json", "name": "d1-tutorial", "main": "src/index.ts", "compatibility_date": "2025-08-05", "d1_databases": [ { "binding": "DB", "database_name": "__YOUR_D1_DATABASE_NAME__" // to be replaced "database_id": "__YOUR_D1_DATABASE_ID__" // to be replaced } ] } :::note The `__YOUR_D...

(QB_NEW_EN_OTHER)


[grammar] ~141-~141: Use correct spacing
Context: ...the database name and ID of your own D1 instance. If you weren't able to grab the database...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~143-~143: There might be a problem here.
Context: ...info YOUR_D1_DATABASE_NAME` in your terminal. ::: ## 5. Set up database migrations :::note ...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~147-~147: There might be a problem here.
Context: ...r terminal. ::: ## 5. Set up database migrations :::note We recommend using prisma migrate in o...

(QB_NEW_EN_MERGED_MATCH)


[style] ~151-~151: Consider a more concise word here.
Context: ...te We recommend using prisma migrate in order to keep your data in D1 migrated. However,...

(IN_ORDER_TO_PREMIUM)


[grammar] ~151-~151: There might be a mistake here.
Context: ...r to use Cloudflare's migration system, [that workflow is also available](/orm/overvi...

(QB_NEW_EN_OTHER)


[grammar] ~151-~151: There might be a problem here.
Context: ...igration system, that workflow is also available ::: ### 5.1 Add needed environment variables In...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~155-~155: There might be a mistake here.
Context: ...i) ::: ### 5.1 Add needed environment variables In order to use the Prisma D1 adapter, y...

(QB_NEW_EN_OTHER)


[style] ~156-~156: Consider a more concise word here.
Context: ...# 5.1 Add needed environment variables In order to use the Prisma D1 adapter, you'll need ...

(IN_ORDER_TO_PREMIUM)


[grammar] ~157-~157: Use colons correctly
Context: ...l need to add a few secrets to a .env file: - DATABASE_URL: A path to your local D1 instance. Usual...

(QB_NEW_EN_OTHER_ERROR_IDS_30)


[grammar] ~161-~161: Use colons correctly
Context: ...-a-d1-database). - CLOUDFLARE_D1_TOKEN: This API token is used by Prisma ORM to comm...

(QB_NEW_EN_OTHER_ERROR_IDS_30)


[grammar] ~163-~163: Punctuation usually goes inside quotation marks
Context: ...m/profile/api-tokens 2. Click "Create Token" 3. On the Custom token section cli...

(QB_NEW_EN_OTHER_ERROR_IDS_20)


[grammar] ~164-~164: Use prepositions correctly
Context: ...i-tokens 2. Click "Create Token" 3. On the Custom token section click on "G...

(QB_NEW_EN_OTHER_ERROR_IDS_7)


[grammar] ~164-~164: Use a comma after introductory words or phrases
Context: ...reate Token" 3. On the Custom token section click on "Get started". 4. Fill out ...

(QB_NEW_EN_OTHER_ERROR_IDS_19)


[grammar] ~164-~164: Use correct spacing
Context: ... 3. On the Custom token section click on "Get started". 4. Fill out the template: M...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~164-~164: There might be a mistake here.
Context: ...om token* section click on "Get started". 4. Fill out the template: Make sure y...

(QB_NEW_EN_OTHER)


[grammar] ~165-~165: There might be a mistake here.
Context: ...plate: Make sure you use a recognizable name 5. For the Permissions, add the `Account / ...

(QB_NEW_EN_OTHER)


[grammar] ~167-~167: There might be a mistake here.
Context: ...tinue to summary" and then "Create Token". 7. Click on "Copy" and store the toke...

(QB_NEW_EN_OTHER)


[grammar] ~168-~168: Use correct spacing
Context: ...on "Copy" and store the token in a safe place. You can now store these secrets to be us...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~180-~180: Use correct spacing
Context: ..."F8Cg..." ``` ### 5.2 Configure Prisma Config Ensure that you have a `prisma.config.ts...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~182-~182: Use correct spacing
Context: ...erence/prisma-config-reference#adapter) defined. ts import type { PrismaConfig } from 'prisma'; import { PrismaD1 } from '@prisma/adapter-d1'; // import your .env file import 'dotenv/config'; export default { experimental: { adapter: true, }, schema: 'prisma/schema.prisma', 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!, }); }, } satisfies PrismaConfig; :::note As of [Prisma ORM v6.11.0](http...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~208-~208: There might be a problem here.
Context: ...has been renamed from PrismaD1HTTP to PrismaD1. ::: This will allow prisma migrate to int...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~270-~270: There might be a problem here.
Context: ...onse(result); }, }; ``` ## 6. Run the Worker locally First copy the contents of your .env file t...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~272-~272: Use correct spacing
Context: ...nment variables when running the Worker locally. bash cp .env .dev.vars Next, you need to run the Worker locally...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~278-~278: There might be a mistake here.
Context: ...ommand available in your terminal, then run: With the database query in place and Pr...

(QB_NEW_EN_OTHER)


[grammar] ~302-~302: There might be a problem here.
Context: ...ded for the Worker to connect to the D1 database. ::: Your deployed Worker is accessible via ...

(QB_NEW_EN_MERGED_MATCH)

⏰ 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 self-assigned this Aug 5, 2025
Copy link

@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

🔭 Outside diff range comments (2)
content/800-guides/070-cloudflare-d1.mdx (2)

214-218: Header numbering is off (### 4.3 appears inside section 5)

Readers following the steps will jump back in numbering. Rename the sub-heading to ### 5.3 Run your first migration (and update any internal anchors) to keep the sequence consistent.


294-297: Minor typo – “run the the following command” → “run the following command”.

♻️ Duplicate comments (1)
content/800-guides/070-cloudflare-d1.mdx (1)

251-262: Import path still inconsistent with the configured output directory

The client is generated into src/generated/prisma/index.(ts|js) (via output = "../src/generated/prisma"), so importing from ./generated/prisma/client will 404 at runtime.

-import { PrismaClient } from './generated/prisma/client';
+import { PrismaClient } from './generated/prisma';
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc58b12 and 51c2ab6.

📒 Files selected for processing (1)
  • content/800-guides/070-cloudflare-d1.mdx (5 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/070-cloudflare-d1.mdx

[grammar] ~24-~24: Use proper capitalization
Context: ...Cloudflare Worker and initialize Prisma ORM Run the following command to create a [n...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~32-~32: There might be a mistake here.
Context: ...` Then navigate into the newly created directory: bash cd d1-tutorial And initialize Prisma ORM in the pr...

(QB_NEW_EN_OTHER)


[grammar] ~38-~38: There might be a mistake here.
Context: ...l And initialize Prisma ORM in the project: bash npx prisma init --datasource-provider sqlite ``` And install the Prisma ORM CLI as a...

(QB_NEW_EN_OTHER)


[grammar] ~44-~44: There might be a mistake here.
Context: ...all the Prisma ORM CLI as a development dependency: bash npm install --save-dev prisma ## 2. Configure Prisma schema In your...

(QB_NEW_EN_OTHER)


[grammar] ~50-~50: There might be a mistake here.
Context: ...-dev prisma ``` ## 2. Configure Prisma schema In your Prisma schema, add the `driverAd...

(QB_NEW_EN_OTHER)


[grammar] ~52-~52: There might be a mistake here.
Context: ...re to add the following User model to it: prisma file=prisma/schema.prisma generator client { provider = "prisma-client-js" output = "../src/generated/prisma" //add-next-line previewFeatures = ["driverAdapters"] } datasource db { provider = "sqlite" url = env("DATABASE_URL") } //add-start model User { id Int @id @default(autoincrement()) email String @unique name String? } //add-end ## 3. Install depend...

(QB_NEW_EN_OTHER)


[grammar] ~76-~76: There might be a mistake here.
Context: ... String? } //add-end ``` ## 3. Install dependencies Next, install the required packages: ``...

(QB_NEW_EN_OTHER)


[grammar] ~78-~78: There might be a mistake here.
Context: ...ependencies Next, install the required packages: terminal npm install @prisma/adapter-d1 dotenv Also, be sure to use a version of t...

(QB_NEW_EN_OTHER)


[grammar] ~84-~84: Use correct spacing
Context: ...at's used in the next sections won't be available. ## 4. Create a D1 database Run the followi...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~86-~86: There might be a mistake here.
Context: ... won't be available. ## 4. Create a D1 database Run the following command to create a ne...

(QB_NEW_EN_OTHER)


[grammar] ~88-~88: There might be a mistake here.
Context: ...he following command to create a new D1 database: bash npx wrangler@latest d1 create __YOUR_D1_DATABASE_NAME__ :::note The `__YOUR_D1_DATABASE_NA...

(QB_NEW_EN_OTHER)


[grammar] ~96-~96: There might be a problem here.
Context: ...r D1 database. For example, you can use prisma-d1-example. ::: This command will authenticate you with...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~100-~100: There might be a mistake here.
Context: ...database and output the database ID and name: terminal ✅ Successfully created DB '__YOUR_D1_DATABASE_NAME__' in region __REGION__ Created your new D1 database. { "d1_databases": [ { "binding": "DB", "database_name": "__YOUR_D1_DATABASE_NAME__", "database_id": "<unique-ID-for-your-database>" } ] } Copy the terminal output...

(QB_NEW_EN_OTHER)


[grammar] ~117-~117: Use correct spacing
Context: ...onfigure your Cloudflare Worker and its bindings. To connect your Workers with the D1 inst...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~120-~120: There might be a mistake here.
Context: ...ance, add the following binding to your wrangler.jsonc: json file=wrangler.jsonc { "$schema": "node_modules/wrangler/config-schema.json", "name": "d1-tutorial", "main": "src/index.ts", "compatibility_date": "2025-08-05", "d1_databases": [ { "binding": "DB", "database_name": "__YOUR_D1_DATABASE_NAME__", // to be replaced "database_id": "__YOUR_D1_DATABASE_ID__" // to be replaced } ] } :::note The `__YOUR_D...

(QB_NEW_EN_OTHER)


[grammar] ~141-~141: Use correct spacing
Context: ...the database name and ID of your own D1 instance. If you weren't able to grab the database...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~143-~143: There might be a problem here.
Context: ...info YOUR_D1_DATABASE_NAME` in your terminal. ::: ## 5. Set up database migrations :::note ...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~147-~147: There might be a problem here.
Context: ...r terminal. ::: ## 5. Set up database migrations :::note We recommend using prisma migrate in o...

(QB_NEW_EN_MERGED_MATCH)


[style] ~151-~151: Consider a more concise word here.
Context: ...te We recommend using prisma migrate in order to keep your data in D1 migrated. However,...

(IN_ORDER_TO_PREMIUM)


[grammar] ~151-~151: There might be a mistake here.
Context: ...r to use Cloudflare's migration system, [that workflow is also available](/orm/overvi...

(QB_NEW_EN_OTHER)


[grammar] ~151-~151: There might be a problem here.
Context: ...igration system, that workflow is also available ::: ### 5.1 Add needed environment variables In...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~155-~155: There might be a mistake here.
Context: ...i) ::: ### 5.1 Add needed environment variables In order to use the Prisma D1 adapter, y...

(QB_NEW_EN_OTHER)


[style] ~156-~156: Consider a more concise word here.
Context: ...# 5.1 Add needed environment variables In order to use the Prisma D1 adapter, you'll need ...

(IN_ORDER_TO_PREMIUM)


[grammar] ~157-~157: Use colons correctly
Context: ...l need to add a few secrets to a .env file: - DATABASE_URL: A path to your local D1 instance. Usual...

(QB_NEW_EN_OTHER_ERROR_IDS_30)


[grammar] ~161-~161: Use colons correctly
Context: ...-a-d1-database). - CLOUDFLARE_D1_TOKEN: This API token is used by Prisma ORM to comm...

(QB_NEW_EN_OTHER_ERROR_IDS_30)


[grammar] ~163-~163: Punctuation usually goes inside quotation marks
Context: ...m/profile/api-tokens 2. Click "Create Token" 3. On the Custom token section cli...

(QB_NEW_EN_OTHER_ERROR_IDS_20)


[grammar] ~164-~164: Use prepositions correctly
Context: ...i-tokens 2. Click "Create Token" 3. On the Custom token section click on "G...

(QB_NEW_EN_OTHER_ERROR_IDS_7)


[grammar] ~164-~164: Use a comma after introductory words or phrases
Context: ...reate Token" 3. On the Custom token section click on "Get started". 4. Fill out ...

(QB_NEW_EN_OTHER_ERROR_IDS_19)


[grammar] ~164-~164: Use correct spacing
Context: ... 3. On the Custom token section click on "Get started". 4. Fill out the template: M...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~164-~164: There might be a mistake here.
Context: ...om token* section click on "Get started". 4. Fill out the template: Make sure y...

(QB_NEW_EN_OTHER)


[grammar] ~165-~165: There might be a mistake here.
Context: ...plate: Make sure you use a recognizable name 5. For the Permissions, add the `Account / ...

(QB_NEW_EN_OTHER)


[grammar] ~167-~167: There might be a mistake here.
Context: ...tinue to summary" and then "Create Token". 7. Click on "Copy" and store the toke...

(QB_NEW_EN_OTHER)


[grammar] ~168-~168: Use correct spacing
Context: ...on "Copy" and store the token in a safe place. You can now store these secrets to be us...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~180-~180: Use correct spacing
Context: ..."F8Cg..." ``` ### 5.2 Configure Prisma Config Ensure that you have a `prisma.config.ts...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~182-~182: Use correct spacing
Context: ...erence/prisma-config-reference#adapter) defined. ts import type { PrismaConfig } from 'prisma'; import { PrismaD1 } from '@prisma/adapter-d1'; // import your .env file import 'dotenv/config'; export default { experimental: { adapter: true, }, schema: 'prisma/schema.prisma', 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!, }); }, } satisfies PrismaConfig; :::note As of [Prisma ORM v6.11.0](http...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~208-~208: There might be a problem here.
Context: ...has been renamed from PrismaD1HTTP to PrismaD1. ::: This will allow prisma migrate to int...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~270-~270: There might be a problem here.
Context: ...onse(result); }, }; ``` ## 6. Run the Worker locally First copy the contents of your .env file t...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~272-~272: Use correct spacing
Context: ...nment variables when running the Worker locally. bash cp .env .dev.vars Next, you need to run the Worker locally...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~278-~278: There might be a mistake here.
Context: ...ommand available in your terminal, then run: With the database query in place and Pr...

(QB_NEW_EN_OTHER)


[grammar] ~302-~302: There might be a problem here.
Context: ...ded for the Worker to connect to the D1 database. ::: Your deployed Worker is accessible via ...

(QB_NEW_EN_MERGED_MATCH)

⏰ 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). (4)
  • GitHub Check: Check internal links
  • GitHub Check: runner / linkspector
  • GitHub Check: Lost Pixel
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
content/800-guides/070-cloudflare-d1.mdx (1)

185-186: Verify availability of PrismaConfig type export

import type { PrismaConfig } from 'prisma'; assumes the prisma package exposes that type. At the time of writing, PrismaConfig is only available from @prisma/internals. Double-check the import path; otherwise, TypeScript consumers will hit a module-not-found error.

Copy link

@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 (1)
content/800-guides/070-cloudflare-d1.mdx (1)

251-252: Import path still incorrect – generated client resides at ./generated/prisma

The Prisma generator outputs index.(ts|js) in src/generated/prisma, not src/generated/prisma/client.
Keeping /client will break the runtime import.

-import { PrismaClient } from './generated/prisma/client';
+import { PrismaClient } from './generated/prisma';
🧹 Nitpick comments (2)
content/800-guides/070-cloudflare-d1.mdx (2)

206-214: Section numbering drifts – heading should be 5.3, not 4.3

The guide is inside “## 5. Set up database migrations”.
Continuing the 5.x sequence preserves anchor consistency and prevents broken links.

-### 4.3 Run your first migration
+### 5.3 Run your first migration

290-296: Minor typo: duplicated word “the”

-To deploy the Worker, run the the following command:
+To deploy the Worker, run the following command:
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51c2ab6 and e9c03e6.

📒 Files selected for processing (1)
  • content/800-guides/070-cloudflare-d1.mdx (5 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/070-cloudflare-d1.mdx

[style] ~151-~151: Consider a more concise word here.
Context: ...te We recommend using prisma migrate in order to keep your data in D1 migrated. However,...

(IN_ORDER_TO_PREMIUM)


[style] ~156-~156: Consider a more concise word here.
Context: ...# 5.1 Add needed environment variables In order to use the Prisma D1 adapter, you'll need ...

(IN_ORDER_TO_PREMIUM)

⏰ 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: Cloudflare Pages

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