Using Hoodie as hapi plugin

Here is an example usage of Hoodie as a hapi plugin:

var Hapi = require('hapi')
var hoodie = require('hoodie').register
var PouchDB = require('pouchdb-core')

var server = new Hapi.Server()
  host: 'localhost',
  port: 8000

  register: hoodie,
  options: { // pass options here
    inMemory: true,
    public: 'dist',
    PouchDB: PouchDB
}, function (error) {
  if (error) {
    throw error

  server.start(function (error) {
    if (error) {
      throw error

    console.log(('Server running at:',

The available options are

option default description
PouchDB PouchDB constructor. See also custom PouchDB builds '.hoodie' Data path
paths.public 'public' Public path
adminPassword Password to login to Admin Dashboard. Login is not possible if adminPassword option is not set
inMemory false If set to true, configuration and other files will not be read from / written to the file system
client {} Hoodie Client options. client.url `` is set based on hapi’s ``
account {} Hoodie Account Server options. account.admins, account.secret and account.usersDb are set based on db option above
store {} Hoodie Store Server options. store.couchdb, store.PouchDB are set based on db option above. ``store.hooks.onPreAuth` ` is set to bind user authentication for Hoodie Account to Hoodie Store
plugins [] Array of npm names or paths of locations containing plugins. See also Hoodie plugins docs
app {} App specific options for plugins