Pre-production environments
Use pre-production environments to preview and test your changes.Pre-production environments are designed for testing changes in a live setting that mirrors your production site, without public exposure. All pre-production deployments are secured with Deployment Protection by default.
Each pull request, branch, or commit can have its own deployment to preview changes.
By default, Vercel creates a new preview deployment by default when:
- You commit changes to a connected Git branch that is not the production branch (e.g.
main
) - You create a deployment using our CLI's
vercel
command - When you push to a branch or open a PR, Vercel automatically creates a preview deployment for every commit.
These deployments are accessible through an automatically-generated URL, which is available either as a comment in your PR or in the Vercel dashboard.
- Branch-specific URLs will always have the latest changes on that branch.
- Commit-specific URLs will always have the changes from that specific commit.
- You can configure preview environments using the
vercel.json
file. - Environment variables specific to preview environments can be managed in the Vercel dashboard.
If you do not want to generate preview deployments automatically, you can turn them off.
Alternatively, Pro and Enterprise teams can create custom environments, in order to have more control over their pre-production deployments. These environments can be particularly useful for long-running tasks, such as testing with specific databases or QA. These environments allow you to separate your release workflow from your code management.
To create an environment variables for your pre-production environment, follow the steps to declare an environment variable and ensure you select the environment(s) you require.
When you create a custom environment, you can choose to attach environment variables from another environment. This is useful when you want to keep your environment variables in sync across multiple environments.
Was this helpful?