Making PostgreSQL Real Time With Realm
Realm recently launched a PostgreSQL connector, enabling the power of Postgres and real-time data syncs with Realm Mobile Platform.
Join the DZone community and get the full member experience.Join For Free
I recently had a great talk Paul Kopacki, CMO of Realm, a mobile platform that works on devices as a data store that developers may choose versus the default database (Core Data). Realm is an embedded object database that sits on the device and enables developers to write entirely in objects, rather than having to use object-relational mapping.
PostgreSQL is one of the most powerful and popular databases in use today and is increasingly used for systems of record in all types of organizations. This works well for many use cases, but things get difficult when you try to build a modern, reactive app connected to your Postgres database. Postgres is fast, but it’s just not designed for real-time, reactive mobile apps.
But Realm has just introduced a new PostgreSQL Data Connector. This new connector creates a simple two-way bridge between Postgres and the Realm Mobile Platform, effectively making Postgres real-time for mobile apps. Data flows reliably and in a fault-tolerant manner between Postgres and the Realm Platform, which then automatically handles real-time sync with your mobile apps. This means changes made on mobile clients are automatically reflected back to your Postgres database in real time, and data changes made in Postgres sync in real time with client-side databases. You can now easily make truly reactive mobile apps with PostgreSQL and Realm.
Mobile Platforms as an Alternative to REST APIs
The Realm Mobile Platform replaces traditional methods of using REST APIs to get data in and out of backend systems for use in a mobile context. Our automatic real-time sync service efficiently syncs only what has changed in the data model without the need for manual data requests or bandwidth-hogging polling. Realm automatically handles the real-time sync of your native objects—without the need for JSON—between clients and the Realm Object Server (the server-side component of the Realm Mobile Platform). The Realm Object Server can then provide the API integration point between your mobile application and PostgreSQL database to consolidate API management in the backend, where network issues are not a concern. This architecture reduces the number of API calls that each device must make and reduces the need for complex idempotent APIs that can handle unreliable network connectivity.
PostgreSQL Data Connector Demo
This video shows how you can link Postgres and Realm Mobile Platform.
Using sample data from a fictional DVD rental company, we’re able to modify inventory levels via a mobile app or within Postgres and see those changes sync in real time. It’s a simple example of how Realm can dramatically simplify making Postgres real time for your applications.
Realm connects your mobile app and Postgres with automatic real-time sync.
You can visit GitHub for the code and an in-depth overview of how to connect the Realm Mobile Platform and PostgreSQL to create reactive, real-time mobile applications with data stored in PostgreSQL.
Opinions expressed by DZone contributors are their own.