How do I set up a staging environment on Vercel?

Information on how to set up a staging environment on Vercel.
Last updated on February 28, 2025
Environment Variables

Vercel provides the option for Pro and Enterprise users to set up a custom environment that can configured through the dashboard and be used as staging. To learn more, see Custom Environments.

With custom environments, you can use branch rules to automatically deploy your branch when the branch name matches the rule, attach a domain to your environment, set environment variables, or import environment variables from another environment.

In addition to setting up a staging environment, you can also create staged production deployments that aren't immediately assigned to your production domains. This approach allows you to verify your production build before making it live to your users.

1. Go to your project Settings > Environments > Production section. 2. Disable the Auto-assign Custom Production Domains option under Branch Tracking settings.

When you push to your production branch, Vercel will create a production deployment without automatically assigning it to your domains.

After verification:

1. Navigate to the Deployments tab and select your staged production deployment. 2. Click the (...) menu in the top-right corner. 3. Select Promote to Production and confirm.

This approach provides an additional verification step before exposing changes to users, complementing both custom environments and branch-based workflows. Staged Production Deployments can also be used with the Vercel CLI to support custom CI scripts.

For Hobby users, or others who can't use custom environments, it's also possible to set up a staging workflow by setting a branch-specific domain and environment variables for your preview deployment.

To create a staging branch:

  1. Go to your dashboard, and select your project. Then, select the Settings tab.
  2. In the Domains section, add a custom domain to your project and configure it as appropriate.
  3. Finally, follow the steps to assign it to a branch.
WARNING: When adding a domain, it is first automatically assigned to your default branch. Make sure to click the "Edit" button and assign it to the appropriate Git branch.
Adding a staging domain to the staging branch through a Project's Domain settings.
Adding a staging domain to the staging branch through a Project's Domain settings.
  1. Go to your dashboard, and select your project. Then, select the Settings tab.
  2. In the Environment Variables section, add your environment variables to your project and configure it to your Git branch.

Any branch-specific variables will override other variables with the same name. This means you don't need to replicate all your existing Preview variables for each branch – you only need to add the values you wish to override.

Adding an Environment Variable to the staging branch.
Adding an Environment Variable to the staging branch.

After adding all the necessary Environment Variables for your staging environment, make sure to redeploy your latest staging Preview Deployment to apply the Environment Variables.

Redeploying a Deployment from the Deployment overview.
Redeploying a Deployment from the Deployment overview.

Couldn't find the guide you need?