Share Environment Variables with Collaborators

Share secret environment variables, such as API keys for AI usage, with collaborators on your Wix-managed headless project. Instead of sending secrets to your team over insecure channels, you store them once with Wix, and each collaborator pulls them into their own local environment with the Wix CLI.

Secrets are stored securely on Wix servers, not in your local .env.local file, so they're never at risk of being committed to your repository.

Note: This applies to Wix-managed headless projects, which Wix hosts and you develop with the Wix CLI. Self-managed headless projects run their own backend and share secrets through their framework or hosting provider.

Before you begin

Make sure that:

Step 1 | Add the secret

Add the secret in one of the following ways:

  • Wix CLI: Use the wix env set command to set the secret from your terminal.

    Copy
  • Secrets Manager: Add and manage the secret from your dashboard, without using the CLI. This is useful for managing secrets in one place, or for team members who need to add or update a secret but don't develop with the CLI, such as a site admin.

    1. Open your headless project dashboard.
    2. Go to Developer Tools > Secrets Manager.
    3. Click Add Secret.
    4. Enter a name and value for the secret, then save it.

Note: Secrets set with wix env set are stored on Wix servers but don't appear in the Secrets Manager, which shows only secrets added through the dashboard. Both are pulled by wix env pull. To keep all your secrets visible and manageable in one place, add them through the Secrets Manager.

Step 2 | Pull the secret

Each collaborator pulls the shared secrets into their own local environment using the wix env pull command, which merges them into their .env.local file. This includes secrets added with either wix env set or the Secrets Manager.

Copy

After pulling, the secret is available in the collaborator's local environment for use with wix dev. To use the secret in code, make sure it's defined in the project's schema. For more information, see Manage Environment Variables in the CLI.

See also

Did this help?