A generic backend with a client API for Offline First applications
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, check your installed version with node -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": "^22.0.2"
}
}
There might be more properties and 22.0.2
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.
Run npm start -- --help
to see all available CLI options.
Options can also be specified as environment variables (prefixed with hoodie_
) or inside a .hoodierc
file (json or ini).
option | default | description |
---|---|---|
loglevel | 'warn' |
One of: error, warn, info, verbose, silly |
port | 8080 |
Port-number to run the Hoodie App on |
bindAddress | '127.0.0.1' |
Address that Hoodie binds to |
public | 'public' |
path to static assets |
inMemory | false |
Whether to start the PouchDB Server in memory |
dbUrl | – | If provided, uses external CouchDB. URL has to contain credentials. |
data | '.hoodie' |
Data path |
Hoodie is using the rc module to retrieve configuration from CLI arguments, environment variables and configuration files.
Local setup
git clone https://github.com/hoodiehq/hoodie.git
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.