Environments let you isolate applications, secrets, and configurations for different stages of your workflow. By default, all resources are deployed to theDocumentation Index
Fetch the complete documentation index at: https://fal.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
main environment. You can create additional environments like staging or dev to test changes separately from production.
Each app is attached to a single environment. To deploy the same application code to multiple environments (e.g., dev, staging, and main), you must create a separate app deployment for each environment. Apps cannot be promoted or moved between environments—instead, deploy your code to each target environment independently.
Why Use Environments?
- Isolation: Keep development, staging, and production completely separate
- Safe testing: Test new configurations and secrets without affecting production
- Team workflows: Different team members can work in isolated environments
- Staged deployments: Deploy and test in staging before deploying to production
Creating Environments
Create a new environment using the CLI:Listing Environments
View all your environments:| Name | Description | Default | Created At |
|---|---|---|---|
| main | Yes | 2024-01-01 00:00:00.000000 | |
| staging | Staging environment | 2024-01-15 10:30:00.000000 | |
| dev | Development | 2024-01-15 11:00:00.000000 |
Using Environments
Deploying to an Environment
Use the--env flag with fal deploy to create an app in a specific environment:
Managing Secrets per Environment
Secrets are scoped to environments. Set different API keys or configurations for each environment:Managing Apps per Environment
All app operations support the--env flag:
Running Functions in an Environment
Usefal run with the --env flag to test functions with environment-specific secrets:
Deleting Environments
--yes to skip the confirmation:
The
main environment cannot be deleted.Environment Workflow Example
Here’s a typical workflow using environments. Note that deploying to different environments creates separate app instances—each with its own configuration, secrets, and endpoint:Best Practices
- Use descriptive names: Name environments clearly (
staging,dev,qa) so their purpose is obvious - Mirror production: Keep staging as close to production configuration as possible
- Separate secrets: Never share secrets between environments; use environment-specific values
- Clean up unused environments: Delete environments that are no longer needed to avoid confusion
- Document environment usage: Make sure your team knows which environment to use for what purpose
Reference
CLI Reference
Complete CLI documentation for
fal environmentsSecrets Guide
Managing secrets across environments