Environment Variables
Environment variables let you define key-value pairs that are accessible in your code via process.env. This is useful for storing API keys, configuration values, feature flags, or any data you want to keep separate from your code.
Opening the Environment Variables Panel
Access the panel by clicking the Environment Variables icon in the sidebar, or through the menu Tools → Environment Variables.
Adding Variables
- Open the environment variables panel from the sidebar
- Enter a key name (e.g.,
API_KEY) and its value - The variable is immediately available in your code
Using Variables in Code
Access your environment variables through the standard Node.js process.env object:
const apiKey = process.env.API_KEY
const baseUrl = process.env.BASE_URL
console.log(`Connecting to ${baseUrl} with key ${apiKey}`)
Scope and Persistence
- Shared across all tabs — Every tab in PlayJS has access to the same set of environment variables. Changes take effect immediately in all tabs.
- Persistent — Variables are saved locally and persist between app restarts. You don’t need to re-enter them each time you open PlayJS.
Security
Environment variables are stored locally on your machine and are never transmitted to any external service. They are a safe place to store sensitive values like API keys during development and experimentation.