PouchDB Tutorial

What is PouchDB ?

It is an open source database, it is an in-browser database API which is written in JavaScript. It allows applications to store the data locally, which lets users enjoy all the features of the application though they are not online. Additionally, there is synchronization of data between clients which keeps users up to date wherever they go. It is a JavaScript implementation of CouchDB. It can be used locally in Node, also in browsers and remotely through HTTP protocol. It is styled off on CouchDB which is a NoSQL database.

What is PouchDB?

To store the data it innately uses WebSQL and IndexedDB.

By default, this database uses IndexedDB adapter for the browser, LevelDB adapter in the Node.js and CouchDB adapter for the remote databases.

We can run it in Node.js and also use it as a direct interface for the CouchDB compatible server. This API is consistent with its working in all environments so we can spend time in writing clean code and not thinking about browser varieties.

How does PouchDB work?

When we are using an application offline then the data is saved locally by the use of WebSQL and IndexedDB in the browser and when the application is online , pouchDB synchronizes it with CouchDB and the compatible servers.

By using PouchDB we can connect with remote as well as local databases easily without perceiving the variations.

What is PouchDB?

Browser support:

It supports all modern browsers by using IndexedDB under the hood and using WebSQL where indexedDB cannot be used. It is supported in the following browsers:

  • 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+

PouchDB can also be run in Cordova or PhoneGap, NW.js, Chrome apps and Electron. It is framework-septic, we can use it with React, Backbone, Angular, Ember or your framework of our choice.

It required a modern ES5 environment, so if wish to use older browsers then we have to inclue es5-shim library. It is not a self contained database it is a CouchDB style abstraction.

Advantages of PouchDB

  • As we know PouchDb lives in the browser, we dont need to execute queries over the network, by which we can observe speedy execution of queries.
  • We can synchronize the data with the supported server by which we can run apps online and offline.

Features of PouchDB

What is PouchDB?
  1. It supports Cross browser, The API pouchDB provides work in various environments which allows us to run PouchDB applications in different browsers.
  2. It is LightWeight API, we can include it very seamlessly by use of script tag.
  3. It is easy to learn if we have a knowledge of any of the programming languages then we can easily learn PouchDB.
  4. It is Open source application and is also available on GitHub.

Lets see some products and services who use PouchDB.

-BikeCommute

- Cloudwall

- Lullabot

-Hoodie

-HospitalRun

-MedicMobile

-NPM Browser

-Quizster and many more.

Alternatives we can use for PouchDB:
  • MongoDB
  • Atlas Redis
  • Couchbase server
  • Amazon DynamoDB

PouchDB Tutorial Index