Skip to content
Open
Changes from 2 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
59 changes: 30 additions & 29 deletions apps/docs/content/docs/guides/postgres/vercel.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
---
title: Vercel
description: Learn how to create Prisma Postgres databases via the Vercel Marketplace and deploy your applications with it
description: Learn how to create Prisma Postgres databases via the Vercel Marketplace and deploy your Next.js, Nuxt, and SvelteKit applications.
url: /guides/postgres/vercel
metaTitle: Prisma Postgres via Vercel Marketplace
metaDescription: Learn how to create Prisma Postgres databases via the Vercel Marketplace and deploy your applications with it.
metaTitle: Prisma Postgres on Vercel Marketplace integration and Next.js setup
metaDescription: Create Prisma Postgres databases via the Vercel Marketplace and deploy Next.js apps with built-in connection pooling. No pgBouncer setup required.
---

The [Vercel Marketplace integration for Prisma Postgres](https://www.vercel.com/marketplace/prisma) connects your Vercel projects with Prisma Postgres instances. Once connected, the integration will automatically set the following environment variable on your deployed Vercel app:
The [Vercel Marketplace integration for Prisma Postgres](https://www.vercel.com/marketplace/prisma) connects your Vercel projects with Prisma Postgres instances. Once connected, the integration automatically sets the following environment variable on your deployed Vercel app:

- `DATABASE_URL`: A Prisma Postgres [connection string](/postgres/database/connecting-to-your-database) starting with `postgres://...`

These enable you to connect to the Prisma Postgres instances via any ORM or database library you want to use (Prisma ORM, Drizzle, Kysely, ...).
This works with any ORM or database library — Prisma ORM, Drizzle, Kysely, and others.

## Why Prisma Postgres works well on Vercel

Vercel scales serverless functions automatically. Each new function instance opens a database connection — and with a traditional Postgres setup, that's how you hit connection limits under load. Prisma Postgres includes connection pooling by default, so you don't need to configure pgBouncer or maintain a separate pooler. The `DATABASE_URL` the Marketplace sets works in local dev, preview deployments, and production.

## Features

Expand All @@ -22,7 +26,7 @@ These enable you to connect to the Prisma Postgres instances via any ORM or data

## Templates

The easiest way to use Prisma Postgres on the Vercel Marketplace is via one of the templates:
The easiest way to get started is via one of the Marketplace templates:

- [Prisma ORM + NextAuth Starter](https://vercel.com/templates/next.js/prisma-postgres)
- [Postgres + Kysely Next.js Starter](https://vercel.com/templates/next.js/postgres-kysely)
Expand All @@ -39,39 +43,33 @@ The integration will now show up on your list of integrations, e.g. `https://ver

### Create a new database

Once installed, you can navigate to the **Storage** tab and click **Create Database**.

Select **Prisma Postgres** and click **Continue**. Then select the **Region** for the database and a **Pricing Plan**, and click **Continue** again.
Once installed, navigate to the **Storage** tab and click **Create Database**.

Finally, give the database a **Name** and click **Create**.
Select **Prisma Postgres** and click **Continue**. Select a **Region** and **Pricing Plan**, then click **Continue** again.

The database is now ready and can be connected to your Vercel projects.
Give the database a **Name** and click **Create**. The database is ready to connect to your Vercel projects.

### Connect database to Vercel project
### Connect database to a Vercel project

In your Vercel project, you can now click the **Storage** tab, select the database you just created and then click **Connect**. This will automatically set the `DATABASE_URL` environment variable in that project and enable your application to access your newly created Prisma Postgres instance.
In your Vercel project, click the **Storage** tab, select the database you just created, and click **Connect**. This sets `DATABASE_URL` automatically in that project.

### Viewing and editing data in Prisma Studio
### View and edit data in Prisma Studio

To view and edit the data in your Prisma Postgres instance, you can use the local version of [Prisma Studio](/studio).

In the local version of your project where you have your `DATABASE_URL` set, run the following command to open Prisma Studio:
To view and edit data in your Prisma Postgres instance, run Prisma Studio locally where your `DATABASE_URL` is set:

```npm
npx prisma studio
```

## Billing and pricing

Prisma Postgres uses [usage-based pricing](https://www.prisma.io/pricing) based on operations and storage. The same plans and rates apply when you create a database via the Vercel Marketplace, and your Prisma Postgres usage is billed through your Vercel account.
## Using with Next.js

To change your plan, see [How do I upgrade my plan if I am using Prisma Postgres via Vercel?](/postgres/faq#how-do-i-upgrade-my-plan-if-i-am-using-prisma-postgres-via-vercel) in the Prisma Postgres FAQ.
If you're building a Next.js app and want a step-by-step walkthrough — schema, migrations, querying from Server Components, and deploying — see the [Next.js guide](/guides/frameworks/nextjs).

## Additional considerations when using with Prisma ORM
The key things to set up on the Vercel side:

### Ensure your project uses the correct environment variable

Ensure that the data source in your `prisma.config.ts` file is configured to use the `DATABASE_URL` environment variable:
Make sure your `prisma.config.ts` reads from `DATABASE_URL`:

```ts
import "dotenv/config";
Expand All @@ -84,21 +82,24 @@ export default defineConfig({
});
```

### Generate Prisma Client in a `postinstall` script in `package.json`
### Generate Prisma Client on every deploy

To ensure the generated Prisma Client library is available on your deployed Vercel project, you should add a `postinstall` script to the `scripts` section of your `package.json` file:
Add a `postinstall` script so Prisma Client is generated after Vercel installs dependencies:

```js title="package.json"
```json title="package.json"
{
// ...
"scripts": {
// ...
"postinstall": "prisma generate" // [!code ++]
}
//
}
```

## Billing and pricing

Prisma Postgres uses [usage-based pricing](https://www.prisma.io/pricing) based on operations and storage. The same plans and rates apply when you create a database via the Vercel Marketplace, and your usage is billed through your Vercel account.

To change your plan, see [How do I upgrade my plan if I am using Prisma Postgres via Vercel?](/postgres/faq#how-do-i-upgrade-my-plan-if-i-am-using-prisma-postgres-via-vercel) in the Prisma Postgres FAQ.

## Security

### Rotating your Prisma integration secrets in Vercel
Expand Down
Loading