Realm Blog

Announcing Realm Cloud: Realm Platform as a Service Beta

Today we’re announcing Realm Cloud, the new “as-a-service” version of Realm Platform. Realm Cloud brings mobile developers the easiest way to add offline first and realtime data sync features to their apps. Our product vision revolved around one word: simplicity. Hundreds of thousands of developers around the world have built Realm into their Android and iOS apps on the device side; we wanted Realm Cloud to be so simple that all of those developers could use it as an organic extension of those apps.

We’re launching it today as a limited early beta, and have opened a beta waitlist that will allow us to invite sets of new developers every week. Sign up today – our first 500 active beta users will be our “Charter Users,” eligible for discounts and Realm swag.

Why Realm Cloud, and Why Now

We launched Realm Platform as an on-premise product exactly a year ago this month. And we’ve spent most of the last year working with mid-to-large sized customers who both needed a realtime, offline-first data platform like Realm, but who also had server-side teams and a preference for an on-premise implementation. Making these customers successful – you can read some of their stories here – taught us a lot, and today we have an on-premise product that is much more scalable, reliable, and developer-friendly. It will only continue to improve going forward, as we are committed to these customers and others for whom a cloud service is not a fit.

Along the way, though, we’ve had many, many conversations with startups, smaller companies, and smaller project teams at big companies who loved what Realm Platform could do, but couldn’t use it. They got stuck on either the hassle of a server-side implementation or the pricing model, which was optimized for established commercial apps and larger customers.

Today, we’re pleased to finally have the answer in Realm Cloud. Getting started with Realm Cloud is easy, the user experience is intuitive and designed to work seamlessly with Realm Studio, and you can have your first realtime app up and running in about ten minutes. No server-side anything required – just sign up and get going. And while at this early beta stage we are not quite ready to announce pricing and packages, we can tell you that, when we are in production, getting started on Realm Cloud will be free, with a monthly pricing model that starts at a low enough amount to easily put on a credit card, and scales with you and the needs of your app. (The beta of course is totally free.)

How it All Works, and How to Get Started

When we first started planning Realm Cloud, our goal was to do more than just automate the operations of Realm Platform. Instead, we wanted to make sure that the ease of use extended all the way into our APIs. To do so, we added a new synchronization mechanism: query-based sync.

Since the Realm Platform launch, our APIs were straightforward: provide a sync configuration with a URL and User object to open a synchronized Realm.

// Create the configuration
let syncServerURL = URL(string: "realm://localhost:9080/~/userRealm")!
let config = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: syncServerURL))

// Open the remote Realm
let realm = try! Realm(configuration: config)
// Any changes made to this Realm will be synced across all devices!

The data synced to the Realm in the client device would always be kept up-to-date with the copy of the Realm in the Realm Object Server. This API was familiar to Realm developers since it mirrored the configuration when using the database on its own. This simplicity, however, also introduced a constraint. Your application data needed to be segmented into several private or shared Realms.

For many data models this was straightforward, however, others didn’t map as well… until now.

Query-based sync allows a developer to use Realm’s query engine to define what subset of data from a synced Realm is needed by the client device. This enables applications to cache only the data needed by the user and more efficiently work with shared data across users.

Using this new functionality is easy, simply enable it in the sync configuration. Next, perform a query on the Realm and then subscribe to that query:

// Create a partially synced Realm
let config = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: realmURL, partial: true))
let realm = Realm(configuration: config)

// Create an anonymous subscription
let adults = realm.objects(Person.self).filter("age >= 18").subscribe()

The server will run the query and then synchronize all objects that match it. This query will be maintained for the life of the subscription and when data changes the server will re-evaluate the query and synchronize any changes. Given Realm’s reactive architecture, the app can stay-up-to-date by using the existing notification APIs:

// Normal change notification
self.notificationToken = adults.observe { (changes: RealmCollectionChange) in
    switch changes {
    case .initial:
        self.tableView.reloadData()
        break
    case .update(_, let deletions, let insertions, let modifications):
        self.tableView.beginUpdates()
        self.tableView.insertRows(at: insertions.map { IndexPath(row: $0, section: 0) }, with: .automatic)
        self.tableView.deleteRows(at: deletions.map { IndexPath(row: $0, section: 0) }, with: .automatic)
        self.tableView.reloadRows(at: modifications.map { IndexPath(row: $0, section: 0) }, with: .automatic)
        self.tableView.endUpdates()
        break
    case .error(let err):
        fatalError("\(err)")
        break
    }
}

The application can perform as many queries as needed. The sync protocol will normalize them and only send the minimal operations needed to keep the client synced. If the data is not needed anymore, you can choose to unsubscribe and the cached data for that query will be removed from the device:

// Remove the anonymous subscription
realm.unsubscribe(adults)

// Create a named subscription
let adults = realm.objects(Person.self).filter("age >= 18").subscribe(named: "Adults")

// Remove a named subscription
let didRemove = realm.unsubscribe("Adults")

We are really excited about the new query-based sync and will be sharing more in the coming weeks, including the support for finer-grained object-level permissions that compliment it. We would love your feedback, so be sure to sign up for the Realm Cloud beta to be one of the first to try it out!

Be a Charter Realm Cloud Developer

Register for the Realm Cloud Beta today – with limited capacity at this early stage, we’re inviting developers from the waitlist on a first-come, first-served basis. And if you are one of the first 500 users to get a Realm Cloud app up and running, you’ll get a 50% discount on Realm Cloud basic for its inaugural year of service. And if you give us useful feedback on Realm Cloud during the beta period, we’ll reward you with exclusive Realm swag like stickers, t-shirts, and water bottles.


Realm Team

At Realm, our mission is to help developers build better apps faster. We provide a unique set of tools and platform technologies designed to make it easy for developers to build apps with sophisticated, powerful features — things like realtime collaboration, augmented reality, live data synchronization, offline experiences, messaging, and more.

Everything we build is developed with an eye toward enabling developers for what we believe the mobile internet evolves into — an open network of billions of users and trillions of devices, and realtime interactivity across them all.

Get more development news like this