Environments
Forge now supports three distinct environments per site - Production, Staging, and Development. This powerful feature allows you to independently configure and deploy your code to different environments according to your specific needs, with different environment variables, Git branches (if using autosync), and configurations - perfect for managing the Software Development Lifecycle (SDLC).
Overview
Each environment in Forge is completely isolated, giving you the flexibility to:
- Test new features in Development before moving to Staging
- Validate changes in Staging before deploying to Production
- Use different environment variables for each environment
- Deploy from different Git branches (when using autosync)
- Maintain separate configurations for each stage of your development process
Environment Types
Production
Your live, customer-facing environment. This is where your final, tested, and approved code runs. Production environments should be stable and reliable, with careful deployment practices.
- Live customer-facing environment
- Requires careful testing before deployment
- Should use production-grade configurations
- Typically deployed from main/master branch
Staging
A pre-production environment that mirrors your production setup. Use this environment to test changes before they go live, ensuring everything works as expected in a production-like environment.
- Pre-production testing environment
- Mirrors production configuration
- Used for final testing before production deployment
- Can be deployed from feature branches or main branch
Development
Your development and testing environment. This is where you can freely experiment with new features, test changes, and iterate quickly without affecting production or staging environments.
- Development and testing environment
- Safe space for experimentation
- Can be deployed from any branch
- Ideal for feature development and testing
Accessing Environments
To access and switch between environments:
- Navigate to your site in the Forge Dashboard
- Look for the environment dropdown in the top bar of the Site Detail view
- Click on the dropdown to see the three environment options: Production, Staging, and Development
- Select the environment you want to work with
Environment Configuration
Environment Variables
Each environment can have its own set of environment variables:
- Production: Production API keys, database URLs, and other production-specific configurations
- Staging: Staging API keys and configurations that mirror production
- Development: Development API keys, local database URLs, and development-specific settings
Git Branch Configuration
When using autosync with Git repositories, you can configure different branches for each environment:
- Production: Typically deploys from
mainormasterbranch - Staging: Can deploy from
stagingbranch ormainbranch - Development: Can deploy from any branch, including feature branches
Best Practices
Deployment Workflow
Recommended workflow for using environments:
- Develop new features in the Development environment
- Test thoroughly in Development
- Deploy to Staging for pre-production testing
- Validate everything works in Staging
- Deploy to Production when ready
Environment Variables Management
Keep your environment variables organized:
- Use descriptive names for environment variables
- Document the purpose of each variable
- Never commit sensitive information to version control
- Use different values for each environment as needed
Branch Strategy
Consider implementing a branching strategy:
- main/master: Production-ready code
- staging: Code ready for staging testing
- feature branches: Individual features being developed
Environment-Specific Features
Deployment History
Each environment maintains its own deployment history, allowing you to:
- Track changes specific to each environment
- Rollback to previous versions if needed
- Monitor deployment frequency and success rates
Join the Discussion
Have questions or want to share your experience? Join our community discussion to connect with other developers and get help from the Forge team.
Visit Forum Discussion