Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Vercel app deployment (/docs/guides/integrations/vercel-deployment)

For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL.

Programmatically deploy full-stack apps to Vercel with a provisioned Prisma Postgres database. Built for AI app builders, agent platforms, and no-code tools.

Location: Guides > Integrations > Vercel app deployment

This guide shows you how to deploy a full-stack application to Vercel with a ready-to-use Prisma Postgres database, entirely through API calls. The flow takes six Vercel API requests: create a project, authorize the Prisma integration, provision a database, connect it to the project, deploy the application code, and generate a claim code that transfers ownership to your user. No dashboard steps are required at any point.

This is the deployment pattern used by AI app builders, agent platforms, no-code tools, and educational platforms that generate applications on behalf of their users. Your platform deploys the app and database programmatically, the user claims it with one click, and billing moves to their Vercel account. Every database provisioned through this flow is a full Prisma Postgres instance: managed PostgreSQL with connection pooling built in, so deployed apps handle serverless traffic without extra pooling infrastructure.

[!NOTE] Other Vercel guides

  • To deploy your own app that uses Prisma ORM, see the Next.js guide for Prisma ORM 8, or Deploy to Vercel for Prisma ORM 7.
  • To add a Prisma Postgres database to an existing Vercel project via the Marketplace integration, see Prisma Postgres on Vercel.
  • To create and manage Prisma Postgres databases programmatically outside of Vercel, see the REST API.

This guide covers platforms deploying apps on behalf of their users with Vercel's deployment API.

Experience the instant deployment flow with our interactive demo. You can deploy and claim real applications to see the complete process in action.

Vercel App Deployment Demo

Available examples:

  • Next.js + Prisma: Basic full-stack application with database integration
  • Next.js + Prisma + Better Auth: Complete application with authentication using Better Auth

Demo features:

  • Deploy applications with one click
  • Generate claim codes for user transfer
  • Experience the complete claiming flow
  • View source code and implementation details

Visit the GitHub repository for the demo.

This guide is designed for developers building:

  • AI-powered development platforms that generate full applications and need instant deployment
  • No-code/low-code tools that want to offer hosting without managing infrastructure
  • Educational platforms where students need to deploy projects quickly
  • CI/CD systems that need programmatic deployment capabilities
  • Rapid prototyping tools that transform ideas into deployed applications

The deployment flow relies on these concepts:

  • Projects: Containers that hold your application code and configuration
  • Deployments: Specific instances of your project deployed to Vercel's edge network
  • Teams: Organizational units that own projects and manage billing
  • Integrations: Third-party services (like Prisma) that connect to your projects
  • Integration configuration: Your team's connection to the Prisma service
  • Authorization: Permission to create resources on behalf of your team
  • Database stores: Individual Prisma Postgres instances
  • Resource connections: Links between databases and Vercel projects

The deployment process uses several key Vercel API endpoints:

  • POST /v10/projects - Create a new Vercel project
  • POST /v1/integrations/billing/authorization - Authorize Prisma integration
  • POST /v1/storage/stores/integration - Create Prisma Postgres database
  • POST /v13/deployments - Deploy application code
  • POST /v9/projects/{id}/transfer-request - Generate claim code for user transfer

[!NOTE] Contact us for elevated partner level access for db creation

By default, every new partner is on our free plan which limited to 5 dbs per account, so if you are trying out this API and need higher db creation limits (which we suspect that most of you will), then please contact us to get partner level access.

Your primary authentication token for Vercel API calls.

Where to get it:

  1. Go to Vercel Account Settings
  2. Click Create Token
  3. Name it (e.g., "Instant Deployment API")
  4. Set scope to your team (not personal account)
  5. Copy the token immediately (you won't see it again)

[!NOTE] You need "Owner" level access to the Vercel team to ensure the ACCESS_TOKEN works for all the API calls.

Bash
ACCESS_TOKEN="vercel_token_here"

[!NOTE] Credit card requirement

Vercel requires a credit card to be attached to your account (even on the Hobby plan) to use the deployment APIs. Make sure to add payment information in your Vercel account settings before proceeding.

Your Vercel team identifier for API requests.

Where to get it:

  1. Go to the Vercel Dashboard
  2. Switch to your Team (not personal account)
  3. Go to Team Settings
  4. Copy the Team ID displayed at the top (format: team_abc123xyz)
Bash
TEAM_ID="team_abc123xyz"

Your team's Prisma integration configuration identifier.

Where to get it:

  1. In Vercel Dashboard, go to your Team
  2. Click Integrations tab
  3. Find Prisma and click Manage (install it first if needed)
  4. In the browser URL, copy the config ID: https://vercel.com/teams/your-team/integrations/icfg_abc123xyz
  5. Copy the icfg_abc123xyz part
Bash
INTEGRATION_CONFIG_ID="icfg_abc123xyz"

The Prisma Product ID is used to identify the Prisma integration in the Vercel API and it's a constant value of: iap_yVdbiKqs5fLkYDAB or prisma-postgres.

Bash
PRISMA_PRODUCT_ID="iap_yVdbiKqs5fLkYDAB"

The region where your Prisma Postgres database will be deployed. Choose a region close to your users to reduce latency.

Available regions:

  • iad1 - US East (Virginia)
  • fra1 - Europe (Frankfurt)
  • sfo1 - US West (San Francisco)
  • sin1 - Asia Pacific (Singapore)
  • hnd1 - Asia Pacific (Tokyo)
  • cdg1 - Europe (Paris)
Bash
PRISMA_POSTGRES_REGION="iad1"

See the complete list of supported Prisma Postgres regions and their corresponding Vercel region codes.

[!NOTE] Updated database limits

Database limits have been increased across all plans. The Free plan now includes 50 databases, and paid plans (Starter, Pro, Business) each include 1,000 databases. See the pricing page for the full breakdown.

The billing plan determines database limits and features. Available plans:

  • free - Limited to 50 databases, suitable for development
  • pro - Higher limits
  • business - Enterprise features with priority support
  • enterprise - Custom limits and dedicated support
  • partnerEntry - Partner-level access with high database limits
Bash
PRISMA_BILLING_PLAN="partnerEntry"

[!NOTE] Partner access recommended

For production deployments requiring multiple databases, we recommend the partnerEntry plan which provides higher database creation limits. Apply for partner access to get these limits.

The code snippet below shows the complete deployment flow:

TypeScript
const CONFIG = {
  ACCESS_TOKEN: process.env.ACCESS_TOKEN,
  TEAM_ID: process.env.TEAM_ID,
  INTEGRATION_CONFIG_ID: process.env.INTEGRATION_CONFIG_ID,
  PRISMA_PRODUCT_ID: process.env.PRISMA_PRODUCT_ID || "iap_yVdbiKqs5fLkYDAB", // or can be `prisma-postgres`
  PRISMA_POSTGRES_REGION: process.env.PRISMA_POSTGRES_REGION || "iad1",
  PRISMA_BILLING_PLAN: process.env.PRISMA_BILLING_PLAN || "partnerEntry",
  VERCEL_API_URL: "https://api.vercel.com",
};

async function deployApp() {
  console.log("🚀 Starting instant deployment...");

  // 1. Create project
  const project = await createProject();

  // 2. Authorize Prisma integration
  const auth = await createPrismaAuthorization();

  // 3. Create database
  const database = await createPrismaDatabase(project.name, auth.id, auth.configId);

  // 4. Connect database to project
  await connectDatabaseToProject(project.id, database.id, auth.configId);

  // 5. Deploy application (assumes files already uploaded)
  const deployment = await deployApplication(project.name, fileSha);

  // 6. Generate claim code
  const transfer = await createProjectTransfer(project.id);

  console.log("🎉 Deployment completed!");
  console.log(`Live URL: https://${deployment.url}`);
  console.log(`Claim URL: ${transfer.claimUrl}`);

  return {
    projectId: project.id,
    deploymentUrl: `https://${deployment.url}`,
    claimCode: transfer.code,
    claimUrl: transfer.claimUrl,
  };
}

The complete example above shows the entire deployment process. The sections below break down each step.

Every deployment starts with creating a project container.

TypeScript
async function createProject(): Promise<{ id: string; name: string }> {
  const projectName = `demo-project-${Date.now()}`;

  const response = await fetch(`${CONFIG.VERCEL_API_URL}/v10/projects?teamId=${CONFIG.TEAM_ID}`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ name: projectName }),
  });

  const project = await response.json();
  console.log(`✅ Project created: ${project.name} (${project.id})`);

  return { id: project.id, name: project.name };
}

Key parameters:

  • name: Unique project identifier (auto-generated with timestamp)
  • teamId: Your team ID for proper project ownership

Learn more in the Vercel Projects API documentation.

Before creating databases, you need authorization to use Prisma on behalf of your team.

TypeScript
async function createPrismaAuthorization(): Promise<{
  id: string;
  configId: string;
}> {
  const response = await fetch(
    `${CONFIG.VERCEL_API_URL}/v1/integrations/billing/authorization?teamId=${CONFIG.TEAM_ID}`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        integrationIdOrSlug: "prisma",
        productId: CONFIG.PRISMA_PRODUCT_ID,
        billingPlanId: CONFIG.PRISMA_BILLING_PLAN,
        metadata: JSON.stringify({ region: CONFIG.PRISMA_POSTGRES_REGION }),
        integrationConfigurationId: CONFIG.INTEGRATION_CONFIG_ID,
      }),
    },
  );

  const authData = await response.json();

  return {
    id: authData.authorization.id,
    configId: authData.authorization.integrationConfigurationId,
  };
}

Key parameters:

  • billingPlanId: Billing plan ("partnerEntry" recommended for production)
  • region: Database region; pick one close to your users
  • metadata: JSON string containing region and other configuration

Learn more in the Vercel Integrations API documentation.

Create a new database instance with built-in connection pooling.

TypeScript
async function createPrismaDatabase(
  projectName: string,
  authId: string,
  configId: string,
): Promise<{ id: string }> {
  const response = await fetch(
    `${CONFIG.VERCEL_API_URL}/v1/storage/stores/integration?teamId=${CONFIG.TEAM_ID}`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        metadata: { region: CONFIG.PRISMA_POSTGRES_REGION },
        billingPlanId: CONFIG.PRISMA_BILLING_PLAN,
        name: `postgres-${projectName}`,
        integrationConfigurationId: configId,
        integrationProductIdOrSlug: CONFIG.PRISMA_PRODUCT_ID,
        authorizationId: authId,
        source: "marketplace",
      }),
    },
  );

  const storageData = await response.json();

  return {
    id: storageData.store.id,
  };
}

Key parameters:

  • name: Database identifier (typically matches project name)
  • source: "marketplace" for Vercel marketplace integrations
  • billingPlanId: Billing plan that determines features and limits

Learn more in the Vercel Storage API documentation.

Link the database to your Vercel project for automatic environment variable injection.

TypeScript
async function connectDatabaseToProject(
  projectId: string,
  storeId: string,
  configId: string,
): Promise<void> {
  await fetch(
    `${CONFIG.VERCEL_API_URL}/v1/integrations/installations/${configId}/products/${CONFIG.PRISMA_PRODUCT_ID}/resources/${storeId}/connections?teamId=${CONFIG.TEAM_ID}`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ projectId }),
    },
  );

  console.log("✅ Database connected to project");
}

This connection automatically adds DATABASE_URL and other environment variables to your project.

Learn more in the Vercel Integration Resources documentation.

Deploy your application code to Vercel.

TypeScript
async function deployApplication(
  projectName: string,
  fileSha: string,
): Promise<{ id: string; url: string }> {
  const response = await fetch(
    `${CONFIG.VERCEL_API_URL}/v13/deployments?teamId=${CONFIG.TEAM_ID}`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        files: [{ file: ".vercel/source.tgz", sha: fileSha }],
        name: `deployment-${Date.now()}`,
        projectSettings: { framework: "nextjs" },
        project: projectName,
      }),
    },
  );

  const deploymentData = await response.json();

  return {
    id: deploymentData.id,
    url: deploymentData.alias?.[0] || deploymentData.url,
  };
}

Key parameters:

  • files: Array of uploaded files (requires prior file upload in tgz format)
  • framework: "nextjs", "react", "vue", etc. for automatic configuration
  • projectSettings: Framework-specific build and runtime settings

Learn more in the Vercel Deployments API documentation or see the Vercel API Reference.

Step 6: Generate claim code for user transfer

Section titled “Step 6: Generate claim code for user transfer”

Create a transfer code that allows users to claim ownership of the deployed project.

TypeScript
async function createProjectTransfer(
  projectId: string,
): Promise<{ code: string; claimUrl: string }> {
  const response = await fetch(
    `${CONFIG.VERCEL_API_URL}/v9/projects/${projectId}/transfer-request?teamId=${CONFIG.TEAM_ID}`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({}),
    },
  );

  const transferData = await response.json();
  const claimUrl = `https://vercel.com/claim-deployment?code=${transferData.code}&returnUrl=https://myapp.com/dashboard/projects`;

  return {
    code: transferData.code,
    claimUrl,
  };
}

Key details:

  • Transfer codes are valid for 24 hours
  • Users can claim projects to any team in their Vercel account
  • The returnUrl redirects users to a specific page if the claim URL is invalid or expired

Learn more in the Vercel Claim Deployments documentation.

After deployment, users can claim ownership through a secure transfer process:

  1. User receives claim URL: Your platform provides the generated claim URL
  2. User authentication: Vercel prompts for login if not authenticated
  3. Team selection: User chooses which Vercel team should own the project
  4. Transfer completion: Project and database transfer to user's selected team
  5. Billing transfer: User's team becomes responsible for hosting costs
https://vercel.com/claim-deployment?code=xxx&returnUrl=https://myapp.com/dashboard/projects

Parameters:

  • code: The transfer code from Step 6 (valid 24 hours)
  • returnUrl: Redirects users to a specific page if the claim URL is invalid or expired

When a user claims a deployment, they receive:

  • Full project ownership with all source code and configuration
  • Database ownership including all data and connection strings
  • Environment variables automatically updated for the new team
  • Deployment history and build logs

Learn more in the Claim Deployments documentation.

TypeScript
async function handleApiErrors(response: Response, operation: string) {
  if (!response.ok) {
    const errorData = await response.text();

    // Handle specific error cases
    switch (response.status) {
      case 401:
        throw new Error(`Authentication failed: Check your ACCESS_TOKEN`);
      case 403:
        throw new Error(`Permission denied: Verify team access and scopes`);
      case 429:
        throw new Error(`Rate limit exceeded: Implement retry logic`);
      case 404:
        throw new Error(`Resource not found: Check IDs and configuration`);
      default:
        throw new Error(`${operation} failed: ${response.status} - ${errorData}`);
    }
  }
}

Vercel enforces rate limits on API endpoints. You can implement exponential backoff to handle rate limits:

TypeScript
async function apiCallWithRetry(url: string, options: RequestInit, maxRetries = 3) {
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
    try {
      const response = await fetch(url, options);

      if (response.status === 429) {
        const waitTime = Math.pow(2, attempt) * 1000; // Exponential backoff
        await new Promise((resolve) => setTimeout(resolve, waitTime));
        continue;
      }

      return response;
    } catch (error) {
      if (attempt === maxRetries) throw error;
    }
  }
}

Learn more in the Vercel API Limits documentation.

  • Store tokens securely: Never expose API tokens in client-side code
  • Validate inputs: Sanitize project names and user-provided data
  • Monitor usage: Track API calls to prevent abuse
  • Implement timeouts: Set reasonable request timeouts for reliability

The following are some production considerations for your deployment service:

You can call the deployment flow from your existing platform code:

TypeScript
// Example integration with an AI coding platform
class DeploymentService {
  async deployGeneratedApp(code: string, userId: string) {
    // 1. Package generated code
    const packagedCode = await this.packageCode(code);

    // 2. Deploy with Vercel + Prisma
    const deployment = await this.deployApp(packagedCode);

    // 3. Store deployment info
    await this.storeDeployment(userId, deployment);

    // 4. Notify user
    await this.notifyUser(userId, deployment.claimUrl);

    return deployment;
  }
}

Track key metrics for your deployment service:

  • Deployment success rate: Monitor API failures and timeouts
  • Claim conversion rate: Track how many users claim their deployments
  • Performance metrics: Measure deployment time and time to first claim
  • Cost analysis: Monitor Vercel and Prisma usage costs

Can I deploy an app to Vercel with a database in a single API flow?

Section titled “Can I deploy an app to Vercel with a database in a single API flow?”

Yes. The six-step flow in this guide creates a Vercel project, provisions a Prisma Postgres database, connects the two, and deploys the application code using only Vercel API endpoints. There is no dashboard interaction, which makes the flow suitable for automated pipelines and AI agents.

How many databases can I create programmatically?

Section titled “How many databases can I create programmatically?”

The Prisma Postgres Free plan includes 50 databases per account, and paid plans (Starter, Pro, Business) each include 1,000. Platforms that deploy on behalf of many users should apply for partner access, which uses the partnerEntry billing plan and provides higher database creation limits.

What happens to billing when a user claims a deployment?

Section titled “What happens to billing when a user claims a deployment?”

Ownership of both the Vercel project and the Prisma Postgres database transfers to the user's Vercel team, and that team becomes responsible for hosting and database costs from that point on. Claim codes are valid for 24 hours.

Anything Vercel can build and host, including Next.js, Nuxt, SvelteKit, and Remix. The demo templates use Next.js with Prisma ORM, and one variant adds authentication with Better Auth.

Do deployed apps need a connection pooler like pgBouncer?

Section titled “Do deployed apps need a connection pooler like pgBouncer?”

No. Prisma Postgres includes connection pooling by default, so apps deployed through this flow handle Vercel's serverless function scaling without a separate pooler.

Can I provision Prisma Postgres databases without Vercel?

Section titled “Can I provision Prisma Postgres databases without Vercel?”

Yes. The Prisma Postgres REST API lets you create and manage databases directly, which is useful for platforms that host applications elsewhere but still want programmatic database provisioning.

Now that you understand instant app deployment with Vercel and Prisma Postgres, you can:

  • Integrate into your platform: Add deployment capabilities to your existing application
  • Customize the flow: Adapt the process for your specific use case and user experience
  • Scale your implementation: Handle high-volume deployments with proper queuing and error handling
  • Monitor and optimize: Track performance and user adoption metrics

For questions or support with your integration, reach out through the Prisma Community Discord or Vercel Support.

  • AI SDK (with Next.js): Build a chat application with AI SDK, Prisma ORM, and Next.js that stores chat sessions and messages in Prisma Postgres.
  • Datadog: Learn how to configure Datadog tracing for a Prisma ORM project. Capture spans for every query using the @prisma/instrumentation package, dd-trace, and view them in Datadog
  • Embedded Prisma Studio (with Next.js): Learn how to embed Prisma Studio directly in your Next.js application for database management
  • GitHub Actions: Provision a Prisma Postgres database for every pull request with GitHub Actions and the Prisma CLI, apply your migrations and seed data to it, and delete it when the pull request closes.
  • Permit.io: Learn how to implement access control with Prisma ORM with Permit.io
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu