--- id: 'vercel-marketplace' title: 'Vercel Marketplace' description: 'Manage your Supabase projects directly through Vercel' --- ## Overview The Vercel Marketplace lets you create and manage third-party resources, such as Supabase, from the Vercel platform. Through the Marketplace, Vercel bills you for your Supabase usage, and you sign in to Supabase with your Vercel account. Your Vercel team roles also carry over to your Supabase organization. When you create an organization and projects through the Vercel Marketplace, they function like those created directly within Supabase. However, the billing is handled through your Vercel account, and you can manage your resources directly from the Vercel dashboard or CLI. The integration also syncs environment variables to your connected Vercel projects. When you connect a Vercel project, Supabase turns on SSL enforcement and database token access for the Supabase project. Your Vercel deployments can then [connect with a Vercel-issued token](#connect-with-database-token-access) instead of the database password. For more information, see the [Introducing the Vercel Marketplace](https://vercel.com/blog/introducing-the-vercel-marketplace) blog post. To keep Vercel preview deployments off your production database, see [Preview branches on Vercel](/docs/guides/integrations/vercel-preview-branches). ## Quickstart Set up Supabase on Vercel in one of two ways: deploy a starter template, or install Supabase from the Vercel Marketplace. Both create a Supabase project and sync the following environment variables to your connected Vercel projects: ``` POSTGRES_URL POSTGRES_PRISMA_URL POSTGRES_URL_NON_POOLING POSTGRES_USER POSTGRES_HOST POSTGRES_POOLER_HOST POSTGRES_PASSWORD POSTGRES_DATABASE SUPABASE_SECRET_KEY SUPABASE_PUBLISHABLE_KEY SUPABASE_URL SUPABASE_PROJECT_REF SUPABASE_JWT_SECRET NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY NEXT_PUBLIC_SUPABASE_URL ``` Your app uses these variables to connect to your database and Supabase APIs. ### Via template
### Via Vercel Marketplace In the Vercel Marketplace, go to the [Supabase page](https://vercel.com/marketplace/supabase) and click **Install**. ## Connect with database token access Your Vercel functions can connect to the database through [database token access](/docs/guides/platform/database-token-access) with a short-lived token that Vercel mints for the Supabase resource instead of the database password. A Vercel function gets that token in two steps: 1. Read the deployment's own OIDC token from the `x-vercel-oidc-token` request header. Outside a request, call `getVercelOidcToken()` from `@vercel/functions/oidc`. 2. Exchange it for a resource token for the role you connect as. The resource ID is your main Supabase project's ref, even for preview deployments. Set `role` to `postgres` or `supabase_read_only_user`: ```js import { getVercelOidcToken } from '@vercel/functions/oidc' // Your main Supabase project's ref. In a preview deployment, SUPABASE_PROJECT_REF is set to the // preview branch's ref instead. const MAIN_PROJECT_REF = 'YOUR_MAIN_PROJECT_REF' async function getSupabaseDatabaseToken(role = 'postgres') { const oidcToken = await getVercelOidcToken() const response = await fetch( `https://api.vercel.com/v1/integrations/resources/${MAIN_PROJECT_REF}/token?role=${role}`, { method: 'POST', headers: { Authorization: `Bearer ${oidcToken}` } } ) if (!response.ok) throw new Error(`Token request failed: ${response.status}`) return (await response.json()).token } ``` Each token connects only as the role it was minted for. If you leave out `role`, Vercel mints a `service_role` token that works with the Data API but can't connect to the database. Because tokens last up to 15 minutes, request a new one shortly before the current one expires. For local development, run `vercel link` and `vercel env pull` to get a development OIDC token. Build the connection string from the environment variables the integration syncs and use the token as the password: | Connection | Connection string | | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | Shared pooler, transaction mode | `postgres://postgres.${SUPABASE_PROJECT_REF}:YOUR_TOKEN@${POSTGRES_POOLER_HOST}:6543/${POSTGRES_DATABASE}?sslmode=require&options=-c%20jit%3Dtrue` | | Shared pooler, session mode | Same as transaction mode on port `5432` | | Prisma | Transaction mode with `&pgbouncer=true` added | | Read-only, shared pooler | Same as transaction mode with the user `supabase_read_only_user.${SUPABASE_PROJECT_REF}` | | Direct connection | `postgres://${POSTGRES_USER}:YOUR_TOKEN@${POSTGRES_HOST}:5432/${POSTGRES_DATABASE}?sslmode=require` | Shared pooler connections need `jit=true` as shown in the table above. A token from a production deployment reaches the main project whereas a token from a preview deployment reaches that deployment's preview branch. The `@vercel/postgres` package doesn't work with these tokens because it accepts only its own pooled connection URLs. Connect with another Postgres client instead. ## Studio support To open Supabase Studio from the Vercel dashboard, start from either of the following tabs. Each one opens a different page in Supabase: - **Integrations** tab: Next to Supabase, click **Manage**, then click **Open in Supabase**. The Supabase Dashboard homepage opens. - **Storage** tab: Select your Supabase project, then click **Open in Supabase**. That project opens in the Supabase Dashboard. Supabase Studio provides tools such as: - **SQL Editor**: Run SQL queries against your database. - **Table Editor**: Create, edit, and delete tables and columns. - **Log Explorer**: Inspect real-time logs for your database. - **Postgres Upgrades**: Upgrade the Postgres version of your database. - **Compute Upgrades**: Scale the compute resources allocated to your database. ## How your Vercel team maps to Supabase There is a direct one-to-one relationship between a Supabase organization and a Vercel team. Installing the integration or launching your first Supabase project through Vercel triggers the creation of a corresponding Supabase organization if one doesn't already exist. When Vercel users interact with Supabase, they are automatically assigned Supabase accounts. New users get a Supabase account linked to their primary email, while existing users have their Vercel and Supabase accounts linked. - The user who creates the [Supabase database](/docs/guides/database/overview) from the Vercel dashboard is assigned the `owner` role in the new Supabase organization. - Subsequent users are assigned roles based on their Vercel role, such as `developer` for `member` and `owner` for `owner`. Role management is handled directly in the Vercel dashboard, and changes are synchronized with Supabase.