Choosing a Cloudant Library

Which level of abstraction is “just right” for you?

Glynn Bird
Jun 12, 2017 · 4 min read
  • your web page could fetch data directly from the database by making in-page HTTP calls
  • your PHP code could read and write from its data store without any third-party add-on code
Too verbose? Too abstract? Which Cloudant library is “just right” for you? Image credit: twinkl.co.uk

Level 0 — no libraries

If you want to learn the HTTP in detail, then you can choose to use no libraries whatsoever:

Level 1 — an HTTP request library

To help with formulating HTTP requests, there a several third-party HTTP libraries to choose from. I usually go for request, but others are available.

Level 2 — the Nano library

Nano is an open-source project that was donated to the Apache Software Foundation and has become the official Node.js library for CouchDB.

Level 3 — the Cloudant library

The Cloudant library extends Nano to add:

  • a plugin system to allow Promises, retry logic and cookie authentication wrappers to be used
  • official support from IBM Cloudant (it’s the only supported Node.js Cloudant library in this article)

Level 4 — PouchDB

You can use PouchDB as an HTTP-only client too:

Level 5 — the silverlining library

The silverlining library builds on the request library, not on Nano. It provides a different abstraction from the Cloudant API, hiding some of the complexities that confuse first-time users and providing higher-level simplifications.

Alternatives

The great thing about open-source is that you aren’t limited to “official” products. If you don’t like the tools, help improve the open-source offerings by raising issues or submitting code — find alternative tools or build your own! You can choose whether you’re looking for a library that can do callbacks or Promises and whether it allows you to learn the CouchDB API or hides it from you.

IBM CODAIT

Things we made with data at IBM’s Center for Open Source Data and AI Technologies.

Glynn Bird

Written by

Developer @ IBM. https://glynnbird.com

IBM CODAIT

Things we made with data at IBM’s Center for Open Source Data and AI Technologies.