Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6005ce4
Update all accelerate example (#8373)
AmanVarshney01 Nov 14, 2025
49cbe3e
Update misc examples (#8372)
AmanVarshney01 Nov 14, 2025
c2f05fe
Update misc examples with prisma.config.ts and adapter (#8362)
AmanVarshney01 Nov 14, 2025
c233671
Update HTTP web server examples (#8354)
AmanVarshney01 Nov 14, 2025
94518fd
update all nextjs examples in `generator-prisma-client/` (#8342)
AmanVarshney01 Nov 14, 2025
f7350b0
Update fullstack examples with prisma config and pg adapter (#8344)
AmanVarshney01 Nov 14, 2025
318afa5
Update Nuxt & React Router examples (#8368)
AmanVarshney01 Nov 14, 2025
7780b65
Update optimize examples (#8375)
AmanVarshney01 Nov 14, 2025
fcdff40
Update Bun & Deno examples (#8343)
AmanVarshney01 Nov 14, 2025
161ae5c
Update GraphQL examples with prisma.config.ts and pg adapter (#8345)
AmanVarshney01 Nov 14, 2025
b34e953
update cockroachdb, postgresql-supabase, prisma-postgres examples (#8…
AmanVarshney01 Nov 14, 2025
00456b5
remove engine classic and url from schema.prisma
AmanVarshney01 Nov 14, 2025
3f8a0fa
update deployment
AmanVarshney01 Nov 16, 2025
e786ba5
update readme
AmanVarshney01 Nov 16, 2025
9994989
delete all lock files and update prisma version to 7.0.0
AmanVarshney01 Nov 16, 2025
11ce385
update remaining examples
AmanVarshney01 Nov 18, 2025
6412034
update d1 example
AmanVarshney01 Nov 18, 2025
1a35a6f
fix
AmanVarshney01 Nov 18, 2025
0ceb3f4
update turso example
AmanVarshney01 Nov 18, 2025
61f5d0b
fix
AmanVarshney01 Nov 18, 2025
68fa589
update nuxt example
AmanVarshney01 Nov 18, 2025
2184b2f
fix nextjs example
AmanVarshney01 Nov 18, 2025
7488680
update all deps to 7.0.0
AmanVarshney01 Nov 19, 2025
7493411
Merge branch 'latest' into prisma-7
AmanVarshney01 Nov 19, 2025
0beace3
fix
AmanVarshney01 Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ tmp-resolvers
package-lock.json
flow-typed
yarn.lock
bun.lock
pnpm-lock.yaml
orm/**/migrations/
misc/**/migrations/
databases/**/migrations/
Expand Down
13 changes: 5 additions & 8 deletions accelerate/accelerate-hacker-news/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,16 @@ Create a `.env` in the root of the project directory:
cp .env.example .env
```

Now, open the `.env` file and set the `DATABASE_URL` and `DIRECT_URL` environment variables with the values of your connection string and your Accelerate connection string:
Now, open the `.env` file and set the `DATABASE_URL` environment variable with the value of your Accelerate connection string:

```bash
# .env

# Accelerate connection string (used for queries by Prisma Client)
DATABASE_URL="__YOUR_ACCELERATE_CONNECTION_STRING__"

# Database connection string (used for migrations by Prisma Migrate)
DIRECT_URL="__YOUR_DATABASE_CONNECTION_STRING__"
```

Note that `__YOUR_DATABASE_CONNECTION_STRING__` and `__YOUR_ACCELERATE_CONNECTION_STRING__` are placeholder values that you need to replace with the values of your database and Accelerate connection strings. Notice that the Accelerate connection string has the following structure: `prisma://accelerate.prisma-data.net/?api_key=__YOUR_ACCELERATE_API_KEY__`.
Note that `__YOUR_ACCELERATE_CONNECTION_STRING__` is a placeholder value that you need to replace with the value of your Accelerate connection string. Notice that the Accelerate connection string has the following structure: `prisma://accelerate.prisma-data.net/?api_key=__YOUR_ACCELERATE_API_KEY__`.

### 3. Run a migration to create the `Post` table

Expand All @@ -55,12 +52,12 @@ The Prisma schema file contains a single `Post` model. You can map this model to
npx prisma migrate dev --name init
```

### 4. Generate Prisma Client for Accelerate
### 4. Generate Prisma Client

When using Accelerate, Prisma Client doesn't need a query engine. That's why you should generate it as follows:
Generate Prisma Client with the following command:

```
npx prisma generate --no-engine
npx prisma generate
```

### 5. Start the app
Expand Down
7 changes: 5 additions & 2 deletions accelerate/accelerate-hacker-news/lib/db.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { PrismaClient } from '@prisma/client'
import "dotenv/config"
import { PrismaClient } from '../prisma/generated/client'
import { withAccelerate } from '@prisma/extension-accelerate'

const prismaClientSingleton = () => {
return new PrismaClient().$extends(withAccelerate())
return new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
}

declare const globalThis: {
Expand Down
8 changes: 4 additions & 4 deletions accelerate/accelerate-hacker-news/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
"lint": "next lint"
},
"dependencies": {
"@prisma/client": "6.9.0",
"@prisma/extension-accelerate": "2.0.2",
"@prisma/client": "7.0.0",
"@prisma/extension-accelerate": "^2.0.2",
"next": "15.3.5",
"react": "19.1.0",
"react-dom": "19.1.0"
},
"devDependencies": {
"prisma": "6.9.0",
"@faker-js/faker": "9.9.0",
"@types/node": "22.19.0",
"@types/react": "19.1.8",
"@types/react-dom": "19.1.6",
"eslint": "8.57.1",
"eslint-config-next": "15.3.5",
"postcss": "8.5.6",
"prisma": "7.0.0",
"tailwindcss": "3.4.17",
"tsx": "4.20.6",
"typescript": "5.8.2"
},
"prisma": {
"seed": "tsx ./prisma/seed.ts"
}
}
}
13 changes: 13 additions & 0 deletions accelerate/accelerate-hacker-news/prisma.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
seed: "tsx ./prisma/seed.ts",
},
datasource: {
url: env("DATABASE_URL"),
},
});
11 changes: 5 additions & 6 deletions accelerate/accelerate-hacker-news/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
generator client {
provider = "prisma-client-js"
provider = "prisma-client"
output = "./generated"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}

model Post {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
title String
url String
content String
vote Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
8 changes: 6 additions & 2 deletions accelerate/accelerate-hacker-news/prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { PrismaClient } from '@prisma/client'
import "dotenv/config"
import { PrismaClient } from './generated/client'
import { faker } from '@faker-js/faker'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient()
const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())

const main = async () => {
await prisma.post.deleteMany()
Expand Down
24 changes: 19 additions & 5 deletions accelerate/accelerate-hacker-news/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -18,9 +22,19 @@
}
],
"paths": {
"@/*": ["./*"]
}
"@/*": [
"./*"
]
},
"target": "ES2017"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
13 changes: 5 additions & 8 deletions accelerate/astro-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,17 @@ Copy the `.env.example` env file in the root of the project directory:
cp .env.example .env
```

Now, open the `.env` file and set the `DIRECT_URL` and `DATABASE_URL` environment variables with the values of your connection string and your Accelerate connection string respectively:
Now, open the `.env` file and set the `DATABASE_URL` environment variable with the value of your Accelerate connection string:

```bash
# .env

# Accelerate connection string (used for queries by Prisma Client)
DATABASE_URL="__YOUR_ACCELERATE_CONNECTION_STRING__"

# Database connection string (used for migrations by Prisma Migrate)
DIRECT_URL="__YOUR_DATABASE_CONNECTION_STRING__"

```

Note that `__YOUR_DATABASE_CONNECTION_STRING__` and `__YOUR_ACCELERATE_CONNECTION_STRING__` are placeholder values that you need to replace with the values of your database and Accelerate connection strings. Notice that the Accelerate connection string has the following structure: `prisma://accelerate.prisma-data.net/?api_key=__YOUR_ACCELERATE_API_KEY__`.
Note that `__YOUR_ACCELERATE_CONNECTION_STRING__` is a placeholder value that you need to replace with the value of your Accelerate connection string. Notice that the Accelerate connection string has the following structure: `prisma://accelerate.prisma-data.net/?api_key=__YOUR_ACCELERATE_API_KEY__`.

### 3. Run a migration to create the `Quote` table and seed the database

Expand All @@ -58,12 +55,12 @@ You now have an empty `Quote` table in your database. Next, run the [seed script
npx prisma db seed
```

### 4. Generate Prisma Client for Accelerate
### 4. Generate Prisma Client

When using Accelerate, Prisma Client doesn't need a query engine. That's why you should generate it as follows:
Generate Prisma Client with the following command:

```
npx prisma generate --no-engine
npx prisma generate
```

### 5. Start the app
Expand Down
14 changes: 5 additions & 9 deletions accelerate/astro-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,18 @@
"@astrojs/check": "0.9.5",
"@astrojs/react": "4.3.0",
"@astrojs/tailwind": "6.0.2",
"@prisma/client": "7.0.0",
"@prisma/extension-accelerate": "^2.0.2",
"@types/react": "19.1.8",
"@types/react-dom": "19.1.6",
"astro": "5.10.2",
"prisma": "6.9.0",
"react": "19.1.0",
"react-dom": "19.1.0",
"tailwindcss": "3.4.17",
"typescript": "5.8.2",
"@prisma/client": "6.9.0",
"@prisma/extension-accelerate": "2.0.2"
"typescript": "5.8.2"
},
"devDependencies": {
"prisma": "6.9.0",
"prisma": "7.0.0",
"tsx": "4.20.6"
},
"prisma": {
"seed": "tsx prisma/seed.ts"
}
}
}
13 changes: 13 additions & 0 deletions accelerate/astro-starter/prisma.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
seed: "tsx ./prisma/seed.ts",
},
datasource: {
url: env("DATABASE_URL"),
},
});
7 changes: 3 additions & 4 deletions accelerate/astro-starter/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
provider = "prisma-client"
output = "./generated"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
provider = "postgresql"
}

model Quote {
Expand Down
7 changes: 5 additions & 2 deletions accelerate/astro-starter/prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/client'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient()
const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())

const main = async () => {
console.log('Seeding database 🌱')
Expand Down
6 changes: 4 additions & 2 deletions accelerate/astro-starter/src/pages/db.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from '../../prisma/generated/client'
import { withAccelerate } from '@prisma/extension-accelerate'

// Learn more about instantiating PrismaClient in Next.js here: https://www.prisma.io/docs/data-platform/accelerate/getting-started

const prismaClientSingleton = () => {
return new PrismaClient().$extends(withAccelerate())
return new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
}

declare const globalThis: {
Expand Down
13 changes: 5 additions & 8 deletions accelerate/nextjs-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,18 @@ Create a `.env` in the root of the project directory:
touch .env
```

Now, open the `.env` file and set the `DATABASE_URL` and `DIRECT_URL` environment variables with the values of your connection string and your Accelerate connection string:
Now, open the `.env` file and set the `DATABASE_URL` environment variable with the value of your Accelerate connection string:

```bash
# .env

# Accelerate connection string (used for queries by Prisma Client)
DATABASE_URL="__YOUR_ACCELERATE_CONNECTION_STRING__"

# Database connection string (used for migrations by Prisma Migrate)
DIRECT_URL="__YOUR_DATABASE_CONNECTION_STRING__"

NEXT_PUBLIC_URL="http://localhost:3000"
```

Note that `__YOUR_DATABASE_CONNECTION_STRING__` and `__YOUR_ACCELERATE_CONNECTION_STRING__` are placeholder values that you need to replace with the values of your database and Accelerate connection strings. Notice that the Accelerate connection string has the following structure: `prisma://accelerate.prisma-data.net/?api_key=__YOUR_ACCELERATE_API_KEY__`.
Note that `__YOUR_ACCELERATE_CONNECTION_STRING__` is a placeholder value that you need to replace with the value of your Accelerate connection string. Notice that the Accelerate connection string has the following structure: `prisma://accelerate.prisma-data.net/?api_key=__YOUR_ACCELERATE_API_KEY__`.

### 3. Run a migration to create the `Quotes` table and seed the database

Expand All @@ -59,12 +56,12 @@ You now have an empty `Quotes` table in your database. Next, run the [seed scrip
npx prisma db seed
```

### 4. Generate Prisma Client for Accelerate
### 4. Generate Prisma Client

When using Accelerate, Prisma Client doesn't need a query engine. That's why you should generate it as follows:
Generate Prisma Client with the following command:

```
npx prisma generate --no-engine
npx prisma generate
```

### 5. Start the app
Expand Down
3 changes: 1 addition & 2 deletions accelerate/nextjs-starter/components/Quote/Quote.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { QuoteWrapper } from "./QuoteWrapper";
import { QuoteCacheType, QuoteResult } from "@/lib/types";
import { findIATA } from "openflights-cached";

export const Quote: React.FC<{
title: string;
Expand Down Expand Up @@ -35,7 +34,7 @@ export const Quote: React.FC<{
Cache Node Region ⸺
<span className="font-bold">
{" "}
{findIATA(region)?.city ?? region}
{region}
</span>
</p>
<br />
Expand Down
8 changes: 5 additions & 3 deletions accelerate/nextjs-starter/lib/db.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { PrismaClient } from "@prisma/client/edge";
import { withAccelerate } from "@prisma/extension-accelerate";
import { PrismaClient } from "../prisma/generated/client";
import { withAccelerate } from '@prisma/extension-accelerate'

// Learn more about instantiating PrismaClient in Next.js here: https://www.prisma.io/docs/data-platform/accelerate/getting-started

const prismaClientSingleton = () => {
return new PrismaClient().$extends(withAccelerate());
return new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate())
};

declare const globalThis: {
Expand Down
Loading
Loading