Last updated May 4, 2021

Rate this page:


When you call forge create, we automatically create three environments for you:

  • development
  • staging
  • production

Environments are where you deploy your app. Once an app is running in an environment, you can install it from that environment on to an Atlassian site with forge install.

We recommend using the development environment for testing your changes, staging for a stable version of your app, and production as the version of your app that’s ready for use.

By default, the CLI will run commands for the development environment unless you specify another with the --environment flag.

While your app is deployed to development, your app title will have the suffix (DEVELOPMENT). Similarly, while your app is deployed to staging, it will have the suffix (STAGING). Once you deploy your app to production, your app title will no longer have any suffix.

Environment restrictions

When using the staging environment, you can't use the forge tunnel command. You'll need to redeploy your app using forge deploy each time you make a code change.

When using the production environment, you can't use the forge tunnel or forge logs commands. To debug issues, you’ll need to redeploy your affected code to the staging or development environments where you have access to debugging tools. For apps installed on sites you don’t have access to, you’ll need to ask the app user to download the production logs for your app and send them to you.

Environment variables

Environment variables are key-value pairs you can set in each of your app environments (development, staging, production).

Note, environment variables cannot be accessed in the snapshot context.

  • List your environment variables by running:

    forge variables:list
  • Set a variable with key MY_KEY and value my-value by running:

    forge variables:set MY_KEY my-value
  • Set an encrypted variable by providing the --encrypt option by running:

    forge variables:set --encrypt MY_KEY my-value

    Encrypted values are protected from forge variables:list output. However, they are passed to your app's environment as clear text.

  • Unset a variable with key MY_KEY by running:

    forge variables:unset MY_KEY
  • Read a variable with key MY_KEY in your code as below:


Forge tunnel

When you're using the forge tunnel command, you must prefix environment variables with FORGE_USER_VAR_.

  1. Set the value of MY_KEY by prefixing FORGE_USER_VAR_ to the variable name, then running the following command in your terminal:

    export FORGE_USER_VAR_MY_KEY=test

You do not need to change variable assignment when using environment variables with forge tunnel, the variable is still accessed with MY_KEY.

const myVar = process.env.MY_KEY // MY_KEY will be "test"

Rate this page: