npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

orchestrate-couchdb

v0.1.2

Published

Pipe CouchDB changes into Orchestrate.io

Readme

Orchestrate-CouchDB

Build Status Coverage Status

NPM

Pipe CouchDB changes into Orchestrate.io, to effortlessly add a search, events, and relations API.

Install

npm install orchestrate-couchdb

Usage

var OrchestrateCouchDB = require('orchestrate-couchdb');

var importer = OrchestrateCouchDB({
  orchestrate: {
    api_key: 'your_orchestrate_api_key'
  },
  couchdb: {
    url: 'http://localhost:5984',
    username: 'bobross',
    password: 'happylittletrees',
    database: 'joy-of-painting'
  },
  map: function (doc) {
    doc.hello = 'world';
    return doc;
  }
});

importer.on('change.success', console.log);

Now whenever the importer successfully writes a document to Orchestrate, it will print a message.

Need to pre-process your data? The map option can contain a function that modifies each document before it gets saved.

Using as a Daemon

You can also run orchestrate-couchdb as a daemon, so it will continue watching your CouchDB node autonomously. To start the web server, just do:

sudo npm install -g orchestrate-couchdb
export ORCHESTRATE_API_KEY=...
export COUCHDB_URL=...
export COUCHDB_USERNAME=...
export COUCHDB_PASSWORD=...
export COUCHDB_DATABASE=...
orchestrate-couchdb
# Now listening to [database]

Now the importer is syncing changes from CouchDB to Orchestrate.io.

Usage on Heroku

To deploy orchestrate-couchdb on Heroku, you'll need the [heroku toolbelt][]. Then:

git clone [email protected]:orchestrate-io/orchestrate-couchdb.git
cd orchestrate-couchdb
heroku create [app-name]
heroku config:set ORCHESTRATE_API_KEY=...
heroku config:set COUCHDB_URL=...
heroku config:set COUCHDB_USERNAME=...
heroku config:set COUCHDB_PASSWORD=...
heroku config:set COUCHDB_DATABASE=...
git push heroku master

Now your app is running on Heroku! To prevent it from idling, scale the process to use two dynos:

heroku ps:scale worker=1 web=0

Options

orchestrate-couchdb takes one argument, an options object. It takes the following arguments, and has the following defaults:

{  
  orchestrate: {
    api_key: process.env.ORCHESTRATE_API_KEY
  },
  couchdb: {
    url: process.env.COUCHDB_URL || 'http://localhost:5984',
    username: process.env.COUCHDB_USERNAME,
    password: process.env.COUCHDB_PASSWORD,
    database: process.env.COUCHDB_DATABASE
  }
}

You can set many of these options as environment variables, or you can pass them directly:

var OrchestrateCouchDB = require('orchestrate-couchdb');

var importer = new OrchestrateCouchDB({
  orchestrate: {
    api_key: 'your_orchestrate_api_key'
  },
  couchdb: {
    url: 'http://localhost:5984',
    username: 'bobross',
    password: 'happylittletrees',
    database: 'joy-of-painting'
  }
});

Events

  • connect: When the watcher begins listening, but before any changes are received.
  • change: Emitted whenever processing a change starts, succeeded, and errors out.
  • change.start: Detected a change in CouchDB.
  • change.success: Writing a document to Orchestrate.io succeeded!
  • change.error: Writing a document to Orchestrate.io failed due to an error.
  • error: The connection to CouchDB experienced an error.
  • drain: The queue has run out of changes to process.

Tests

npm test

License

ISC, yo.