Realm Blog

Realm Scales to the Web with GraphQL

by /

In the last 7 years, Realm has been focused on perfecting the solution to a problem that mobile engineers and companies have faced for years: how to store data efficiently on the device and reliably receive and push data into the cloud.

Realm Middleware for Web

Realm’s offline-first approach to synchronization has eliminated many of the dependencies and issues that developers had previously had to deal with. Now, Realm is expanding their offering to the web! 🎉

Realm + GraphQL

After we launched Realm Platform, we heard our customers requests for front-end web support. Traditionally building a realtime app using Realm on the web has been a challenge. You can use realm-js or realm-dotnet to incorporate Realm data into a backend web server, but front-end work in the browser was not possible due to environment limitations.

In order to deliver Realm data to web frameworks, we pursued two approaches. First, we explored building traditional REST and Websockets APIs. Secondarily, we experimented with GraphQL, utilizing it in the 1.0 Realm Object Server web dashboard. In comparing the two efforts, we realized that GraphQL was a much better fit. Realm’s schema model is highly compatible with that of GraphQL. Realm is an object-database which supports links as a first-class type. This allows developers to build complex object-graphs especially because Realm uses advanced memory management to efficiently traverse a graph in their apps. However, this breaks down with a web API. When you perform a GET request to query for data in a Realm, how do you know what part of the graph to return?

With a traditional REST API you can choose to return linked objects through keys in the JSON, which results in making multiple requests to retrieve the data needed from the graph. We also explored adding a depth parameter to allow the request to specify which linked data to return.

Ultimately, this discussion started to look more and more like GraphQL!

The GraphQL query language allows developers to define what data they want returned in the API. This works off a defined schema, mapping perfectly to the Realm object model, and results in collapsing of multiple traditional REST API requests. Furthermore, the GraphQL spec also includes the concept of subscriptions allowing a developer to subscribe to realtime data events.

Putting it all together it became obvious that Realm was a great fit for GraphQL and vice-versa. As a result, today we are announcing support for GraphQL in Realm Object Server. This brings similar expressive realtime data access that Realm Database SDKs provide for mobile to the web.

Terse, Simple, Elegant

GraphQL offers a very terse, yet expressive way to interact with your backend.

const query = gql`
  query {
    companies {
      companyId
      name
      address
    }
  }`;
 
const response = await client.query({
  query: query
});

const companies = result.data.companies;
const mutation = gql`
  mutation {
    result: addCompany(input: {
      companyId: "some-unique-id"
      name: "My Amazing Company"
      address: "Mars"
    }) {
      companyId
      name
      address
    }
  }`;

const response = await client.mutate({
  mutation: mutation
});

const addedCompany = response.data.result;

Simply define queries, mutations.

Efficient

One of the problems inherent to REST is that you’re dealing with Resources. This means that even if you only need a portion of data to populate your web UI, you still need to pull the entire resource.

Let’s take a look at an example.

const UserSchema = {
       name: 'User', 
       properties: {                
               userId: 'string',
               firstName: 'string', 
               lastName: 'string', 
               birthday: 'date',
               accounts: {type: 'Account[]'}
       } 
}; 
const AccountSchema = { 
     name: 'Account', 
     properties: { 
             AccountId: 'string',
             name: 'string', 
             openDate: 'date'
     } 
};

If you were building a view where you needed the user’s, firstName and userId to display. You would still need to fetch the entire user (e.g.GET /users/{id}) to get those pieces of data. The user may have a dozen other properties that are not important for this page.

Furthermore, if you wanted to pull back the name of the top 3 accounts for each user, you’d need to make additional REST calls to get each object, just so you could reference the name of each.

One typical workaround for this is to create Composite Resources for this (e.g. UserAccountSummary). While this addresses efficiency concerns in bandwidth and speed, it also leads to potential data redundancy or additional code on your server end to munge this data together.

GraphQL queries solve this problem quite elegantly by allowing you to specify only the data you need.

const query = gql`
  query {
    users {
        firstName
        userId
        accounts { 
            name 
        }
    }
  }`;

Notice that this query is only fetching the specific fields it needs for the client, not only is this extremely efficient for speed and bandwidth as we’ve discussed. It’s also simpler for developers to read. It reduces the cognitive load of reading the code, seeing only what data is being consumed on the client and nothing more.

Powerful Realtime Subscription model

The GraphQL subscription model is a perfect fit for Realm’s live, reactive nature.

const subscription = gql` // Subscribed to updates.
  subscription {
    users {
        firstName
        userId
        accounts { 
            name 
        }
    }
  }`;

Notice, by simply changing the query to a subscription, updates to the underlying data will automatically synchronize from Realm to the client in real-time. There is literally nothing else the developer has to do to make all of this work. Notice that just as with mobile, Realm Web, also will trigger an update if any updates to the underlying database affect the results. This all creates a simple, intuitive, experience for developers.

Thriving Community

GraphQL is a proven technology and has a thriving developer community with numerous support channels from forums and Slack groups to videos and blogs.

The Future

GraphQL and Realm is a great pairing for the web, and the next step toward building reactive, data centric applications on the web. You can try it out for yourself by running the Realm Object Server w/ GraphQL, available here. We’ve also created a sample client here. We hope you’ll check it out and give us your feedback!

Cheers! 🎉

The Realm Team

Read more

Realm + Kotlin just got even better with Realm 4.3.0

by /

We’re excited to announce first class support for Kotlin in Realm Java 4.3.0! 🎉

If you’ve been following us closely, or seen us talk about Kotlin, then you already know that we’ve been busy at work, trying to streamline and simplify Realm Kotlin development.

In 3.6.0, we added additional nullability annotations to avoid leaking Java Platform Types and increase the overall null safety of our API.

Prior to 3.6.0

// Platform types were returned, so..
val result: String? = realm.where(Dog::class.java).findFirst() // was legal 
// -- or --
val result: String = realm.where(Dog::class.java).findFirst() // WAS ALSO LEGAL!!
// If no results found and null got returned, callers got an IllegalStateException

After 3.6.0

val result: String? = realm.where(Dog::class.java).findFirst() // is legal 
// -- but --
val result: String = realm.where(Dog::class.java).findFirst() // is illegal!!

Version 3.6.0 also took advantage of the Kotlin type system to infer required fields based on their types.

Prior to 3.6.0

//  An explicit annotation was necessary to indicate a required field, even though it was expressible in the Kotiln type system.
@Required 
var name: String = ""

After 3.6.0

// Implicitly @Required
var name: String = ""

// Implicitly not @Required
var name: String? = null

What’s new in 4.3.0!

We’ve added several new features for our growing Kotlin user base with this release, including:

Parameterized Functions

Using inline functions w/ reified type parameters, we were able to simplify our API so that when calling createObject, delete, where, you can just pass the type argument in <> and avoid passing the runtime class.

// Instead of this…
val dog = realm.createObject(Dog::class.java)  // create a Dog
realm.delete(Dog::class.java) // Delete All Dogs
realm.where(Dog::class.java)
     .findAllAsync()
     .asFlowable() // Fetch all dogs asynchronously as an RxFlowable

// You do this
val dog = realm.createObject<Dog>()  // create a Dog
realm.delete<Dog>() // Delete All Dogs
realm.where<Dog>()
     .findAllAsync()
     .asFlowable() // Fetch all dogs asynchronously as an RxFlowable

// Where Dog implements RealmModel or extends RealmObject.

New Extensions

We’ve added replacements for Realm and RealmObject static utility methods. Wherever your Java code called static Realm.xxxx() and RealmObject.xxxx(), those can be replaced with extension method calls.

The immediately apparent gain here is prettier looking code.

// Given a model class implemented using the model class interface instead of the base class
@RealmClass
open class Dog : RealmModel {
  var name: String = "" 
}

// Instead of 
RealmObject.addChangeListener(dog, changeListener)

// you can do 
dog.addChangeListener() // Because addChangeListener is added as an extension to anything that implements RealmModel.

However, a secondary win here is discoverability of API functions available. Whereas before, you may have had to look at the docs to understand that method RealmModel.xxxx was available, now Android Studio will give you content assist and auto-import the extension for you.

New Keyword

We’ve added the anyOf search term as a replacement for in.

In Java, in order to query for dogs matching any of a list of names, you might do something like this:

RealmResults dogs = realm
             .where(Dog.class)
             .in("name", new String[] {"Larry","Curly","Moe"})
             .findAll();

… but in, is a keyword in Kotlin. So the equivalent query in Kotlin looked like this:

val dogs = realm
     .where<Dog>()
     .`in`("name", arrayOf("Larry", "Curly", "Moe"))

… which just looked a bit awkward. So we’ve added a new anyOf keyword, you can use from Kotlin.

val dogs = realm
     .where<Dog>()
     .anyOf("age", arrayOf("Larry", "Curly", "Moe"))

Kotlin Model Generation

Finally, we are happy to announce that we’ve added schema model generation back into RealmStudio, our cross platform, next generation version of the Realm Object Browser. In addition to exporting (Swift, C#, JavaScript, and Java), we now also export to Kotlin! 🎉

Great, so how do I use all of this?

That’s the best part! To use all of this Kotlin specific functionality, all you have to do is use Realm with Kotlin! Since Realm gets included in your project as a Gradle Plugin, we can detect when you’re using Kotlin and enable all of this new functionality for you!

At Realm, we want to make persistence as easy as possible, so you can focus on what makes your app unique. Kotlin helps us in that mission.

Cheers!

The Realm Team

Read more

Realm World Tour Wraps for 2017 – See You Next Year!

by /

The Realm Platform Experience

2017 brought not one but two major platform updates. We kicked off the year with 1.0 release and went on tour visiting 40 cities across the globe just in time to launch Realm Platform 2.0.

RWT-banner

40 Cities
11 Realm Speakers
2000+ Attendees

RWT-photos

In case you missed us in a city near you, you can watch the replay!

Eric Maxwell provides a thorough introduction to the Realm Platform complete with code samples in Swift, Java and JavaScript as well as a live demonstration using the platform to build a 2-player realtime game, Realm Pop. This particular recording from our stop in NYC at iOSoho has a great technical Q&A throughout the presentation. If you’ve wondered how Realm might integrate with your backend systems, how it handles conflict resolution, or some key feature differences between our Developer, Professional, and Enterprise editions of the platform, you’ll definitely want to watch this one!

 

We’re gearing up for our 2018 Realm World Tour! Want us to come to your city? Tweet @Realm with hashtag #Realmworldtour and #cityname. Stay tuned to Realm tour news for our 2018 tour dates!

Read more

Announcing Realm .NET: Leveling Up Our Microsoft Support with Global Notifier & UWP Sync

by /

The Realm Platform helps you build cross-platform native applications, with sophisticated reactive features, realtime data sync, and robust offline experiences. It has two foundational components – the Realm database, an embedded client-side live object database, and the Realm Object Server, a realtime synchronization and event handling server – and these have worked great for anyone handy with Linux or Mac, Node.JS, and PostgreSQL. But, if you were a .NET stack developer, with a preference for C# and Windows, and maybe some important data in SQL Server, Realm only met you halfway. You could use Realm Xamarin to build native client-side apps with C#, and you could rely on our .NET Core support to start using Realm in server-side applications, but most of the rest of Realm required you to work outside of the standard Microsoft stack.

Until today. We’re pleased to announce Realm .NET, with robust support for critical Microsoft stack technology across the Realm Platform. We’re shipping three new things that are available today: the new Global Notifier for .NET, new sync on Windows/UWP, and data encryption support for Windows/UWP. In addition, we’re announcing a new SQL Server Connector, making two-way data integration between Realm and SQL Server dead simple, and giving mobile dev teams a much better way to bring legacy databases into their realtime, offline-ready applications. The SQL Server Connector is in private beta today, but will be available to Enterprise Edition customers beginning in December.

Demos speak louder than words, so we’ve created a simple demo video as a quick introduction. Then read on for a deep dive focused on the Global Notifier, and find more details on Realm .NET in our docs.

 

Technical Deep Dive

When we shipped .NET Core support in the summer, we enabled you to start using Realms in your server-side applications. This made it effortless to distribute new data to all your connected clients by just writing it to the user’s Realm on the server and letting Realm handle the synchronization for you. Reacting to changes by users wasn’t that easy though, as when you have thousands of user-Realms, any of which can change at any given time, keeping an open instance for each one of them is simply not feasible. This is where the Global Notifier steps in – it is heavily optimized to observe huge amounts of Realms and notify you whenever any of them changes.

Essentially, the Global Notifier is a NuGet package you add to your .NET project (it can be either .NET Core or a classic .NET Framework project, such as Asp.Net, console app, or even WPF app). Then, you implement the INotificationHandler interface that exposes two methods that are called by the SDK itself: ShouldHandle allows you to specify which Realm paths you’re interested in observing. HandleChangesAsync will be invoked when an observed Realm changes with detailed information about the state of the Realm just before and just after the change. Finally, you start the notifier by calling Notifier.StartAsync) and pass it all the notification handlers you want to register. And the cool part is, you can deploy this app anywhere you want – it doesn’t have to sit on the same instances that are running your Realm Object Server.

Let’s see how we could use it to create a handler that will analyze the sentiment of a support ticket by using Azure’s Text Analytics API. If you want to skip the step-by-step tutorial, jump right ahead to the completed sample.

Prerequisites

Before we start, you’ll need:

Setting Up the Project

Create a .NET Core app and add the following NuGet packages:

Setting Up the Notification Handler

The next step is to implement a notification handler. We’ll use the built-in RegexNotificationHandler as it provides an easy implementation of the ShouldHandle method in terms of Regex matching. We can handle all user realms at the /~/feedback path by using the ^/.*/feedback$ regex:

public class FeedbackHandler : RegexNotificationHandler
{
    private readonly SentimentClient _sentimentClient;
    public FeedbackHandler() : base($"^/.*/feedback$")
    {
        _sentimentClient = new SentimentClient(your-api-key)
        {
            Url = https://YOUR-REGION.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment”
        };
    }

    public override async Task HandleChangeAsync(IChangeDetails details)
    {
        // We’ll populate this in a bit
    }
}

We’ve created the basic skeleton and added the sentiment client, now we only need to start using it. To add some context, let’s assume that the objects the client is inserting and we’re handling have the following structure:

public class Ticket : RealmObject
{
    public string Description { get; set; }

    public float Score { get; set; }

    // Other irrelevant properties
}

Then, the first step toward implementing HandleChangeAsync will be to check if we have any insertions for that class:

if (!details.Changes.TryGetValue("Ticket", out var changeSetDetails) ||
    changeSetDetails.Insertions.Length == 0)
{
    // We don’t care about other objects being updated
    return;
}

Then, we can construct the SentimentRequest that we’ll send to Azure for analysis:

var request = new SentimentRequest
{
    Documents = changeSetDetails.Insertions
                                .Select((obj, index) => new SentimentDocument
                                {
                                    Id = index.ToString(),
                                    Text = obj.CurrentObject.Description,
                                    Language = "en"
                                })
                                .Cast<IDocument>()
                                .ToList()
};

What this is doing is sending the Description value of our Tickets as the text we’ll analyze and assigning the consecutive index of the object in the array as the Id of the document we’re analyzing. The document Id needs to be unique just for the request scope, so that approach is perfectly fine.

Next, we’ll send the request and process the response:

var response = await _sentimentClient.GetSentimentAsync(request);
var analyzedDocuments = response.Documents.Select(d =>
{
    var ticket = changeSetDetails.Insertions[int.Parse(d.Id)];
    return new
    {
        Score = d.Score,
        TicketReference = ThreadSafeReference.Create(ticket.CurrentObject)
    };
});

What’s interesting here is that we’re creating a ThreadSafeReference for the object. The reason is that, even though we’ll change it on the same thread, details.CurrentRealm, to which ticket.CurrentObject belongs, is read-only (as it is pinned to a specific version and we wouldn’t want things to change while processing the changes) and we’ll open a different Realm instance to write the changes to the ticket. To obtain the same object in a different instance of the same Realm, we can pass the object by its primary key or use ThreadSafeReference which works even for objects without a primary key.

Finally, we can write the score to the tickets:

using (var realm = details.GetRealmForWriting())
{
    foreach (var doc in analyzedDocuments)
    {
        var reference = realm.ResolveReference(doc.TicketReference);
        realm.Write(() => reference.Score = doc.Score);
    }
}

Starting Up the Notification Handler

To start up the notification handler we just created, we’ll need to pass it to a NotifierConfiguration. But before that, we’ll need to login an admin user:

SyncConfiguration.SetFeatureToken(YOUR-ROS-FEATURE-TOKEN);

var credentials = Credentials.UsernamePassword(username, password, createUser: false);
var admin = await User.LoginAsync(credentials, new Uri("http://127.0.0.1:9080"));

Next, we create the configuration:

var config = new NotifierConfiguration(admin)
{
    Handlers = { new FeedbackHandler() },
};

And finally, we start the notifier:

var notifier = await Notifier.StartAsync(config);

Make sure to keep a reference to the notifier for as long as you wish to receive notifications. When you want to stop your application, make sure to dispose of it to avoid any native memory leaks.

Seeing It in Action

To test it out, you can create a small console app that opens a regular synchronized Realm and adds Ticket objects. Something like:

var config = new SyncConfiguration(user, new Uri(http://127.0.0.1:9080/~/feedback”));
using (var realm = Realm.GetInstance(config))
{
    while (true)
    {
        var input = Console.ReadLine();
        If (input == exit)
        {
            break;
        }

        realm.Write(() => realm.Add(new Ticket
        {
            Description = input
        }));
    }
}

Completed Sample

You can find the complete sample, along with a user and employee apps in our Feedback Manager repo.

Read more

Bringing Native Performance to Electron

by /

The Native vs. Non-Native Dilemma

Realm initially supported the Apple ecosystem when we launched, so making the Realm Browser a native macOS app was a no-brainer. Today we offer broad cross-platform support for Android, Xamarin, React Native, and more. Given our new diversity, we needed to support a broader range of desktop platforms as well, but with limited resources we quickly realized we couldn’t build and maintain native apps for macOS, Windows, and Linux.

We knew Electron could give us the ability to write a cross-platform desktop solution with a single codebase, but we were reluctant to write our flagship user interface tool in a non-native framework. We were not sure if the performance of an Electron app would provide the right product impression of Realm.

It also didn’t make us feel super confident to see a ton of developers pile on the most visible Electron app for not being native enough:

So how did a company dedicated to creating better native cross-platform development find ourselves in facing this classic dilemma, and which path did we take?

Realm History: From Browser to Studio

Let’s take a step back for a moment to see where we came from. When Realm launched in 2014, Swift was still the new kid on the block, and at Realm, we were focused on supporting the Apple ecosystem with Objective-C and Swift APIs. Along with our new database, we introduced the Realm Browser, a native macOS application that offered a visual interface into Realm databases. We felt strongly that developers needed great tooling, and we chose to build a native application because it mirrored the philosophy behind Realm’s database design: pairing high performance with APIs designed for easy integration into native applications.

Fast-forward to 2017 and Realm has evolved tremendously. We support Android, Xamarin, React Native, including non-mobile platforms like Node and .Net. In addition, we launched the Realm Object Server, offering automatic realtime data sync.

We felt like it was time to build a better Realm Browser that reflected the breadth of Realm’s reach. Realm is now used by over 100,000 developers, but Realm Browser only worked on macOS, leaving Windows developers in the Android and Xamarin communities without the ability to visualize their data. Plus, the Realm Browser was written in Objective-C, and after all these years the codebase needed some refactoring. A new version would have to improve on a few things:

  • Cross-platform
  • High performance and modern codebase
  • Support for data browsing and editing of local and synced Realm databases
  • Support for administering Realm Object Server

Despite our concerns about Electron performance and our industry’s frustration with Slack, we believed that supporting our entire developer ecosystem was important. That, and there was so much love for Electron-based VSCode that we figured it might actually be possible to build a great desktop app in JavaScript. With that hope, Realm Studio was born.

realm-studio

We chose Typescript to ensure the codebase was easier to maintain, and we also decided we would combine the Realm Object Server’s web dashboard into the application. True to our roots, we also wanted to challenge ourselves to deliver native performance. This is the story of how we did it.

A Tale Of Two Processes

Architecturally, Electron is unique in that it is all built around Node, but consists of two (or more) processes—main and renderer(s). These processes are isolated and run concurrently to each other. This structure is based off Chromium which uses separate processes to isolate each tab or window so that a misbehaving webpage doesn’t affect others. The main process creates BrowserWindow instances. A BrowserWindow instance displays HTML via its own renderer process. Thus, if an Electron app is showing two windows, there would be three processes: one main process and two individual renderer processes.

electron processes

The main process controls the lifecycle of the entire application while the renderer process is mainly responsible for displaying its own content. These processes have minimal ability for communication and were designed this way for performance and stability reasons.

This immediately presents a challenge: how do these two independent and isolated process communicate with each other in a stable, performant way?

Electron offers several mechanisms, including APIs for interprocess communication: ipcRenderer and ipcMain. Both offer RPC style communication to pass messages between renderer processes and the main process. For a complex app, there will be a need to share state between processes which creates a synchronization problem. Slack recently blogged how their team adopted electron-redux which uses IPC to synchronize independent Redux stores.

electron-redux architecture

Instead, Realm offers a much more elegant solution to this problem. One of the lesser known features of Realm is that it supports interprocess access! Internally, Realm uses an Multi-Version Concurrency Control architecture to provide thread or process confinement. Multiple concurrent readers are allowed across threads and processes, while only a single writer is allowed. Realm’s architecture ensures each thread or process has a stable view and coordinates updates on writes, offering ACID compliance.

For Electron this is a perfect fit because now there can be a single store that is shared across the main and renderer processes!

Even better is that Realm offers reactivity, in which all changes to the Realm can be observed and objects or collections auto-update. This results in a single-data flow architecture, where for example, an update can be written to the Realm in the main process and then observed in a renderer process to automatically update the UI.

electron

Native Performance

By using Realm as the central store for data across the Electron processes, this opens up the question on whether accessing the Realm from the renderer process will cause any performance problems. The biggest complaint with web applications compared to native is that they tend to face a bigger hurdle in ensuring high frame rates when scrolling for example. If the data access is too slow between the redraw cycles than frames will be missed causing jerky behavior.

Realm’s design is focused on performance and for mobile applications we encourage accessing Realm directly on the UI thread. The reason Realm is capable of this is due to its zero-copy architecture and use of lazy loading. Realm utilizes memory mapping to provide high read performance, in addition, when performing queries or traversing an object graph, Realm does not have to load all the objects until each are accessed.

The net effect is that pairing Realm with a high performance UI framework, will result in no lag and low memory use for large collections. Opportunistically, there was already a great library for React called react virtualized that handles efficiently rendering large collections of data. Our initial testing confirmed that pairing Realm with react virtualized resulted in no lag in scroll performance for Realm files that had millions of rows!

As a result, we were able to achieve native performance with Realm Studio. See for yourself in the video below, or try it out on your own.

 

Going Forward

Looking back, we are really happy with Realm Studio and our use of Electron. Realm matches well to the architecture and we were able to take advantage of another great aspect of Electron, auto-updating, to deliver an even better experience than the original macOS browser.

We encourage you to try Realm out in an Electron application today! Just install the latest version of realm-js:

npm install realm

While Electron works great for our use in Realm Studio, we haven’t yet tested it out in other use cases and are therefore not fully ready to offer the same level of support as for our other supported products. We hope the community is interested in stepping in and help test and support this area going forward.

For example, while both the main and renderer processes use Node, there are some subtle distinctions between the two. Specifically, realm-js uses the libuv event loop to deliver notifications and in the renderer Electron combines the uv loop on top of the Chromium loop. Given our commitment to the Electron platform with Studio, we will be continuing to test these areas and we would love to hear your feedback on our forums)!

Read more

Realm Java Reaches 4.0: Introducing ROS 2.0, Arrays of Primitives, and More!

by /

We’re proud to introduce version 4.0.0 of Realm Java, which ships with many new features, improvements, and bug fixes. Read on to find out more about what we’ve added, improved, and deprecated — or head over to see what’s happening on Realm Cocoa or Realm .NET!

Realm Object Server 2.0 support

Now, you can take advantage of all the benefits of ROS 2.0, including improved scalability, better performance, packaging based on npm, and the powerful new Realm Studio development tool for inspecting and administering your synchronized Realms! Beginning with this release, if you are using synchronized Realms, Realm Java will now require Realm Object Server version 2.0 or later.

If you were previously running Realm Object Server 1.x and wish to upgrade to Realm Object Server 2.0, you should read our documentation, on how to properly handle migrations on the client!

Read more about Realm Object Server 2.0 here.

Arrays of primitives

You can now store primitive types or their nullable counterparts (more specifically: String, Integer, Boolean, Float, Double, Short, Long, Byte, byte[] and Date) directly within RealmLists. If you want to define a list of such primitive values you no longer need to define cumbersome single-field wrapper objects. Instead, you can just store the primitive values themselves!

Lists of primitive values work much the same way as lists containing objects, as the example below demonstrates.

public class Student extends RealmObject {
    public String name;
    public RealmList<Integer> testScores = new RealmList<>();
}

// Retrieve a student.
Realm realm = Realm.getDefaultInstance();
Student bob = realm.where(Student.class).equalTo("name", "Bob").findFirst();

// Give him a few test scores, and then print his average score.
realm.beginTransaction();
bob.testScores.deleteAllFromRealm();
bob.testScores.add(94);
bob.testScores.add(89);
bob.testScores.add(96);
realm.commitTransaction();

// in the future queries like the below will be supported 
bob.testScores.average()   // 93.0

Check out our documentation on many-to-many relationships for more information. Note that we don’t currently support querying lists of primitives, but plan to add this functionality in a future release.

Partial synchronization

We’re introducing an early version of Realm’s new Partial Synchronization feature. Though it’s still an experimental feature that we’re actively changing and improving, we think it’s an important new pattern that enables much more flexible architectures on Realm.

The Realm Object Server currently keeps synchronized Realms fully synchronized, meaning that all copies of the Realm (whether on the server or device) eventually converge towards containing the same data. While this is great for most use cases, especially if you want updates on one device to be transparently reflected everywhere else, sometimes you want more control over what objects are actually synchronized from the server onto a device.

For example, you might have a large read-only Realm representing a product catalog for a massive e-commerce website, and you might only want to sync to a user’s device those database entries representing some relevant subset of those products (perhaps something like “prosumer DSLR cameras made by Canon that are between $500 and $1000”).

Partial sync allows you to open a synced Realm in “partial synchronization mode.” Such a Realm won’t automatically download all information on the remote server, but will instead only sync down objects that match queries you make. Once those objects are synchronized, they behave like normal synced objects. They’ll update in real time based on remote changes, and any changes you make to those objects will be synced back up to the server.

Here is a toy example demonstrating what partial sync looks like in action:

// First, we specify that we want to open the Realm in partial synchronization mode (using `partialRealm()`)
SyncConfiguration syncConfig = new SyncConfiguration.Builder(user, url).partialRealm().build();
Realm partialSyncRealm = Realm.getInstance(syncConfig);

// Then we can subscribe to queries.
// Currently queries follow NSPredicate format, but this will change in the feature 
// as this feature is still in beta
String query = "price >= 500 AND price >= 1000 AND manufacturer == 'Canon' AND category == 'Cameras'"
partialSyncRealm.subscribeToObjects(Product.class, query, new Realm.PartialSyncCallback<Product>() {
    // Results are returned asynchronously.
    @Override
    public void onSuccess(RealmResults<Product> results) {
        Product firstCamera = results.first();
        System.out.println("The first product result: " + firstCamera.productName + " " + firstCamera.productDescription)");
    }

    @Override
    public void onError(RealmException error) {
        // An error occurred while fetching the results! 
    }
});

Check out our partial synchronization documentation for more details.

All permissions operations (retrieving permissions, applying or revoking permissions, creating or accepting permission offers) are now carried out declaratively via APIs on SyncUser.getPermissionManager(). The deprecated ROS 1.0 permissions system requiring permission and management Realms to be manually opened and inspected has been removed. See our documentation on access control for more information.

Also, Realm Object Server administrators who use the -retrieveInfoForUser:... API to retrieve information about a ROS user will now get metadata about the user stored on the server, as well as a list of all authentication provider accounts associated with that user.

API changes

A number of previously deprecated APIs have been removed. Our change log has a comprehensive table detailing what APIs have been removed or renamed, as well as what APIs should be used instead.


Thanks for reading. Now go forth and build amazing apps with Realm! As always, we’re around on the Realm Forums, Stack Overflow, GitHub, or Twitter.

Read more

Realm Cocoa Reaches 3.0: Introducing ROS 2.0, Arrays of Primitives, and More!

by /

We’re proud to introduce version 3.0.0 of Realm Objective-C and Realm Swift, which ships with many new features, improvements, and bug fixes. Read on to find out more about what we’ve added, improved, and deprecated — or head over to see what’s happening on Realm Java or Realm .NET!

Realm Object Server 2.0 support

Now, you can take advantage of all the benefits of ROS 2.0, including improved scalability, better performance, packaging based on npm, and the powerful new Realm Studio development tool for inspecting and administering your synchronized Realms! Beginning with this release, if you are using synchronized Realms, Realm Objective-C and Realm Swift will now require Realm Object Server version 2.0 or later.

If you were previously running Realm Object Server 1.x and wish to upgrade to Realm Object Server 2.0, you should read our documentation (Objective-C, Swift) on how to properly handle migrations on the client!

Read more about Realm Object Server 2.0 here.

Arrays of primitives

You can now store primitive types or their nullable counterparts (more specifically: booleans, integer and floating-point number types, strings, dates, and data) directly within RLMArrays or Lists. If you want to define a list of such primitive values you no longer need to define cumbersome single-field wrapper objects. Instead, you can just store the primitive values themselves!

Lists of primitive values work much the same way as lists containing objects, as the example below demonstrates.

class Student : Object {
	@objc dynamic var name: String = ""
	let testScores = List<Int>()
}

// Retrieve a student.
let realm = try! Realm()
let bob = realm.objects(Student.self).filter("name = 'Bob'").first!

// Give him a few test scores, and then print his average score.
try! realm.write {
    bob.testScores.removeAll()
    bob.testScores.append(94)
    bob.testScores.append(89)
    bob.testScores.append(96)
}
print("\(bob.testScores.average()!)")   // 93.0

Check out our documentation on many-to-many relationships (Objective-C, Swift) for more information. Note that we don’t currently support querying lists of primitives, but plan to add this functionality in a future release.

Partial synchronization

We’re introducing an early version of Realm’s new Partial Synchronization feature. Though it’s still an experimental feature that we’re actively changing and improving, we think it’s an important new pattern that enables much more flexible architectures on Realm.

The Realm Object Server currently keeps synchronized Realms fully synchronized, meaning that all copies of the Realm (whether on the server or device) eventually converge towards containing the same data. While this is great for most use cases, especially if you want updates on one device to be transparently reflected everywhere else, sometimes you want more control over what objects are actually synchronized from the server onto a device.

For example, you might have a large read-only Realm representing a product catalog for a massive e-commerce website, and you might only want to sync to a user’s device those database entries representing some relevant subset of those products (perhaps something like “prosumer DSLR cameras made by Canon that are between $500 and $1000”).

Partial sync allows you to open a synced Realm in “partial synchronization mode.” Such a Realm won’t automatically download all information on the remote server, but will instead only sync down objects that match queries you make. Once those objects are synchronized, they behave like normal synced objects. They’ll update in real time based on remote changes, and any changes you make to those objects will be synced back up to the server.

Here is a toy example demonstrating what partial sync looks like in action:

// First, we specify that we want to open the Realm in partial synchronization mode (isPartial = true)
let config = Realm.Configuration(syncConfiguration:
    SyncConfiguration(user: user, realmURL: productRealmURL, isPartial: true))
let realm = try! Realm(configuration: config)

// Then we can subscribe to queries.
// Queries are made using NSPredicate format.
let query = "price >= 500 AND price >= 1000 AND manufacturer == 'Canon' AND category == 'Cameras'"
realm.subscribe(to: Product.self, where: query) { (results, error) in
    // Results are returned asynchronously.
    guard let results = results else {
        print("An error occurred while fetching the results! \(error!)")
        return
    }
    if let firstCamera = results.first {
        print("The first product result: \(firstCamera.productName), \(firstCamera.productDescription)")
    }
}

Check out our partial synchronization documentation (Objective-C, Swift) for more details.

All permissions operations (retrieving permissions, applying or revoking permissions, creating or accepting permission offers) are now carried out declaratively via APIs on RLMSyncUser. The deprecated ROS 1.0 permissions system requiring permission and management Realms to be manually opened and inspected has been removed. See our documentation on access control (Objective-C, Swift) for more information.

It is now possible to recover from improperly writing to a synced Realm your user doesn’t have read privileges for. A system, much like that for handling client reset errors, has been added, allowing you to safely delete a Realm which has been improperly written to and re-opening it without restarting your application. Check out our documentation (Objective-C, Swift) for more information.

The asynchronous callback when SyncUser.logIn() completes now runs on the main queue by default. This means that you can make changes to your application’s UI directly from the completion handler without needing to dispatch back onto the main queue, and functionality which depends on an active run loop existing on the current thread should work as expected (for example, retrieving permissions or registering notifications on collections).

Realm Object Server administrators who use the -retrieveInfoForUser:... API to retrieve information about a ROS user will now get metadata about the user stored on the server, as well as a list of all authentication provider accounts associated with that user.

API changes

A number of previously deprecated APIs have been removed. In particular, APIs related to sorting results that take a property name have been removed; please use the corresponding APIs that take a key path instead.

Some Swift APIs have been renamed in order to match naming conventions introduced by Swift 4. For example, you must now call observe() instead of addNotificationBlock() on a collection to observe changes, and invalidate() rather than stop() on notification tokens when you wish to stop observing.

Our change log has a comprehensive table detailing what APIs have been removed or renamed, as well as what APIs should be used instead. We have also added Xcode fix-its for Swift APIs that have been changed to make migrating your applications as painless as possible!

Other improvements and bug fixes

Please check out our change log for a full list of improvements. We’ve highlighted a few below, but there are quite a few others that might be of interest!

Swift Object comparison behavior has been updated to match the behavior of RLMObject and respect Foundation’s equatable and hashable requirements. In particular, objects are only checked for equality if a primary key is defined, and it is no longer possible for two objects that are considered equal to return different hash values.

For users using Swift 4, we’ve changed List to conform to the MutableCollection protocol instead of RangeReplaceableCollection. The latter protocol required us to define an empty initializer which didn’t make sense for List’s semantics and produced surprising behavior (for example, when concatenating lists). We’ve added overloads for all the RangeReplaceableCollection default methods that make sense for List. In almost all cases this change should have no effect on your application code.

We’ve also updated the way query predicates using BEGINSWITH, ENDSWITH, and CONTAINS work when their right side operand is nil, an empty string, or data object, to match Foundation’s behavior.


Thanks for reading. Now go forth and build amazing apps with Realm! As always, we’re around on the Realm Forums, Stack Overflow, GitHub, or Twitter.

Read more

Realm Everywhere: The Realm Platform Reaches v2.0

by /

We’re pleased to announce the general availability of Realm Platform 2.0. It’s a major step in the evolution of Realm, and brings many new features and improvements that make it easier to build great mobile apps with modern, collaborative features. It’s also a name change, for us — reflecting the progress we’ve made towards running on every major mobile, server, and desktop platform.

Our goals for this 2.0 release are to make the Realm Platform even more useful, especially for the customer use cases we see most often: building offline-first features and apps, mobilizing legacy databases, coordinating RESTful backends, delivering real-time performance plus collaborative features, and moving the server closer to your users with edge computing.

Why Customers Use Us Today

With Realm, your users don’t see the spinning wheel of boredom while waiting for data. Thanks to our real-time data sync engine, you simply write the code that interacts with objects, and the Realm Platform gets that data where it needs to go. It’s what Thread Learning relies on to build software for autism educators that won’t leave any child behind.

Bringing full-featured offline functionality to apps used to mean endless battles with serialization and caching. But by building with Realm, Arccos and Cartasite have delivered offline-first apps that their users will always be able to rely on.

And when you’re building the mobile future but have to incorporate existing backends, Realm has been there to help developers with a RESTless interface for their legacy APIs, and plug-and-play data connectors that make even the biggest Postgres databases mobile-accessible.

Finally, Realm’s building the future of mobile at the edge. Our recently announced partnership with Ericsson will let us evolve the Realm Platform so that countless devices can flexibly connect, compute, and roam between networks, cell towers, and other points of access.

 

The Realm Object Server: Easier, Faster, and More Stable

To make it as easy as possible to deliver these great mobile experiences, we’ve got three big changes to announce for Realm Platform and Realm Database developers.

We’ve completely re-architected the Realm Object Server to make it more stable, scalable, and modular than ever before. And by moving to npm, it’s now easier than ever to install. To get a new server running, you just need to enter two lines in your terminal:

npm install realm-object-server -g
ros start

We’re also happy to announce our new universal developer tool: Realm Studio. It brings the powerful data exploration tools from Realm Browser together with the ease-of-use and universal access of the Realm Dashboard — so that all our users can use it, on any platform. Open local and synced Realms, manage users and permissions, and watch your server logs in a great desktop app. Today, we’re launching Realm Studio for macOS, Windows, and Linux.

We’ve made huge gains in stability and performance, too. Our Enterprise Edition customers can now benefit from High Availability, thanks to a new synchronous backup system with automatic failover. We’ve also introduced stable object IDs and log compaction to make syncing faster and more reliable than ever before, even after prolonged offline use. And by shrinking the core of the Realm Object Server, we make it easier than ever for you to add functionality to ROS, and to add ROS integrations to existing systems.

Bringing the Realm Platform to v2.0 means great apps are easier to make than ever before. Add offline-first design, real-time sync, and the ability to connect your legacy systems and databases with Realm, and see what your mobile future looks like.

Read more

The rise of Kotlin and other mobile dev trends: Realm Report, inaugural edition

by /

With our growing community of over 100,000 active Realm developers, more than 3.5 billion installs on devices worldwide, and one of the mobile industry’s most popular content sources in Realm Academy, we have a unique point of view on the mobile development landscape. Today we’re publishing the first edition of the new Realm Report, a quarterly publication that draws upon that perspective to share data and insights covering the most interesting developments in the world of mobile dev. Our intention is to report on what’s happening with mobile development right now, and provide our predictions of where things are going in the future.

Topics for Realm Report will vary, but for the first edition, we’re diving deep into the geography of mobile, and showing that the rise of Kotlin is happening faster than you’d think. In the report you will learn about:

  • The current state of mobile development landscape
  • Kotlin’s current boom and seemingly inexorable path toward overtaking Java
  • iOS and Android development trends
  • And — take a guess — which country has the world’s most advanced mobile developers?

Is there something you’ve always wondered about the world of mobile dev? Let us know on social, and we’ll see about including those insights in our future editions.

Read more

Welcoming Ericsson Ventures as a New Strategic Investor

by /

Today we’re very excited to announce a strategic investment agreement with telecommunications giant Ericsson. As we’ve met with and come to know the teams at Ericsson, we’ve become admirers of their vision for the 5G and edge computing future. The success we’ve had to date working with mobile developers, and our own vision for how Realm’s database, synchronization, and serverless technologies enable the next generation of mobile and IoT apps makes the relationship with Ericsson perfectly complementary. The projects we’re working on together are very intriguing, and we’re looking forward to sharing more here in the near future.

Along with this investment from Ericsson, we’re also pleased to announce additional participation from our existing investors, Khosla Ventures and Scale Venture Partners.

Read more

Enterprise Leader, CI&T, Leverages Realm to Expand Their Clients’ Feature Portfolio

by /

Developers are usually happiest when they get to choose the app technologies they use on their projects. This is not always the case within a company. Often clients dictate the technology their agency uses and sometimes the agency gets to select or recommend technology choices to the client. At CI&T, a global digital solutions partner headquartered in New York with offices around the globe, developers have had the freedom to make these choices and implement their preferred technologies to solve their clients’ challenges.

CI&T has been the leader in lean digital transformation and high quality execution and helps fuel innovation within large enterprises. They have an impressive portfolio of clients, including Coca-Cola, Google, Johnson & Johnson and many more. And they employ over 2,500 digital business experts and engineers in 5 continents!

Their team in Brazil has been a long-time advocate of Realm and had the opportunity to propose using Realm Mobile Database in a recent project with a large Brazilian financial institution. The client closely monitors consumption and processing cost, so when CI&T proposed a new feature they got in touch with the mainframe team to run some tests. The results were heavily increased processing costs that would make the release of the new feature unfeasible. But the turning point was when CI&T’s development team noticed through proof of concept that using Realm as a caching layer would drastically reduce mainframe processing costs. The client approved the use of Realm as long as the proprietary framework encapsulated and managed all data access.

“Now that we have Realm set up, it is so much easier for us to explore new features and propose new use cases for our client’s applications.” Rafael Lobato, Systems Architect, CI&T

Once the client saw success using Realm as the caching mechanism, it became easier for CI&T to suggest other new features. The client is now using Realm on their flagship app.

“Our team is responsible for overall app strategy and guidance for new projects. We make suggestions on which frameworks the team uses and Core Data is not one of them.” Salmo Roberto da Silva Junior, iOS Developer, CI&T

What’s Next

The CI&T team is looking forward to trying out the Realm Mobile Platform, particularly the two‑way data sync and real-time collaboration features. Using Realm as the synchronization platform would open up endless opportunities on the feature front for their clients.

They are also planning to develop some documentation, examples and internal repos to show the broader CI&T team how Realm works and how they could quickly incorporate it into other client apps.

More about CI&T

CI&T, the digital technology solutions partner for the world’s biggest companies, is a pioneer at delivering speed-at-scale through the application of design thinking, lean methodologies and advanced tech, including Machine Learning/AI, Advanced Analytics, Cloud and Mobility. For over 20 years, CI&T has been a trusted partner for the most complex global engagements inside companies including Coca-Cola, Johnson & Johnson, AB-InBev, and Motorola. With over 2,500 digital business strategists, designers and engineers in the USA, Brazil, UK, Australia, Japan and China, CI&T is big enough to scale to the needs of Fortune 100 clients yet agile enough to achieve the speed-to-market today’s customers demand. For more information, visit www.ciandt.com.

Read more

Cartasite Delivers Industrial IoT with Realm Mobile Platform

by /

Offline-first app for heavy industries seamlessly syncs field data with backend systems

 

Two months is a lightning-fast timeframe to develop a mobile IoT system that includes data sync and offline-first capabilities at it’s core. Yet the CTO and engineering team at Cartasite took on the bold challenge of doing just that. Using Realm Mobile Platform, they not only met the deadline, but surpassed their original expectations. The team delivered a stable, field-ready system with a user experience that was so fast and fluid, it blew even their CEO’s mind.

It all started when one of Cartasite’s clients needed to build a new field management tool for their water hauling business. Using a sensor installed on water trucks, Cartasite designed an IoT solution that would automatically track a wide variety of measurements during transport, from point of collection to disposal. Their fieldFLOW system would make it easier and safer for drivers to report on their loads through a simple mobile application.

Fast development, fast UX on Realm

From the beginning, the Cartasite team wanted to replace their existing underlying database architecture to create a faster, smoother, offline-first user experience. They knew that Realm could help them quickly test ideas, so they decided to try a proof-of-concept using Realm Mobile Platform. The team and their CEO were so impressed with the speed and “magic” of Realm that they proceeded to build out their new product on the platform.

“The very first time we connected to the Realm Object Server, it just worked. Everything else from that point on was pretty much just rock solid.” Chris Chares, Senior Mobile Engineer, Cartasite

An easier way to ensure network resiliency

Offline functionality is critical for field operations, and Cartasite needed the fieldFLOW system to function seamlessly in unpredictable network conditions. Realm’s offline-first architecture enabled the team to meet their client’s needs without having to deal with massive amounts of networking code. Realm’s client-side database makes current app data always available to the end user, providing a great offline experience with data input and access, as well as UI features, such as autocomplete search.

“If Realm was just an offline database, then I’d be happy to never use Core Data again. But the syncing functionality of the Realm Object Server is really quite incredible.” Chris Chares, Senior Mobile Engineer, Cartasite

Automatic data synchronization across platforms

When network connectivity is restored, the Realm Mobile Platform instantly syncs data updates in the background without disrupting the user’s flow. The platform’s data synchronization capabilities enabled the Cartasite team to bypass the time-consuming tasks of building, testing, and debugging complex networking code. With Realm, testing was easy. The team was able to put a lot of their business logic into the model layer and quickly spin up in-memory Realms to test against.

“Synchronization code is a minefield of potential bugs, and I don’t think we’d have anywhere near the level of stability we have right now if we couldn’t lean on Realm to handle that for us.” Chris Chares, Senior Mobile Engineer, Cartasite

Realm’s cross-platform architecture saved Cartasite even more time by providing them with one set of schemas for iOS, Android, and JavaScript that really simplified the business logic, as well as only one central server to manage. This enabled the team to significantly streamline their code and further reduce development complexity.

“By adopting the Realm Mobile Platform, we were able to reduce our mobile application code by 40%.” Laura Thompson, Senior Software Engineer & Architect, Cartasite

On-time delivery, in partnership with Realm

During development, Cartasite was able to partner with Ream’s technical support engineers to troubleshoot issues quickly, helping them meet their ambitious delivery timeline. By the end of the project, Cartasite had discovered a kinship in Realm’s approach to customer collaboration, which mirrored their own organization-wide focus on customer success.

“We feel that our experience with Realm is the kind of experience that we try to share with our customers. So that’s been the most positive thing.” Bill Sinclair, CTO, Cartasite

Ultimately, the time saved by building with Realm was put to good use. The Cartasite team had the freedom to focus on designing and developing the best possible product for their client within an accelerated timeline. And a great product means time saved on the road with more efficient, safer hauling operations.

Read more

Introducing .NET Core Support for Realm

by /

Today we’re pleased to introduce .NET Core support on Realm. Developers can now build apps with Realm Mobile Platform using C# on both the client and server side for a complete end-to-end C# developer experience with Realm.

What is .NET Core?

.NET Core is the next evolution of the .NET platform, ideally suited to modern server-side development practices. With .NET Core, .NET developers can now build server-side apps that embrace the following requirements:

  • Cross platform (Linux, macOS, Windows)
  • Docker container support (as a result of .NET Core running on Linux)
  • Microservice architectures
  • High performance and scalable systems
  • Running apps side-by-side on the same server using different .NET versions
  • .NET Core uses many of the same .NET platform components as the .NET Framework so you can share code across the two.

.NET Core support for Realm

With Realm .NET Core support, you can now integrate Realm on the server backend using C#. (as an alternative to using our Node.js binding). Realm customers who specialize in .NET have expressed great interest in the addition of .NET Core support; these customers can now use a familiar framework while building the server-side components of their mobile apps. For instance, customers can now deploy scalable, Docker container-based microservices, all while using .NET and Realm. We’re excited to support this new framework because it represents a dramatic expansion in capabilities for our .NET community of developers who are interested in adopting the latest development practices.

By adding .NET Core support to the existing capabilities of the Realm Platform, it is also possible for an organization that prefers C# to use C# throughout their entire application supporting both client-side and server-side development. You can build cross-platform apps for iOS and Android using Xamarin while also using .NET Core on the server to integrate existing backend systems with Realm. The Realm Platform seamlessly two-way syncs data between the client devices—regardless of platform—and servers in realtime, allowing you to create a common data layer for your app. Our realtime two-way synchronization platform makes it easy to build modern reactive apps so that you can focus on creating a differentiated UX for your users.

“We love the simplicity of Realm and the speed of .NET Core; we’re excited that with Realm .NET Core support we can leverage both to bring the highest levels of performance to our backend microservices.” - Laura Thompson, Senior Software Engineer, Cartasite LLC

We want to make it easy for developers to work with the programming languages they are most comfortable with and the introduction of .NET Core support allows us to provide a complete end-to-end C# experience for our developer base.

If sync isn’t your fancy, Realm Database with .NET Core is also powerful tool. Now .NET developers have access to a performant and lightweight object database that works cross platform with .NET Core. You can easily deploy Realm as the standalone datastore for your apps built with .NET Core running on Windows, Linux, or macOS.

It’s easy to get started, it’s just like building for your Xamarin apps when you’re working with .NET Core. See Realm Xamarin documentation for more details.

We’re proud of what we’re shipping today, however, we have much more in store. In coming releases, we plan to launch the Global Notifier and the Data Adapter for .NET Core that will allow you to integrate event handling into your app and fault-tolerant data transfer with legacy database systems. Realm Mobile Platform Support for two-way data sync on Windows is also on the way. These additional features will be available in late 2017.

Read more

Realm Helps Integral Studio Bring their Creativity to Life

by /
Fast deployment, realtime experiences, creative flexibility

At the intersection of analog and digital lies a golden opportunity for musicians and their fans. Integral Studio is dedicated to bringing artists and audiences closer together and building one-on-one relationships through digital media. Based in Los Angeles, the digital management company is on the forefront of developing innovative mobile fan apps for the music world.

 

With a team of creative technologists, Integral Studio aims to build rich, reactive mobile user experiences that best represent each artist’s brand. In addition, the agency strives to deliver the hottest new content to fans as quickly as possible. Fundamental to making these possible is a smooth, fast flow of data between an ever-growing install base of apps and robust data storage on the backend.

Realm enables continuous creativity

Integral Studio’s founders needed technology solutions that gave them creative flexibility and helped them focus their lean team on innovation. When it came to data management, they wanted to avoid the headaches of setting up and maintaining their own database using a typical SQLite, ORM, or JSON solution. They found these to be slow and costly, requiring them to pour time, energy, and manpower into developing and maintaining a database that may not meet their performance requirements.

From the beginning, the company chose Realm Platform as their core data solution. Realm was robust enough to support their most creative ideas and power the snappy, fluid UX needed in their reactive apps. In addition, Realm Mobile Database was easy to integrate into app code and the Realm Object Server offered a centralized place to manage their client app portfolio.

“We use Realm Mobile Platform for all our data handling and management. It’s the core component that ties everything together. Realm is well-designed and easy to use—I couldn’t imagine having to build all the different pieces from scratch.”
Spencer Schoeben, CTO & Co-Founder, Integral Studio

Realm’s responsive, object-oriented database enables the team to realize their vision of providing a personalized experience for music fans. They can easily segment app users and push different content to individuals—a complex feature that would have otherwise been too difficult to accomplish. For example, artists are able to target those fans who attended a certain concert and provide exclusive or early access to such things as limited edition products and videos.

“Having objects represent data makes it super easy for me understand because I’m working with objects all the time. I can build out all of the logic for a local Realm, then add in the syncing… and it all just works as expected.
Megh Vakharia, CPO & Co-Founder, Integral Studio

Integral Studio can also quickly respond to client change requests, thanks to Realm’s flexibility and ease of use. This is especially important, as both artists and users want their app experience to be as current and dynamic as possible. Therefore, artists often provide spontaneous or changing directions to evolve their app’s features and content. In addition, Realm’s realtime functionality and scalability easily supports use cases that are impacted by heavy demand. For example, sometimes apps will offer popular new products that can sell out within seconds.

“Because we launched with Realm, I knew realtime would be easy going forward. So we’re able to bring new realtime features to products much sooner than I would have otherwise imagined.”
Spencer Schoeben, CTO & Co-Founder, Integral Studio

Ready to imagine the future with Realm

For Integral Studio’s creative team, Realm helps them stay innovative with every new project and push mobile experiences to the limits of their imagination. New ideas, such as single sign-on across artist apps or UI customization options, seem entirely possible for the maverick young startup. Integral Studio is confident that Realm’s flexibility will support any data-driven experience they can build, and that Realm Platform will seamlessly scale alongside the growth of their creative portfolio.

“I don’t have to worry about how things are going to be architected or built, I can just think without boundaries. With Realm at the center of our realtime data flow, we can plan ahead for things that we haven’t even thought about yet.”
Megh Vakharia, CPO & Co-Founder, Integral Studio

Read more

Keeping your edge as a mobile developer: Announcing Realm Academy

by /

At Realm, we consistently hear that one of the biggest challenges facing today’s developers is around keeping their edge. With the constant emergence and evolution of new languages and frameworks, best practices, technologies, and architectures, how can a busy professional dev keep up? The traditional methods for professional learning and inspiration—conferences, local meetups, and finding content across the web and social media—are great, but just aren’t enough. Despite requiring a big investment in time, money, and legwork, they still fall short at providing the depth and breadth of content pro devs really need.

Today, to help solve this problem, we’re launching Realm Academy, a new resource that brings together more than 850 pieces of unique developer content from the very best experts in mobile. These are highly practical videos, articles, and tutorials from top conferences, top authors, and community leaders who want to share what they know. We create and capture these at the highest quality levels, enhance them with transcripts and other features, and most importantly curate, organize, and publish them to make them easy to find, easy to use, and easy to share. The collection grows with new content published several times every week, and the features we are launching with today are just the beginning.

So, need to get up to speed on the hottest thing in Android dev, Kotlin? Take a look at the new Kotlin Learning Path, a set of eight pieces of content from experts like Donn Felker, Jake Wharton, and Hadi Hariri. Or maybe you want to get deeper on iOS programming paradigms? We’ve got a Learning Path that includes Natasha the Robot’s session on Practical Protocol-Oriented-Programming and Rob Napier on Functional Programming. And if you just want to browse the new sessions from AltConf 2017 or learn everything you need to know about MVVM, that’s easy too.

Getting the Most from Realm Academy

The home page is the launching off point to everything Realm Academy, and the place to check in on what’s new. At the top of the page, you’ll see links taking you off to major Academy sections organized around key categories, including platforms Android, Apple, JavaScript, and Xamarin, plus Realm of course; and focus areas like Architecture and Scaling. As you scroll the page, you’ll see content curated into both Topics and Learning Paths. Topics are collections of all related content, designed for browsing and serendipity—you can find an in-depth answer to a question, but you are as likely to be surprised and inspired by a best practice you didn’t know about before. Learning Paths are smaller and much more focussed—serial collections of content curated to take you point-by-point to a specific topical destination. You’ll also see content organized by event, so, for example, you can see in one place all the content from DroidCon Boston, TrySwift Tokyo, or other conferences.

We’ve got dozens of pieces of new content in process, and much more planned in terms of new Realm Academy features and enhancements, so we recommend checking back often. Or even better, sign up for the Realm Newsletter, which will bring you updates on Realm Academy, new content, and new mobile tech. You‘ll find a field for subscribing on every page.

Join the Realm Community

Realm Academy content comes out of our partnerships with some of the best developers and best developer conferences of the world, contributions from top members of the Realm community, and our own experts here at Realm. We’d love to feature your content too! Send your content contribution proposals—and any other thoughts—to the Realm Academy Team.

Read more