Docs Menu

Realm App Environments

On this page

  • Environments in Realm
  • Supported Environments
  • Environment Values
  • Environments in Workflows
  • Use Environments in CI/CD

In MongoDB Realm, an environment represents a collection of environment values that corresponds with a stage in your development process. For example, many organizations use different environment values for Development and Production.

When you deploy a Realm app, you can specify the environment that this application represents. If you do not specify the environment, the Realm app defaults to No Environment.

Tip

Setting your Realm app's environment tells MongoDB Realm which environment values to use. When you change the environment, this changes the environment values that the Realm app uses. This is distinct from the more general values, which do not change when you change the app environment.

Realm supports the following environments:

  • "no-environment"
  • "development"
  • "testing"
  • "qa"
  • "production"

You can define environment values directly in the Realm UI. You can also import environment configuration files with Realm CLI or GitHub. In these files, you define environment values as JSONobjects.

These values are specific to the environment that the app represents. For example, you'd store your Production environment values in a production.json file in the /environments directory, and your Development environment values in a development.json file. When you specify the environment for your Realm app, Realm uses the corresponding environment values.

Each Realm app represents a single environment in your development process. This means that a typical development process is likely to have a minimum of three Realm apps at any given time; Development, Testing, and Production. If you use unique applications to test different feature branches, you might have many versions of Development and Testing apps -- one for each branch.

Diagram showing different Realm apps for each branch
click to enlarge

You can use environments in your CI/CD pipeline. You might create an automated process to generate a new Testing app when a developer on your team opens a pull request to merge development work to staging. You can use realm-cli to automate creating a new Realm app, setting the environment to testing, and importing your updated app configuration.

Tip
See also:

For a complete example CI/CD pipeline that manages testing, deployment, and other tasks for a real application, see: How to Build CI/CD Pipelines for MongoDB Realm Apps using GitHub Actions.

Give Feedback
MongoDB logo
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.