CouchDB

CouchDB

For a startup who is developing a realtime and offline first messaging and collaboration app we decided to base our architecture on CouchDB. Offline applications hold a local copy of the data. User devices and the server share the data. Hence, they essentially are distributed systems. CouchDB simplifies such architecture as it provides a robust multi-master replication out of the box. It addresses problems inherent with distributed environments like data reconciliation and conflict management.

The design using CouchDB does not need a separate web application to access the data. In this model, CouchDB and PouchDB use CouchDB replication protocol to

– copy the data between the client and the server
– maintain its consistency

It is a state-of-the-art method for achieving consistency of distributed document stores. It guarantees that eventually, all access to a document return last updated value. This paradigm is called as eventual consistency.

CouchDB allows to set up two-way replication of the entire or part of the database. Hence, the web services for transferring data are not required. Other facilities available out of the box are

– basic user management
– authentication
– session management
– basic access control policy

So, CouchDB fulfilled most of the requirements of a web-based application. Separate web services are required only for some specific cases.

We also have PouchDB which is a perfect companion to CouchDB in the mobile world. It is developed entirely in Javascript. Runs on web browsers and mobile platforms. It implements CouchDB replication protocol. Out of the box, it can set up replication with any CouchDB server.