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.
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:
- Go to your dashboard, and select your project. Then, select the Settings tab.
- In the Domains section, add a custom domain to your project and configure it as appropriate.
- Finally, follow the steps to assign it to a branch.
- Go to your dashboard, and select your project. Then, select the Settings tab.
- 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.
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.