OpenWhisk version of Cloudant Envoy
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A version of Cloudant Envoy that deploys to a IBM OpenWhisk - a serverless computing platform. Having Envoy run in a serverless environment has several advantages:

  • you only pay for what you use
  • the OpenWhisk API system handles authentication, including social media oAuth
  • OpenWhisk handles the traffic scaling


Clone this repository

git clone
cd envoy-serverless

Sign up for a Bluemix account and follow the Getting Started with OpenWhisk guide to download the wsk tool and configure it for your Bluemix account.

In your Bluemix dashboard, create a Cloudant service and make a note of its URL. In the Cloudant dashboard, create a new empty database (say, 'envoydb').


Create two environment variables containing your Cloudant URL and the database name:

export COUCH_HOST=""
export ENVOY_DATABASE_NAME="envoydb"

and run the deployment script:


The URL of your service will look something like this:

You can now visit the "API Management" section of your OpenWhisk dashboard:

  • in the "Definition" tab, tick the box titled: "Require consuming applications to authenticate via API key"
  • in the "Sharing" tab, create an API key


You can test your service with curl:

> curl -H 'x-ibm-client-id: 0bd929c9-c8b7-43f7-856f-f2cbe33b9f50' \ ''
{ ... some json .... }

or from PouchDB:

var PouchDB = require('pouchdb');
var url = '';
var opts = {
  ajax: { 
    headers: { 
      'x-ibm-client-id': '60eaa0b0-0b84-4b02-abb1-726605890233'
var remotedb = new PouchDB(url, opts);

var envoydb = new PouchDB('envoydb')
envoydb.replicate.from(remotedb).on('change', function (info) {
  // handle change
  console.log('change', info)
}).on('paused', function (err) {
  console.log('paused', err)
}).on('active', function () {
}).on('denied', function (err) {
  console.log('denied', err)
}).on('complete', function (info) {
 console.log('complete', info)
}).on('error', function (err) {
  console.log('error', err);