PouchDB - a pocket-sized database that syncs
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.