The Realm Platform

The core concept of the Realm Platform is a lightweight object container called a Realm. Like a database, data in Realms can be queried and filtered, interconnected, and persisted. Unlike a traditional database, though, objects in Realms are live and fully reactive. Realms synchronize seamlessly between devices and applications, and can be accessed safely across threads.

The Realm Platform is a combination of the Realm Object Server and client SDKs that together synchronize Realms. Because this synchronization is handled natively, developers spend no time writing networking code and can instead focus on the business logic of their applications.

The concepts being discussed below are cross-platform; simple examples will be given in Swift. Consult the documentation section for your preferred binding for examples in your language.

The Realm Database

At the heart of the Realm Platform is the Realm Database, an open source, embedded database library optimized for mobile use. If you’ve used a data store like SQLite or Core Data, at first glance the Realm Database may appear to be an object-relational mapper (ORM) backed with a lightweight relational database. This is not, however, what Realm is. Instead, Realm uses a “data container” model. Your data objects are stored in a Realm as objects. This gives Realm several significant advantages:

  • Realms store native objects: The Realm Database has bindings for many popular languages for mobile app development, including Swift, Java, Objective-C, C#, and JavaScript (using React Native). The objects you store in a Realm are the objects you work with in the rest of your code.
  • Realms are zero-copy: data is not copied in and out of the database to be accessed; you’re working with the objects directly.
  • Realms implement the live objects pattern: if you have an instance of an object stored in a Realm and something else in your application updates that object, your instance will reflect those changes.
  • Realms are cross-platform: as long as you don’t store platform-specific objects in a Realm, the data can be synced across operating systems. (In fact, the actual Realm data files can be copied between platforms.)
  • Realms are offline-first: Your application works the same way with a Realm whether or not it’s synchronized via the Realm Object Server, and whether or not the device is online at any given moment. When connectivity is available, changes will be synchronized transparently.
  • Lastly, Realms are ACID-compliant.

The Realm Object Server

Applications built on the Realm Platform have the ability to access and create Realms on the Realm Object Server. All your application needs is the connection information for your Object Server and the URLs of the server-side Realms. Objects on the Realm Object Server will be downloaded as the application needs them–then the local copy of the Realm will be kept fully synchronized with the Object Server’s copy.

Realms always operate in an “offline first” fashion: reads and writes take place on the local copy of the Realm. Syncing is automatic and fully transactional, and takes place as soon as a data connection is available.

Realms in Practice

Realms are defined with schema, like tables in a conventional database, but they’re more powerful than tables–a Realm can contain multiple kinds of objects, each with their own enforced schema. Yet unlike a database, a Realm is lightweight. An application can use multiple Realms, both local and remote, with different permissions for different users.

Imagine a hypothetical storefront application. The catalog could be a read-only remote Realm, accessed by all devices running the application. The shopping cart might also be a remote Realm, accessible only by devices on the same user account, so a user could start shopping on their phone and check out on their tablet. There could be a wish list Realm that users can share with one another. And every device might have a local Realm to store information that doesn’t need to be synchronized. All the remote Realms are synchronized through the Realm Object Server, with local copies stored on the devices for transparent offline capability.

Want to take a deeper look? Read the Realm Overview White Paper, a comprehensive overview that covers core concepts, key use cases, and implementation examples.

Getting Started

The easiest way to explore the server is to follow our getting started guide.

To explore the Enterprise Edition, including the automatic failover and load balancing, follow its guide.

Internal link icon Realm Data Model