Navigation

Export an Existing Realm Application

As you develop a Realm app, you might want to share the codebase with team members, make a backup, or work with a version control system like Git. MongoDB Realm's export functionality makes this possible.

You can export Realm apps to a local application directory from the Realm UI or with the realm-cli export command.

Exported application directories use the same name as the Realm app by default. Every configuration file must conform to its configuration file schema.

The simplest way to export a Realm app is directly from the Realm UI. To do so, click Deploy in the left-hand navigation, select the Import/Export App tab, and then click the Export App button.

The button in the UI that exports your app

Realm apps can be exported programmatically via the Command Line Interface (realm-cli).

Before beginning, ensure that you have properly installed realm-cli.

Important
Check your CLI version

This procedure uses version 1 of Realm CLI. If you have a newer version of Realm CLI, run realm-cli --help for a list of updated commands and usage examples.

1

To export a Realm app with realm-cli, you must first authenticate your realm-cli session using a MongoDB Atlas programmatic API key associated with your MongoDB Cloud account.

realm-cli login --api-key="<my api key>" --private-api-key="<my private api key>"
2

Run the following command to export your application as a directory in the specified output path:

realm-cli export --app-id=myRealmApp-abcde --output=path/to/exported/dir
Warning

If the directory specified by --output already exists, realm-cli will throw an error and the export will fail.

Your application will be exported to a local application directory. If you did not specify a path for the directory with --output, it will be exported with the same name as the application into the current working directory.

Only entities that are configured in your application will appear in your exported application directory. See Realm Application Configuration for more information on configuration files.

app/
├── realm_config.json
├── auth/
│ ├── providers.json
│ └── custom_user_data.json
├── data_sources/
│ └── <service name>/
│ ├── config.json
│ └── <database>/
│ └── <collection>/
│ ├── schema.json
│ └── rules.json
├── environments/
│ ├── no-environment.json
│ ├── development.json
│ ├── testing.json
│ ├── qa.json
│ └── production.json
├── functions/
│ ├── config.json
│ ├── <function>.js
│ └── <directory>/
│ └── <function>.js
├── graphql/
│ ├── config.json
│ └── custom_resolvers
│ └── <resolver name>.json
├── hosting/
│ ├── config.json
│ ├── metadata.json
│ └── files/
│ └── <files to host>
├── http_endpoints/
│ └── <service name>/
│ ├── config.json
│ └── incoming_webhooks/
│ ├── config.json
│ └── source.js
├── sync/
│ └── config.json
├── triggers/
│ └── <trigger name>.json
└── values/
└── <value name>.json
  • You can use Realm's export functionality to share your codebase, make a backup, or work with a version control system.
  • You can export Realm apps with the Realm UI or with the realm-cli export command.
Give Feedback