Best practices for using Realm Environments

I didn’t find any example of environment feature of Realm sync. I want to use two environments. “DEVELOPMENT” environment for development branch of my code. A “PRODUCTION” environment for the Main(Production) branch of my code.

I already created a Realm app with “DEVELOPMENT” environment tag. I am using this app to do the initial development work of my app. I want to keep this app for further development and experimentation.
What needs to be done to keep a separate environment for the production?

1 Like

Hi @Paramjit_Singh,

These environment tags allow Realm values to take on different values, depending on the environment (docs). For example, in “development” you might want to use creds for a test Stripe account rather than the one that accepts real payments.

By changing the environment, your app’s behavior changes based on those Realm Values.

1 Like

Realm application is owned by a project/cluster. It was suggested to me that different environments should be different projects. How are Realm applications organized into different environments?

It seems like Realm application environments either share a single cluster — or I have the migrate the application across projects throughout the development cycle? Neither of these make sense?

1 Like

There is a great presentation that @Lauren_Schaefer did for this year’s MongoDB .live 2021 that was all on managing Realm Apps environments and integrating the config into SDLC - I really suggest you check it out!

1 Like

@Ian_Ward Thanks, a working example or some documentation would be awesome!

Link to the presentation? (I tried to google but couldn’t find anything, … the Events | MongoDB site doesn’t have any content?)

There’s a write-up of it here: How to Build CI/CD Pipelines for MongoDB Realm Apps Using GitHub Actions | MongoDB

Video is available if you register with the MongoDB .Live site, but here’s a direct link: Building CI/CD Pipelines for MongoDB Realm Apps - YouTube

2 Likes