Vercel provides three default environments—Local, Preview, and Production:
Pro and Enterprise teams can create Custom Environments for more specialized workflows (e.g., staging
, QA
). Every environment can define it’s own unique environment variables, like database connection information or API keys.
This environment is where you develop new features and fix bugs on your local machine. When building with frameworks, use the Vercel CLI to pull the environment variables for your project.
Install the Vercel CLI:
Link your Vercel project with your local directory:
Pull environment variables locally for use with application development:
This will populate the .env.local
file in your application directory.
Preview environments allow you to deploy and test changes in a live setting, without affecting your production site. By default, Vercel creates a preview deployment when you:
main
)-prod
flag, for example just vercel
Each deployment gets an automatically generated URL, and you'll typically see links appear in your Git provider’s PR comments or in the Vercel Dashboard.
There are two types of preview URLs:
Learn more about generated URLs.
The Production environment is the live, user-facing version of your site or application.
By default, pushing or merging changes into your production branch (commonly main
) triggers a production deployment. You can also explicitly deploy to production via the CLI:
When a production deployment succeeds, Vercel updates your production domains to point to the new deployment, ensuring your users see the latest changes immediately. For advanced workflows, you can disable the auto-promotion of deployments and manually control promotion.
Custom environments are useful for longer-running pre-production environments like staging
, QA
, or any other specialized workflow you require.
Team owners and project admins can create, update, or remove custom environments.
staging
), and optionally:
To create an Authorization Bearer token, see the access token section of the API documentation.
curl --request POST \
--url https://api.vercel.com/v9/projects/<project-id-or-name>/custom-environments \
--header "Authorization: Bearer $VERCEL_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"slug": "<environment_name_slug>",
"description": "<environment_description>",
}'
To create an Authorization Bearer token, see the access token section of the API documentation.
import { Vercel } from '@vercel/sdk';
const vercel = new Vercel({
bearerToken: '<YOUR_BEARER_TOKEN_HERE>',
});
async function run() {
const result = await vercel.environment.createCustomEnvironment({
idOrName: '<project-id-or-name>',
requestBody: {
slug: '<environment_name_slug>',
description: '<environment_description>',
},
});
// Handle the result
console.log(result);
}
run();
You can deploy, pull, and manage environment variables to your custom environment with the CLI:
# Deploy to a custom environment named "staging":
vercel deploy --target=staging
# Pull environment variables from "staging":
vercel pull --environment=staging
# Add environment variables to "staging":
vercel env add MY_KEY staging
Custom environments are available at no additional cost on the Pro and Enterprise plans. The number of custom environments you can create is based on your plan:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4