Reference
16 min read

System Environment Variables Overview

Vercel Environment variables that are automatically populated by the System, such as the URL of the Deployment or the name of the Git branch deployed.
Table of Contents

Vercel provides a set of Environment Variables that are automatically populated by the System, such as the URL of the Deployment or the name of the Git branch deployed.

To expose them to your Deployments, make sure Automatically expose System Environment Variables is checked in your Project Settings.

Automatically exposing System Environment Variables in the Project Settings.
Automatically exposing System Environment Variables in the Project Settings.

If you are using a Framework for your Project, Vercel provides prefixed Environment Variables, which you can find in the table below:

When you choose to automatically expose System Environment Variables, some React warnings, such as those in a create-react-app will display as build errors. For more information on this error, see How do I resolve a process.env.CI = true error?

NameDescription
VERCELAn indicator to show that System Environment Variables have been exposed to your project's Deployments. Example: 1.
CIAn indicator that the code is running in a Continuous Integration environment. Example: 1. Note: This Variable is only exposed during Build Step.
VERCEL_ENVThe Environment that the app is deployed and running on. The value can be either production, preview, or development.
VERCEL_URLThe domain name of the generated deployment URL. Example: *.vercel.app. The value does not include the protocol schemehttps://. Note: This Variable cannot be used in conjunction with Standard Deployment Protection. See Migrating to Standard Protection.
VERCEL_BRANCH_URLThe domain name of the generated Git branch URL. Example: *-git-*.vercel.app. The value does not include the protocol scheme https://.
VERCEL_REGIONThe ID of the Region where the app is running. Example: cdg1. Note: This Variable is only exposed during Runtime for Vercel Functions.
VERCEL_DEPLOYMENT_IDThe unique identifier for the deployment, which can be used to implement Skew Protection. Example: dpl_7Gw5ZMBpQA8h9GF832KGp7nwbuh3.
VERCEL_SKEW_PROTECTION_ENABLEDWhen Skew Protection is enabled in Project Settings, this value is set to 1. Example: 1.
VERCEL_AUTOMATION_BYPASS_SECRETThe Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings.
VERCEL_GIT_PROVIDERThe Git Provider the deployment is triggered from. Example: github.
VERCEL_GIT_REPO_SLUGThe origin repository the deployment is triggered from. Example: my-site.
VERCEL_GIT_REPO_OWNERThe account that owns the repository the deployment is triggered from. Example: acme.
VERCEL_GIT_REPO_IDThe ID of the repository the deployment is triggered from. Example: 117716146.
VERCEL_GIT_COMMIT_REFThe git branch of the commit the deployment was triggered by. Example: improve-about-page.
VERCEL_GIT_COMMIT_SHAThe git SHA of the commit the deployment was triggered by. Example: fa1eade47b73733d6312d5abfad33ce9e4068081.
VERCEL_GIT_COMMIT_MESSAGEThe message attached to the commit the deployment was triggered by. Example: Update about page.
VERCEL_GIT_COMMIT_AUTHOR_LOGINThe username attached to the author of the commit that the project was deployed by. Example: johndoe.
VERCEL_GIT_COMMIT_AUTHOR_NAMEThe name attached to the author of the commit that the project was deployed by. Example: John Doe.
VERCEL_GIT_PREVIOUS_SHAThe git SHA of the last successful deployment for the project and branch. Example: fa1eade47b73733d6312d5abfad33ce9e4068080. Note: This Variable is only exposed when an Ignored Build Step is provided.
VERCEL_GIT_PULL_REQUEST_IDThe pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string. Example: 23.

Frameworks typically use a prefix in order to expose Environment Variables to the browser.

The following prefixed Environment Variables will be available during the Build Step, based on the Project's selected Framework Preset.

NameDescription
NEXT_PUBLIC_VERCEL_ENVThe Environment that the app is deployed and running on. The value can be either production, preview, or development.
NEXT_PUBLIC_VERCEL_URLThe domain name of the generated deployment URL. Example: *.vercel.app. The value does not include the protocol schemehttps://. Note: This Variable cannot be used in conjunction with Standard Deployment Protection. See Migrating to Standard Protection.
NEXT_PUBLIC_VERCEL_BRANCH_URLThe domain name of the generated Git branch URL. Example: *-git-*.vercel.app. The value does not include the protocol scheme https://.
NEXT_PUBLIC_VERCEL_AUTOMATION_BYPASS_SECRETThe Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings.
NEXT_PUBLIC_VERCEL_GIT_PROVIDERThe Git Provider the deployment is triggered from. Example: github.
NEXT_PUBLIC_VERCEL_GIT_REPO_SLUGThe origin repository the deployment is triggered from. Example: my-site.
NEXT_PUBLIC_VERCEL_GIT_REPO_OWNERThe account that owns the repository the deployment is triggered from. Example: acme.
NEXT_PUBLIC_VERCEL_GIT_REPO_IDThe ID of the repository the deployment is triggered from. Example: 117716146.
NEXT_PUBLIC_VERCEL_GIT_COMMIT_REFThe git branch of the commit the deployment was triggered by. Example: improve-about-page.
NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHAThe git SHA of the commit the deployment was triggered by. Example: fa1eade47b73733d6312d5abfad33ce9e4068081.
NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGEThe message attached to the commit the deployment was triggered by. Example: Update about page.
NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_LOGINThe username attached to the author of the commit that the project was deployed by. Example: johndoe.
NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_NAMEThe name attached to the author of the commit that the project was deployed by. Example: John Doe.
NEXT_PUBLIC_VERCEL_GIT_PULL_REQUEST_IDThe pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string. Example: 23.

System Environment Variables will be populated with an empty string if the value is not applicable, for example when running vercel dev during Development or if the Deployment is not triggered by a Git Commit.

Many frontend frameworks require prefixes on environment variable names to make them available to the client, such as NEXT_PUBLIC_ for Next.js or PUBLIC_ for SvelteKit. Vercel adds these prefixes automatically for your production and preview deployments, but not for your local development environment.

Framework environment variables are not prefixed when pulled into your local development environment with vercel env pull. For example, VERCEL_ENV will not be prefixed to NEXT_PUBLIC_VERCEL_ENV.

To use framework-prefixed environment variables locally:

  1. Define them in your project settings with the appropriate prefix
  2. Scope them to Development
  3. Pull them into your local environment with Vercel CLI using the vercel env pull command
Last updated on April 18, 2024