Firebase still uses MongoDB

What are my options for saving data when using React Native? (iOS and Android)

Here's what I learned from figuring out how to best get on with some of my current app projects.

Async storage ("built in" in React Native)

I use AsyncStorage for an in-production app. The storage remains local on the device, is unencrypted (as mentioned in another answer) and is lost if you delete the app. However, it should be saved as part of your device's backups and will be preserved during upgrades (both native upgrades such as TestFlight and code upgrades via CodePush).

Conclusion: local storage; You provide your own sync / backup solution.


Other projects I've worked on have used sqlite3 for app storage. This gives you a SQL-like experience with compressible databases that can also be pushed to and from the device. I have no experience of syncing them to a back end, but I imagine different libraries exist. There are RN libraries for connecting to SQLite.

Data is stored in your traditional database format, with databases, tables, keys, indexes, etc. stored in a binary format on disk. The data can be accessed directly from the command line or through apps with SQLite drivers.

Conclusion: local storage; They provide synchronization and backup.


Firebase offers, among other things, a noSQL database in real time and a JSON document storage (such as MongoDB) with which 1 to n clients can be synchronized. The documents speak of offline persistence, but only for native code (Swift / Obj-C, Java). Google's own JavaScript option ("Web") used by React Native does not provide a cached save option (see Update 2/18 below). The library is written with the assumption that a web browser will connect, and therefore a semi-persistent connection will exist. You could probably write a local caching mechanism to complement the Firebase memory calls, or you could write a bridge between the native libraries and React Native.

[Update 2/2018] I have since found that React Native Firebase offers a compatible JavaScript interface for the native iOS and Android libraries (which Google probably could / should have done). You get all the benefits of the native libraries with the bonus of React Native Support. With Google's introduction of a JSON document store alongside the real-time database, I'm giving Firebase a good second look at some real-time apps that I want to create.

The real-time database is saved as a JSON-like tree that you can edit on the website and easily import / export.

Conclusion: With the React-Native-Firebase, RN receives the same advantages as Swift and Java. [/ update] Scales well for network connected devices. Low costs with low utilization. Can be combined with other cloud offers from Google. Data are clearly visible and editable via the user interface.


Also a real-time object storage with automatic network synchronization. They advertise themselves as "device first" and the demo video shows how the devices handle sporadic or lossy network connectivity.

They offer a free version of the object storage that you host on your own servers or in a cloud solution like AWS or Azure. You can also create in-memory storage that doesn't exist on the device, device-only storage that won't sync with the server, read-only server storage, and the full read / write option for syncing to an or multiple devices. You have professional and business options that cost more up front than Firebase.

In contrast to Firebase, in React Native and Xamarin all realm functions are supported, just like in Swift / ObjC / Java (native) apps.

Your data is tied to objects in your code. Because these are defined objects, you have a schema and version control is a must for code security. Direct access is possible using the GUI tools provided by Realm. Data files on the device are cross-platform compatible.

Conclusion: device first, optional synchronization with free and paid tariffs. All functions supported in React Native. Horizontal scaling more expensive than Firebase.


I honestly didn't play with it that much, but I will in the near future.

If you have a native app that uses CloudKit, you can use CloudKit JS to connect to your app's containers via a web app (or in our case React Native). In this scenario, you would likely have a native iOS app and a React native Android app.

Like Realm, data is stored locally and, if possible, synchronized with iCloud. There are public stores for your app and private stores for each customer. Customers can even share some of their stores or properties with other users.

I don't know how easy it is to access the raw data. The schemes can be set up on the Apple website.

Bottom line: great for Apple-related apps.

Couch base

Big name, lots of big companies behind it. There is a Community Edition and an Enterprise Edition with the standard support costs.

They have a tutorial on their site where they can link things to React Native. I didn't spend a lot of time on it either, but it seems like a viable alternative to Realm in terms of functionality. I don't know how easy it is to access your data outside of your app or the APIs you create.

[Edit: An older link was found that deals with Couchbase and CouchDB, and CouchDB may be another option to consider. The two are historically related, but currently completely different products. See this comparison.]

Conclusion: Looks like realm's capabilities. Can only be used for devices or synchronized. I have to try it out.


I'm using this server side for part of the app that uses AsyncStorage locally. I like that everything is stored as JSON objects, which makes it very easy to transfer to the client devices. In my use case, it is used as a cache between an upstream TV program data provider and my client devices.

The data is not tightly structured like a schema, so each object is stored as a "document" that is easy to search, filter, and so on. Similar JSON objects can have additional (but different) attributes or child objects that allow: a Lots of flexibility in structuring your objects / data.

I have not tried any client-server synchronization functions, nor have I used any embedded functions. React native code for MongoDB is available.

Conclusion: Only local NoSQL solution, no obvious synchronization option like Realm or Firebase.

[Update 2/2019]

MongoDB has a "product" (or service) called Stitch. Since clients (in the sense of web browsers and phones) shouldn't communicate directly with MongoDB (this is done through code on your server), they created a serverless front-end that your apps can communicate with in case you want to use their hosted solution ( Atlas). Your documentation suggests that there is a possible synchronization option.

This December 2018 article explains how to use React Native, Stitch, and MongoDB in a sample app. You can find more examples in the document (

Twilio Sync

Another NoSQL option for synchronization is Twilios Sync. From your site: "With Sync you can scale the status on any number of devices in real time without having to manage back-end infrastructures."

I saw this as an alternative to Firebase for one of the projects above, especially after speaking to both teams. I also like their other communication tools and have used them to send SMS updates through a simple web app.

[/To update]

[Edit] I've spent some time with Realm since I originally wrote this. I like that I don't have to write an API to sync the data between the app and the server, similar to Firebase. Serverless features also seem to be very helpful with these two as they limit the amount of backend code to be written.

I love the flexibility of the MongoDB data store, so I went for the server side of web-based and other connection-requiring apps.

I found RESTHeart, which creates a very simple, scalable RESTful API for MongoDB. It shouldn't be too difficult to create a React (Native) component that reads and writes JSON objects in RESTHeart and then passes them to / from MongoDB.

[Edit] I added information about how the data will be saved. Sometimes it is important to know how much work there is in development and testing when you need to optimize and test the data.

[Update 2/2019] I experimented with several of these options when designing a project with high parallelism last year (2018). Some of them mention limits for hard and soft parallelism in their documentation (in my opinion Firebase had a hard limit at 10,000 connections, while Twilios, according to discussions with both teams at AltConf, was a soft limit that could be exceeded).

If you're designing an app for tens of thousands of users, you can scale the data backend accordingly.