- select a Data Proxy region for the project (make sure that it is close to your database)
- create a Data Proxy connection string
You can then configure the connection string in your development or deployment environment and generate Prisma Client for the Data Proxy.
Enable the Data Proxy for a project
When you create a project in the platform, the Data Proxy is automatically enabled for your project.
- Create a project to add your application in the platform. During the process, select a geographic location for the Data Proxy that is closest to the location of your database.
- If your database is behind a firewall, enable static IP addresses for your project and add the IP addresses for the selected Data Proxy region to the allowlist of your database.
- US East 1 (West Virginia)
- EU Central 1 (Frankfurt, Germany)
- US East 1 (West Virginia)
Open your project in the Prisma Data Platform. You can do so from the Projects page.
Get a Data Proxy connection string for the selected environment.
With the project open and an environment selected, click the Data Proxy tab.
Click Create a connection string.NoteYou can generate as many Data Proxy connection strings as you need. You can later revoke any of the connection strings that you no longer need.
Enter a name for the new Data Proxy connection string and click Create.
prisma://connection string.ImportantSave the
prisma://connection string securely. After you navigate to another page, you cannot retrieve the connection string again from the Data Proxy. You can only generate a new connection string, if necessary.
Generate Prisma Client for the Data Proxy
After you create your project in the platform and enable the Data Proxy, you can generate Prisma Client for the Data Proxy and use it with the
prisma:// connection string you obtained.
You can generate and use Prisma Client for the Data Proxy in the following environments:
- In your local development environment, to test the process.
- In your deployment platform. You must replace the direct database connection string with the Data Proxy connection string and make sure that Prisma Client is auto-generated with the
--data-proxyflag as described below.
- Enable Data Proxy for your project.
- Copy the Data Proxy connection string. Do so for the project environment for which you want to generate Prisma Client.
In your local development environment, replace the direct database connection string with the Data Proxy
prisma://connection string..env- DATABASE_URL="postgresql://****:****@****"+ DATABASE_URL="prisma://****:****@****"
For security reasons, we strongly recommend that you always use environment variables for your database connection strings and Data Proxy strings. Do not hard-code them into your
For more information, see Using
Make sure to use version 3.15.2 or later.$npm install prisma@latest --save-dev$npm install @prisma/client@latest --save
Generate Prisma Client with the
--data-proxyoption.$npx prisma generate --data-proxy
The generated Prisma Client is a lightweight version because it excludes the local query engine files. The Data Proxy handles the query engine logic.
Instantiate Prisma Client in your application code.
To use the Data Proxy with Node.js, instantiate
To use the Data Proxy in Edge runtimes, such as Cloudflare Workers or Vercel Edge Functions, instantiate
@prisma/client/edge.NoteYou can use
@prisma/client/edgeonly with the Data Proxy. In such cases, make sure to use the
--data-proxyflag or the
Your application now uses the Data Proxy.
The generated Prisma Client has a reduced bundle size because the entire query engine logic is now hosted with the Data Proxy.
Manage the number of database connections
You can adjust the maximum number of database connections of each Data Proxy connection pool.
To do so, in the Prisma Data Platform add the
connection_limit parameter to the database connection string of the environment in your project.