Beginner’s Guide to PouchDB

Swathi Prasad
4 min readFeb 7, 2021

JavaScript DBMS with an API inspired by CouchDB

Image from freesvg.org

PouchDB is an open source client-side database API written in JavaScript. It is modelled after CouchDB — a NoSQL database that runs within the browser.

If you are not familiar with NoSQL databases, let me give you a short introduction. NoSQL is a term used for high-performance, non-relational databases. It provides a mechanism for storage and retrieval of data other than tabular relations model used in relational databases. These databases utilize a variety of data models, including document, graph, key-value, and column store. Checkout the list of NoSQL databases here.

Using PouchDB API, we can build applications that work offline and online. It uses WebSQL and IndexedDB internally to store the data. It is framework-agnostic, so you can use it with Angular, React, Ember, Backbone, or your framework of choice.

PouchDB supports all the modern browsers. Some of them are Firefox 29+, Chrome 30+, Safari 5+, Internet Explorer 10+, Opera 21+ and so on.

As we know PouchDB can be used as a direct interface to CouchDB-compatible servers. So, let’s set up CouchDB.

Installing CouchDB

If you are using one of the Linux distributions, you can install using the following command.

$ sudo apt-get install couchdb

For Windows, download and install from CouchDB site.

In case of Mac, you can run the following command in the terminal.

$ brew install couchdb

Once it is installed, you can open http://127.0.0.1:5984/ or http://localhost:5984/ in the browser. The response should be something as follows:

{"couchdb":"Welcome","version":"3.1.1", .. }

When you open http://127.0.0.1:5984/_utils/index.html and you will see a screen as follows.

CouchDB home screen

Note: On Mac, if you do not get any response when you open http://127.0.0.1:5984/ in the browser, verify if couchdb service is running using the command:

--

--

Swathi Prasad

Software architect and developer living in Germany. Sharing my opinion and what I learn.