#4 Discover Couchbase: your first app with Couchbase Lite

Couchbase Lite

In the previous articles we had a first look at Couchbase Lite and we discovered how to integrate it into a mobile app.

Moreover, we got aware of Couchbase Sync Gateway in this article for synchronizing data with ease across all our apps installations. With this post I want to finally show you those technologies in action!

The contacts app with Couchbase Lite

For the sake of this series, we developed a sample application for both iOS and Android. This app allows you to create your personal address book with all your contacts, and sync it in real time across all your devices which have the app installed. Contacts are persisted using Couchbase Lite, as we have seen in the previous post. Thanks to the fact that the data are actually saved into the database and not explicitly sent to a remote server, we can work in absence of network without any sort of problems. This ensures a full offline user experience, with no potential lags due to a slow connectivity or any kind of network failures. All the replication is made possible out-of-the-box by the Couchbase library.

Features

Opening the sample app, you will see the list of all the contacts you added into your synced address book. You can add a new contact by pressing the “+” button. Also, by clicking on a list item you can edit the contact info as you prefer. Eventually, you can delete a contact directly from the contacts list.

Demonstration of Couchbase Lite

This video shows a real-time data synchronization between two instances of the same app, running both on iOS and Android. This app acts as a basic address book that allows to manage the contacts of the user. Thanks to Couchbase Sync Gateway, all the data replication process is made possibile with ease.
In particular, when creating, editing or deleting an address book Contact, the change is immediately spread to all the connected devices.

Works like a charm! You can find all the application sources in our GitHub repositories:

As mentioned in the readme files, you need a running Couchbase Server and Couchbase Sync Gateway instances for replicating data. If you don’t have such instances up and running, you may want to have a look at my previous blog post! Let’s setup them on the fly! 

That’s all, thanks for reading and stay tuned for more!

Wir kennen nur ein Fünftel von dem, was in der Tiefe ist. Alles andere muss noch erforscht werden.

coderspace kommt.