Skip to main content

Environment Variables

Environment variables let you store configuration — API keys, tokens, base URLs, feature flags — outside of your code. They're a good fit for any value you'd rather not paste into a tab, particularly secrets you don't want to risk saving to a file or sharing in a screenshot.

You can open the Environment Variables window from the Tools menu: Tools > Environment Variables.

Environment Variables

Adding and editing

To add a variable, enter a key and value into the fields in the first row and click Add. Existing variables can be edited inline; click Save to persist your changes.

Keys are conventionally written in UPPER_SNAKE_CASE (e.g. OPENAI_API_KEY). All values are stored as strings — if you need a number or boolean in your code, parse it with Number(...) or compare against 'true' at the point of use.

Environment variable edit

Variables persist across sessions and are shared by all tabs. Removing a variable takes effect immediately for any subsequent runs.

Using variables in code

Environment variables are exposed through the process.env object:

const apiKey = process.env.OPENAI_API_KEY

const response = await fetch('https://api.example.com/data', {
headers: { Authorization: `Bearer ${apiKey}` },
})

If process.env.MY_KEY is referenced before the variable is defined, it evaluates to undefined — guard against this in shared code with a fallback or an early check.