PouchDB - a pocket-sized database that syncs

PouchDB is a free open-source database designed to work well within the browser and offline. It was written in JavaScript and inspired by Apache CouchDB.

PouchDB - portable CouchDBPouchDB is a free open-source JavaScript database designed to work well within the browser and offline. It was inspired by Apache CouchDB. In fact, it is successful attempt to create a complete JavaScript implementation of the CouchDB storage and views API that supports peer-to-peer replication with “real” CouchDB instances.

The goal of PouchDB is to assist in building applications that work and store data locally while offline as reliably as they do online. In this way users can use all app features regardless their internet connection and synchronize the data with CouchDB and compatible servers when needed.

PouchDB can not sync with non-CouchDB database, because the backend has to implement a CouchDB-like protocol. There are databases that “speak” this replication protocol:

  • CouchDB – a primary reference database also used for automated testing.
  • Cloudant – a cluster-aware fork of CouchDB.
  • Couchbase Sync Gateway – a sync gateway for Couchbase.
  • IrisCouch – CouchDB in the cloud.
  • PouchDB Server – an HTTP API written on top of PouchDB.

Unlike other similar APIs PouchDB aims at maintaining a high level of consistency guarantees during concurrent user connections. It also keeps a by-sequence index across the entire database. This means that not only PouchDB provides a great way to replicate data from a remote source in the browser, but also enables the same conflict resolution system for eventual consistency across nodes as Apache CouchDB.

In order to support various browsers PouchDB works with different backends. For instance, it uses IndexedDB in Firefox, Chrome, Opera, Internet Explorer; WebSQL in Safari and mobile browsers, and LevelDB in Node.js. The list of fully supported and tested browsers includes Firefox 29+, Chrome 34+, desktop Safari 6+, IE 10+, Opera 21+, Android 4.0+, iOS Safari 7.1+, Node.js. Support of some other mobile browsers and environments is still in progress, like Android 2.x and Apache Cordova.

Apart from extensive browser support and consistency, PouchDB has several other advantages. First of all, it has all the features you can expect from a database, including query results sorting. Secondly, since this database is inside the browser, there is no need to perform queries over the network and queries become faster and more reliable.

Therefore PouchDB is a small JavaScript database especially effective for mobile apps that need a browser-based storage solution capable to be used offline. This Portable CouchDB performs the following set of basic tasks: can run natively in the browser and Node.js, create/delete/query/replicate/sync a database, create/delete/update/fetch documents, and retrieve database information. To know more visit pouchdb.com.

Connect with our experts Let's talk