Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions generator-prisma-client/nextjs-starter-turbopack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ This project showcases how to use the Prisma ORM with Prisma Postgres in an ESM

## Prerequisites

To successfully run the project, you will need the following:

- Two **Prisma Postgres** connection strings:
- Your **Prisma Postgres + Accelerate connection string** (containing your **Prisma API key**) which you can get by enabling Postgres in a project in your [Prisma Data Platform](https://pris.ly/pdp) account. You will use this connection string to run Prisma migrations.
- Your **Prisma Postgres direct TCP connection string** which you will use with Prisma Client.
Learn more in the [docs](https://www.prisma.io/docs/postgres/database/direct-connections).
To successfully run the project, you will need a **Prisma Postgres** connection string from your [Prisma Data Platform](https://pris.ly/pdp) project.

## Tech Stack

Expand All @@ -25,10 +20,9 @@ To successfully run the project, you will need the following:

```prisma
generator client {
provider = "prisma-client"
output = "../lib/generated/prisma"
previewFeatures = ["driverAdapters", "queryCompiler"]
runtime = "nodejs"
provider = "prisma-client"
output = "../lib/generated/prisma"
engineType = "client"
}
```

Expand All @@ -52,23 +46,17 @@ Create a `.env` in the root of the project directory:
touch .env
```

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

```bash
# .env

# Prisma Postgres connection string (used for migrations)
DATABASE_URL="__YOUR_PRISMA_POSTGRES_CONNECTION_STRING__"

# Postgres connection string (used for queries by Prisma Client)
DIRECT_URL="__YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__"

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

Note that `__YOUR_PRISMA_POSTGRES_CONNECTION_STRING__` is a placeholder value that you need to replace with the values of your Prisma Postgres + Accelerate connection string. Notice that the Accelerate connection string has the following structure: `prisma+postgres://accelerate.prisma-data.net/?api_key=<api_key_value>`.

Note that `__YOUR_PRISMA_POSTGRES_DIRECT_CONNECTION_STRING__` is a placeholder value that you need to replace with the values of your Prisma Postgres direct TCP connection string. The direct connection string has the following structure: `postgres://<username>:<password>@<host>:<port>/<database>`.
Replace `__YOUR_PRISMA_POSTGRES_CONNECTION_STRING__` with your actual Prisma Postgres connection string.

### 3. Generate Prisma Client

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })

export const metadata: Metadata = {
title: 'Accelerated Quotes',
description: 'Accelerate starter',
title: 'Quotes',
description: 'Starter',
}

export default function RootLayout({
Expand Down
11 changes: 11 additions & 0 deletions generator-prisma-client/nextjs-starter-turbopack/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from "eslint/config";
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export default defineConfig([{
extends: [...nextCoreWebVitals],
}]);
2 changes: 1 addition & 1 deletion generator-prisma-client/nextjs-starter-turbopack/lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export function getDb({ connectionString }: GetDbParams) {
return prisma
}

const prisma = getDb({ connectionString: env.DIRECT_URL })
const prisma = getDb({ connectionString: env.DATABASE_URL })
export default prisma
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { z } from 'zod'

export const env = createEnv({
server: {
DIRECT_URL: z.string().url().startsWith('postgres://'),
DATABASE_URL: z.string().url().startsWith('postgresql://'),
},
runtimeEnv: process.env,
})
30 changes: 18 additions & 12 deletions generator-prisma-client/nextjs-starter-turbopack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,38 @@
"dev": "next dev --turbopack",
"build": "prisma generate && next build --turbopack",
"start": "next start",
"lint": "next lint"
"lint": "eslint ."
},
"dependencies": {
"@prisma/adapter-pg": "6.14.0",
"@prisma/client": "6.14.0",
"@prisma/adapter-pg": "6.18.0",
"@prisma/client": "6.18.0",
"@t3-oss/env-core": "0.13.8",
"next": "15.3.5",
"next": "16.0.1",
"postcss": "8.5.6",
"react": "19.1.0",
"react-dom": "19.1.0",
"react": "19.2.0",
"react-dom": "19.2.0",
"react-hot-toast": "2.5.2",
"tailwindcss": "3.4.17",
"zod": "3.25.76"
},
"devDependencies": {
"@types/node": "22.18.12",
"@types/react": "19.1.8",
"@types/react-dom": "19.1.6",
"@types/react": "19.2.2",
"@types/react-dom": "19.2.2",
"autoprefixer": "10.4.21",
"dotenv": "17.2.1",
"eslint": "8.57.1",
"eslint-config-next": "15.3.5",
"prisma": "6.14.0",
"eslint": "^9",
"eslint-config-next": "16.0.1",
"prisma": "6.18.0",
"tsx": "4.20.6",
"typescript": "5.8.3"
},
"license": "MIT",
"packageManager": "pnpm@8.15.9+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81"
"packageManager": "pnpm@8.15.9+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81",
"pnpm": {
"overrides": {
"@types/react": "19.2.2",
"@types/react-dom": "19.2.2"
}
}
}
Loading