Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @hoodie/store-server with all npm packages installed. Try it out:

var storeServer = require("@hoodie/store-server")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@hoodie/store-server v3.0.0

CouchDB API for data persistence and offline sync


CouchDB API for data persistence and offline sync

Build Status Coverage Status Dependency Status devDependency Status

hoodie-store-server is a Hapi plugin that implements CouchDB’s Document API and exposes a JavaScript API to manage databases, access and replications.


var Hapi = require('hapi')
var hoodieStore = require('@hoodie/store-server')
var PouchDB = require('pouchdb')

var server = new Hapi.Server()

  port: 8000

  register: hoodieStore,
  options: {
    PouchDB: PouchDB
}, function (error) {
  if (error) throw error

server.start(function () {
  console.log('Server running at %s',



PouchDB constructor. Required

options: {
  PouchDB: require('pouchdb-core').plugin('pouchdb-adapter-leveldb')

If you want connect to a CouchDB, use the pouchdb-adapter-http and set options.prefix to the CouchDB url. All requests will be proxied to CouchDB directly, the PouchDB constructor is only used for

options: {
  PouchDB: require('pouchdb-core')
      prefix: 'http://localhost:5984',
      auth: {
        username: 'admin',
        password: 'secret'


Route lifecycle hooks. Optional

options: {
  hooks: {
    onPreResponse: onPreResponseHandler,
    onPreAuth: onPreAuthHandler,
    onPostAuth: onPostAuthHandler,
    onPreHandler: onPreHandlerHandler,
    onPostHandler: onPostHandlerHandler,
    onPreResponse: onPreResponseHandler

See for more information


Local setup

git clone
cd hoodie-store-server
npm install

Run all tests and code style checks

npm test


Have a look at the Hoodie project's contribution guidelines. If you want to hang out you can join our Hoodie Community Chat.


Apache 2.0

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free