Why PouchDB and CouchDB?

Article published on: Jan 10th, 2020

Updated on: Mar 27th, 2021

Estimated Reading Time: 2 minutes

Inside weather ej3UoXYMaRI unsplash

Inside Weather

Once I was alerted to the fact that CouchDB existed I was really pleased with how it would fit into the tech stack. Firstly it is Apache Licensed.

It is web tech focussed with a focus on local data and although you can run it on a server, they also have a desktop application which means you can run the whole set up with local connections only, this connects to design principles of data ownership.

A group of makers / designers can just “spin up” and instance of nodenogg.in and there is no need for a centralised source of the data, it is stored on all machines with one of the devices managing sync. The data structure is JSON which is a great structure and also human readable, along with being able to almost mirror Vue data structures.

I installed CouchDB on a centOS box very easily, the other thing that was great was the document model over tables structure model for the data meaning that you can in fact build the schema as you go, this meant that my first few attempts at data structure wouldn’t cause headaches as this could also iterate over time.

PouchDB is a javascript implementation to connect to a CouchDB and the structure mirrors CouchDB. I was also able to quickly use the docs to get a Vue application talking to CouchDB.

The main issue for me was simply understanding where and how to import the library within Vue, there was a bit of time spent on Stack overflow and googling the ways to import libraries, I had some experience with this previously in my other Vue experiments but having also moved to use Vue cli via Vue ui this was much easier to do with the web interface to find and add to project.

I made a little video about the basic set up of my Vue projects at YouTube.

PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.

PouchDB was created to help web developers build applications that work as well offline as they do online.

It enables applications to store data locally while offline, then synchronise it with CouchDB and compatible servers when the application is back online, keeping the user’s data in sync no matter where they next login.

Main take aways