Configuring Prisma 7 with Accelerate URLs
Prisma 7 with Accelerate: the new prisma.config.ts, constructor arguments, accelerateURL protocols, tsconfig fixes and a dual DATABASE_URL for PostgreSQL.
This article is published in English.
Sources: How I Configured Prisma 7 (New Changes, Issues, and How I Solved Them)
Prisma 7 (released 19 Nov 2025) changes configuration enough that many Prisma 6 tutorials no longer apply. The notes below come from reading the docs, inspecting generated declaration files, and working through the errors that show up on a first SQL/Postgres setup—especially for someone coming from MongoDB and Mongoose.
The upgrade path is especially sharp for greenfield learners: the first successful PrismaClient construction in older material is often wrong on day one of v7. Treat constructor arguments and config files as part of the core mental model, not optional advanced topics.
1. First big change: prisma.config.ts
After install, Prisma generates a new root file:
prisma.config.ts
Earlier versions kept DATABASE_URL inside schema.prisma. That connection configuration now lives in prisma.config.ts.
Generated shape:
// This file was generated by Prisma and assumes you have installed the following:
// npm install --save-dev prisma dotenv
import "dotenv/config";
import { defineConfig, env } from "prisma/config";
export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
},
datasource: {
url: env("DATABASE_URL"),
},
});
What changed?
env("DATABASE_URL")is no longer the schema’s job.- Environment-related config moves into the new file.
schema.prismastays focused on models.
2. Fixing tsconfig.json root directory issue
If tsconfig.json contains:
"rootDir": "./src"
TypeScript rejects prisma.config.ts sitting outside src. Widen the root:
"rootDir": "./"
3. Migrating and generating the client
After models exist:
npx prisma migrate dev
npx prisma generate
The schema’s generator block points the client into source:
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
Generation can look fine until PrismaClient construction.
4. The most confusing error: “Expected 1 argument, got 0”
This zero-arg construction:
const prisma = new PrismaClient();
Import PrismaClient from the generated client module—not a sibling class file. Even then, Prisma 7 may reject zero arguments:
Expected 1 argument, but got 0.
Older tutorials still show a no-arg constructor. Inspecting generated client / class files shows the constructor now expects configuration, including:
accelerateURL
5. Introducing accelerateURL (new in Prisma 7)
Prisma 7 integrates tightly with Prisma Accelerate—global query caching plus connection pooling. Accelerate aims to:
- cache queries globally
- reduce latency
- pool connections for serverless
In that mode, PrismaClient requires an accelerateURL.
6. Prisma now provides its own cloud database
The Prisma dashboard can:
- create a database
- mint an Accelerate API key
- supply an
accelerateURLfor the client
A practical catch: ordinary Neon-style URLs that begin with:
" postgresql:// "
do not satisfy Accelerate’s expected protocols:
" prisma:// " or " prisma+postgres:// "
Mismatch produces errors centered on:
InvalidDatasourceError: Error validating `accelerateUrl`: the URL must
start with the protocol `prisma://` or `prisma+postgres://`
7. Final working PrismaClient setup (Prisma 7)
A working pattern:
import { withAccelerate } from "@prisma/extension-accelerate";
import { PrismaClient } from "../src/generated/prisma/client.js";
import { DATABASE_URL } from "../config/index.js";
export const prisma = new PrismaClient({
accelerateUrl: DATABASE_URL as string
}).$extends(withAccelerate());
What is $extends?
$extends() attaches capabilities such as Accelerate to the client.
8. Important note: two environment variables needed
Prisma 7 setups in this mode typically need:
DATABASE_URL → Accelerate URL
DIRECT_DATABASE_URL → direct PostgreSQL connection string
prisma.config.ts should use the direct URL for migrations:
export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
},
datasource: {
url: env("DIRECT_DATABASE_URL"),
},
});
Then migrate and generate again:
npx prisma migrate dev
npx prisma generate
Accelerate-oriented setups change operational habits as well. Migrations and introspection still need a direct database URL, while application traffic may flow through the Accelerate endpoint. Mixing those two strings—putting a direct Postgres URL where an Accelerate URL is required, or the reverse—produces errors that look unrelated to the line of application code under edit. Keep the two values named clearly in .env examples and fail fast at boot if either protocol prefix is wrong.
For teams migrating from Prisma 6, expect a checklist rather than a drop-in upgrade: add prisma.config.ts, widen rootDir if needed, stop constructing PrismaClient with zero arguments when Accelerate is in play, wire $extends(withAccelerate()), and split environment variables. Once that checklist is muscle memory, day-to-day modeling feels familiar again.
Conclusion
Prisma 7’s breaking surfaces—prisma.config.ts, required client arguments, accelerateURL, and $extends—are poorly covered by Prisma 6 material. Once Accelerate’s URL rules and the dual-env split are clear, client setup becomes predictable for first-time SQL users and for upgrades from v6 alike.