About Environment Variables in the CLI

Environment variables allow you to store configuration values and secrets outside of your code, making your apps more secure and portable. In a Wix CLI app, backend code reads environment variables from process.env. Frontend code, such as dashboard pages and site widgets, can't read the environment variables you define.

This article explains where environment variables are stored in Wix CLI projects and which code can read them.

Where environment variables are stored

An environment variable's storage location determines where its value is available.

Storage locationHow you set itWhere the value is available
Wix serversThe wix app env set command.Deployed code in preview and release builds. Local development after you run wix app env pull.
.env.local file onlyAdd the variable to the .env.local file in your project root.Local development only. The value doesn't reach preview or production builds.

Variables on Wix servers

Store every value that your deployed code needs on Wix servers, including sensitive values such as API keys:

  • Variables you set with wix app env set are stored on Wix servers and shared with your project's collaborators.
  • Deployed code in preview and release builds reads these variables from process.env.
  • To use the variables in local development, run wix app env pull. The command merges the variables from Wix servers into your .env.local file.

Variables in .env.local

A variable that you add only to .env.local stays on your computer. Use .env.local alone only for values that you need in local development and not in deployed code.

The project's .gitignore file excludes .env.local, so pulled values aren't committed to your repository. Keep .env.local out of source control.

.env.local also contains WIX_CLIENT_* variables, which the Wix CLI manages. Don't edit them.

Which code can read environment variables

Backend code, such as HTTP endpoints, event extensions, and service plugins, reads environment variables from process.env.

Frontend code, such as dashboard pages and site widgets, can't read the environment variables you define. If frontend code needs a non-sensitive configuration value, have it call an HTTP endpoint that returns the value. Don't return sensitive values to frontend code.

See also

Last updated: 11 November 2026

Did this help?