apps/docs/content/docs.v6/postgres/integrations/vercel.mdx
The Vercel Marketplace integration for Prisma Postgres connects your Vercel projects with Prisma Postgres instances. Once connected, the integration will automatically set the following environment variable on your deployed Vercel app:
DATABASE_URL: The direct TCP connection URL 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, ...).
The easiest way to use Prisma Postgres on the Vercel Marketplace is via one of the templates:
To install the extension, click Install at the top of the Prisma Postgres integration page.
The integration will now show up on your list of integrations, e.g. https://vercel.com/<VERCEL-TEAM>/~/integrations.
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.
Finally, give the database a Name and click Create.
The database is now ready and can be connected to your Vercel projects.
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.
To view and edit the data in your Prisma Postgres instance, you can use the local version of Prisma Studio.
In the local version of your project where you have your DATABASE_URL set, run the following command to open Prisma Studio:
npx prisma studio
Ensure that the data source in your prisma.config.ts file is configured to use the DATABASE_URL environment variable:
import "dotenv/config";
import { defineConfig, env } from "@prisma/config";
export default defineConfig({
datasource: {
url: env("DATABASE_URL"),
},
schema: "./prisma/schema.prisma",
});
postinstall script in package.jsonTo 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:
{
// ...
"scripts": {
// ...
"postinstall": "prisma generate" // [!code ++]
}
//
}