Session management middleware for connect
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test v1.0, work with nodejs v0.10, connect 3 & express 4 Jul 2, 2014
.gitignore gitignore Aug 11, 2012
.npmignore add .npmignore file Feb 28, 2011
.travis.yml fix travis nodejs versions Jul 2, 2014
LICENSE extend documentation about yacw options Jul 2, 2014
index.js initial commit Feb 27, 2011
package.json v1.0, work with nodejs v0.10, connect 3 & express 4 Jul 2, 2014

Connect CouchDB

connect-couchdb is a storage wrapper for the express-session middleware of connect/ expressjs frameworks. Build Status


  • couchdb (tested with v1.5.0)
  • yacw 0.2.x : the couchdb wrapper. Should be easy to use another one.
  • mocha (only for tests)


For node v0.10, Connect v3 and Express v4 you must use the master branch. For olders node version, use others branches.


Via npm:

$ npm install connect-couchdb --save


var session = require('express-session'),
    connect = require('connect');
    ConnectCouchDB = require('connect-couchdb')(session);

var store = new ConnectCouchDB({
  // Name of the database you would like to use for sessions.
  name: 'myapp-sessions',

  // Optional. Database connection details. See yacw documentation 
  // for more informations
  username: 'username', 
  password: 'password', 
  host: 'localhost',

  // Optional. How often expired sessions should be cleaned up.
  // Defaults to 600000 (10 minutes).
  reapInterval: 600000,

  // Optional. How often to run DB compaction against the session
  // database. Defaults to 300000 (5 minutes).
  // To disable compaction, set compactInterval to -1
  compactInterval: 300000,

  // Optional. How many time between two identical session store
  // Defaults to 60000 (1 minute)
  setThrottle: 60000
var server = connect();
server.use(session({secret: 'YourSecretKey', store: store });

If the database specified doesn't already exist you have to create it with tools/ files. Run following command to create database, populate with the design document and setup the CouchDB database specific option _revs_limit :

$ node tools/setup.js <database_name> <revs_limit> [username] [password]

For more informations about the _revs_limit option, read this.

It is highly recommended that you use a separate database for your sessions for performance of both the session views and any other document views you may have.

See example.js file for an example connect server using connect-couch.


Please invoke the tool to create the design documents when updating to insure you are using the last version of the view.

$ node tools/put_design_docs.js <database_name> [username] [password]


$ npm test



$ git shortlog -s -n