Environments
Overview
Space environments are entities within a space that allow you to create and maintain multiple versions of the space-specific data, and make changes to them in isolation.
By default, every space has one environment, called master. Additionally, multiple sandbox environments can be created. Sandbox environments start out as exact copies of the master environment. Environments are made up of the content model, content, and media. Additionally, locales and UI extensions can be altered per environment. When making changes to any of the aforementioned entities in any environment, including master, the data in all other environments isn’t affected and stays the same.
Because of this, we will quickly go out of sync so Contentful environments should be thought of differently than traditional sandbox/staging/production environments. Below are some of the use cases for environments:
Master and sandbox environment usage
Master environment is used as a production environment to deliver content to the end users. Sandbox environments are used for non-production development and testing.
Common uses for space environments
Local development
Once your project is up and running, you’ll likely still iterate on it, extend it, and ship improvements. If this is the case, using space environments can supplement your local development. You can create a new environment based on the current state of master and hook up an instance of your application that’s running locally. Then you’ll be ready to make changes to your data and settings.
Editors should edit content in the master environment, while developers can develop new features in a sandbox environment.
Applying changes from sandbox environments to master
This is our main use case at Rapha. All content model migrations will be written using the Contentful Migration DSL so that migrations are reproducible.
After testing content model changes in a sandbox environment we will execute those migration scripts using the Contentful CLI and apply them to our master environment.

Continuous Integration
Another example use case could be the use of Continuous Integration. In an environment that relies heavily on automated testing, environments can be created programmatically and just for the duration of a test. Once it has successfully passed, the environment is deleted.
Space environments enable continuous integration by allowing us to create a template space. This template space maintains the exact state we need to run our tests. Because environments are meant to be used as temporary entities for isolation, we don’t need to run any clean-up tasks. Instead, just delete and recreate a new environment for every test.
