This application demonstrates how to transfer a Vercel project from one account to another using the Claim Deployments feature.
The demo covers the entire process, including creating a project in the host team, initiating the transfer, and enabling users to claim the project for themselves. Projects are created with Next.js templates that include Prisma Postgres integration and optional Better Auth authentication.
Try it out at: https://app-deploy-demo.prisma.io/
To set up the project, add the following environment variables to your .env.local
file:
# Required for Vercel API access and project management
TEAM_ID=""
ACCESS_TOKEN=""
INTEGRATION_CONFIG_ID=""
# Required for automated cleanup cron job security
CRON_SECRET=""
# Configure these to match your Prisma setup
PRISMA_INTEGRATION_PRODUCT_ID="iap_yVdbiKqs5fLkYDAB" # or "prisma-postgres"
DEFAULT_BILLING_PLAN_ID="business" # Your actual Prisma plan
VERCEL_REGION="iad1" # Prisma Postgres database region
# PostHog Analytics (optional)
NEXT_PUBLIC_POSTHOG_KEY=""
NEXT_PUBLIC_POSTHOG_HOST="https://us.i.posthog.com"
Environment Variable: TEAM_ID
Where to get it:
- Go to Vercel Dashboard
- Switch to your Team (not personal account)
- Go to Team Settings
- The Team ID is displayed at the top of the settings page
- It looks like:
team_abc123xyz
Environment variable: ACCESS_TOKEN
Where to get it:
- Go to the Tokens page in the Vercel Dashboard
- Generate a new access token
- Ensure that the token's scope matches the team where the projects will be transferred from
- The token creator must have Owner permissions on the team
Environment variable: INTEGRATION_CONFIG_ID
Where to get it:
- In Vercel Dashboard, go to your Team
- Click Integrations tab
- Find Prisma and click Configure (install it first if needed)
- In the URL, you'll see the config ID:
https://vercel.com/teams/your-team/integrations/icfg_abc123xyz
- Copy the
icfg_abc123xyz
part
Example:
INTEGRATION_CONFIG_ID="icfg_abc123xyz"
These variables have default values but should be configured to match your Prisma setup:
Environment variable: PRISMA_INTEGRATION_PRODUCT_ID
Default: "iap_yVdbiKqs5fLkYDAB"
Important: Set this to match your Prisma integration. Use "prisma-postgres"
if that's what your integration uses.
Environment variable: DEFAULT_BILLING_PLAN_ID
Default: "business"
Important: This must match your actual Prisma billing plan.
To find your Prisma billing plan:
- Go to Vercel Dashboard → Your Team → "Integrations"
- Click on Prisma integration and then click on "Settings"
- Look for "Current Installation Level Plan" section
- Set
DEFAULT_BILLING_PLAN_ID
to the exact plan name shown (e.g., "business", "pro", "enterprise")
Environment variable: CRON_SECRET
Important: This is required for securing the automated cleanup cron job endpoint.
Where to get it:
- Generate a random string of at least 16 characters
- You can use a password generator like 1Password
- Set this same value in your Vercel project's environment variables
Example:
CRON_SECRET="your-secure-random-string-here"
Environment variable: VERCEL_REGION
Default: "iad1"
(us-east-1, Washington, D.C., USA)
Important: This specifies the region for your Prisma Postgres database, not Vercel deployments. Choose the region closest to your users for optimal database performance.
Select a region from the Vercel regions list and set this value accordingly.
Environment variables: NEXT_PUBLIC_POSTHOG_KEY
and NEXT_PUBLIC_POSTHOG_HOST
These are optional environment variables for analytics tracking. If you don't need analytics, you can leave these empty.
After setting up the environment variables, install dependencies:
pnpm install
Start the development server using your preferred package manager:
pnpm run dev
Once the server is running, open http://localhost:3000 in your browser to view the demo application.
This application includes an automated cleanup system that runs twice daily (6 AM and 6 PM UTC) to remove temporary projects older than 12 hours.
- Cron Job: Configured in
vercel.json
to run at0 6,18 * * *
(twice daily) - API Endpoint:
/api/cleanup-projects
handles the cleanup logic - Security: Protected by
CRON_SECRET
environment variable - Cleanup Criteria:
- Projects starting with "temp-project"
- Older than 12 hours
- Created from this repository
You can also run cleanup manually using the script:
pnpm run clean:up
Or call the API endpoint directly (with proper authentication):
curl -X POST https://your-domain.vercel.app/api/cleanup-projects \
-H "Authorization: Bearer your-cron-secret"