Configure and use environment variables in your Wix CLI project to store configuration values and secrets outside of your code. Learn about how environment variables work in Wix CLI projects.
In this step, you store your variables on Wix servers and pull them into your local environment.
To set environment variables:
Set each variable with the wix app env set command. The command stores the variable on Wix servers and shares it with your project's collaborators.
The command has no flag that marks a variable as secret. Every variable you set is stored the same way, and only backend code can read it.
To use the variables in local development, pull them with the wix app env pull command. The command merges the variables from Wix servers into your .env.local file.
A variable that you add only to .env.local stays local. It doesn't reach preview or production builds. To make a value available to deployed code, set it with wix app env set.
Important:
WIX_CLIENT variables in the .env.local file. The Wix CLI manages these variables..env.local to source control. The project's .gitignore file excludes it by default.In this step, you read environment variables in your code.
Backend code, such as HTTP endpoints, event extensions, and service plugins, reads environment variables from process.env. Every value is a string.
To get TypeScript types for process.env, install the Node.js type definitions if your project doesn't already include them:
The following example reads the API_BASE_URL and API_SECRET_KEY variables:
Frontend code, such as dashboard pages and site widgets, can't read the environment variables you define. If frontend code needs a configuration value, create an HTTP endpoint that returns the value, and call the endpoint from your frontend code. Don't return secret values to frontend code.
After setting your environment variables, build and release your project to apply the changes.
To build and release:
Last updated: 11 November 2026