node package manager


A generic backend with a client API for Offline First applications


A generic backend with a client API for Offline First applications

  <h2> Hallo <a href="">Hacktoberfest</a> Friends 🐶👋</h2>
    We have some great issues prepared for you to work on, check out our <a href="">Hoodie Camp</a> repository :) If you have any questions or just want to say hi, please ping us <a href="">on Twitter</a> or join our <a href="">Chat</a>. We are looking forward to meet you all! Happy hacktobering!  🙌💻

Hoodie lets you build apps without thinking about the backend and makes sure that they work great independent from connectivity.

This is Hoodie’s main repository. It starts a server and serves the client API. Read more about how the Hoodie server works.

A good place to start is our Tracker App. You can play around with Hoodie’s APIs in the browser console and see how it works all together in its simple HTML & JavaScript code.

If you have any questions come say hi in our chat.

Hoodie is a Node.js package. You need Node Version 4 or higher and npm Version 2 or higher, check your installed version with node -v and npm -v.

First, create a folder and a package.json file

mkdir my-app
cd my-app
npm init -y

Next install hoodie and save it as dependency

npm install --save hoodie

Add a "start" script and set it to "hoodie" in your package.json. The result should look something like this

  "name": "my-app",
  "version": "1.0.0",
  "scripts": {
    "start": "hoodie",
    "test": "echo \"Error: no test specified\" && exit 1"
  "dependencies": {
    "hoodie": "^24.0.0"

There might be more properties and 24.0.0 will likely be a higher number, but that’s okay.

Now run npm start to start your Hoodie app.

You can find a more thorough description in our Getting Started Guide.

hoodie can be used as as CLI (Command Line Interface) or as hapi plugin. The options are slightly different, see below

Once you finished the setup, you can start your hoodie server with

npm start

To pass CLI options to Hoodie, you have to separate them with --, for example:

npm start -- --port=8090 --inMemory

Available CLI options are

option default description
--address '' Address to which Hoodie binds
--data '.hoodie' Data path
--dbUrl If provided, uses external CouchDB. URL has to contain credentials.
--loglevel 'warn' One of: silent, error, warn, http, info, verbose, silly
-m, --inMemory false Whether to start the PouchDB Server in memory
--port 8080 Port-number to run the Hoodie App on
--public 'public' path to static assets
--url - Optional: external URL at which Hoodie Server is accessible (e.g.
-h, --help, --usage - Prints help and available options
-v, --version - Shows Hoodie version

Hoodie CLI is using rc for configuration, so the same options can be set with environment variables and config files. Environment variables are prefixed with hoodie_. Examples: hoodie_port=8090 or hoodie_inMemory=true. Configuration files can be in INI or JSON format and can be placed at different locations. Most commonly you would place a .hoodierc file in your app’s directory, and it can look like this

  port: 8090,
  inMemory: true

The priority of configuration:

  1. command line arguments
  2. Environment variables
  3. .hoodierc files
  4. Your app’s defaults form "hoodie" key in "package.json"
  5. Hoodie’s defaults as shown in table above

You can load hoodie as hapi plugin to use it in your existing hapi application:

var Hapi = require('hapi')
var hoodie = require('hoodie').register
var server = new Hapi.Server()
  host: 'localhost',
  port: 8000
  register: hoodie,
  options: { // pass options here 
    inMemory: true,
    public: 'dist'
}, 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 '.hoodie' Data path
paths.public 'public' Public path
db PouchDB options
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.

Local setup

git clone
cd hoodie
npm install

The hoodie test suite is run with npm test. You can read more about testing Hoodie.

You can start hoodie for itself using npm start. It will serve the contents of the public folder.

Become a backer and show your Hoodie support!

Show your support for Hoodie and help us sustain our inclusive community. We will publicly appreciate your support and are happy to get your word out, as long as it aligns with our Code of Conduct.

Apache 2.0