-
Notifications
You must be signed in to change notification settings - Fork 843
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe 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
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
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
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Dangerous URL checkNo absolute URLs to prisma.io/docs found. |
Redirect checkThis PR probably requires the following redirects to be added to static/_redirects:
|
Deploying docs with
|
Latest commit: |
fa6dbba
|
Status: | ✅ Deploy successful! |
Preview URL: | https://c3b6d786.docs-51g.pages.dev |
Branch Preview URL: | https://dc-4696.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: 4
🔭 Outside diff range comments (1)
content/800-guides/070-cloudflare-d1.mdx (1)
214-218
: Section numbering is offInside “## 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
📒 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 goodSwitching from
####
to###
for theadapter
section keeps the heading hierarchy consistent with the surrounding options. No further action needed.
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: 2
🔭 Outside diff range comments (1)
content/800-guides/070-cloudflare-d1.mdx (1)
214-214
: Heading number is out of sequence (4.3
→5.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-existentclient
sub-folderWith
output = "../src/generated/prisma"
the generated entry file issrc/generated/prisma/index.(ts|js)
.
Fromsrc/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
📒 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
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
🔭 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 configuredoutput
directoryThe client is generated into
src/generated/prisma/index.(ts|js)
(viaoutput = "../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
📒 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 ofPrismaConfig
type export
import type { PrismaConfig } from 'prisma';
assumes theprisma
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.
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: 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)
insrc/generated/prisma
, notsrc/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 be5.3
, not4.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
📒 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
Summary by CodeRabbit