November 28, 2018

PouchDB

This chapter provides a brief introduction to PouchDB along with its features and how it works.

What is PouchDB?

PouchDB is an open source in-browser database API written in JavaScript. It is modelled after Couch DB – a NoSQL database. Using this API, we can build applications that work offline and online. It internally uses WebSQL and IndexedDB to store data.

How Does it Work?

In PouchDB, when the application is offline, the data is stored locally using WebSQL and IndexedDB in the browser. When the application is back online, it is synchronized with CouchDB and compatible servers.

Using PouchDB, you can communicate with both local and remote databases seamlessly without noticing any difference.

Features of PouchDB

Following are the features of PouchDB −

  • Cross Browser − The API provided by PouchDB works the same in every environment, therefore, we can run a PouchDB application in various browsers.
  • Light Weight − PouchDB is a very light-weight API, it is also included easily just using a script tag.
  • Easy to Learn − If you have a prior knowledge of any programming language, it is easy to learn PouchDB.
  • Open Source − PouchDB is an Open Source Application and is available on GitHub.

Advantages of PouchDB

Following are the advantages of PouchDB −

  • Since PouchDB resides inside the browser, there is no need to perform queries over the network, this results in faster execution of queries.
  • You can synchronize the data with any of the supported server and by doing so you can run apps both online and offline.

Browsers that Support PouchDB

Following are the browsers that support PouchDB −

  • Firefox 29+ (Including Firefox OS and Firefox for Android)
  • Chrome 30+
  • Safari 5+
  • Internet Explorer 10+
  • Opera 21+
  • Android 4.0+
  • iOS 7.1+
  • Windows Phone 8+