Jan Lehnardt: Very fast development with Hoodie

Orde Saunders' avatarPublished: by Orde Saunders

Jan Lehnardt (@janl) was talking about Hoodie at Scotland.js, these are my notes from his talk.

Team hoodie

  • @caolan - Async
  • @gr2m - UI
  • @janl - Couch DB
  • @fffux - Comms
  • @espylab - Funky web stuff
  • @svnlito - Bower

Why hoodie is

Back end work was all baloney and lame, it was a pain in the ass to get going. Things have changed with Git, Rails, Heroku - we can deploy a back end with a git push. Back end is now abstracted to APIs and services. We can do more work in less time. In the front end we have more great tools but we still need a back end.

Options:

  1. Build it yourself.
  2. Get someone else to do it.
  3. Give up

If you're a front end dev it's not possible to master all the things you need to do to build a back end.

  1. sign up users
  2. admin useers
  3. create a record
  4. ???
  5. BORING!

Why can't you just do hoodie.account.signUp(...)? With hoodie you can. Hoodie turns the back end stuff into a client side API.

$ hoodie new project
$ cd myappname
$ hoodie start

var hoodie = new Hoodie(); hoodie.account.signUp(...);

That's as difficult as it is!

What hoodie is

Hoodie is offline by default

Data is stored in local browser storage then syncs to the online storage when it's available. This is ideal for slow network connections - you can work synchronously in the local browser and then it stores asynchronously.

Other features

Hoodie can send emails with a simple API call, has events on data such as publish, share and others. Handles user sign up and payments. Some of this is still work in progress.

Deployment

Can be deployed to Nodejitsu with a few commands, also runs on standard Linux. Integrated with Yeoman, Bower, Grunt.

Extensibility

It's not designed to solve your specific problem so it has hooks for extensibility.

Architecture

Front end

  • localStorage
  • hoodie.store
  • Your app: .add() .find() .on()
  • Sync engine
  • REST

Back end

  • REST
  • CouchDB
  • Node Plugins: users, shares, emails, payments, ...

Example: Sending an email

App creates an email -> Stored in hoodie.store -> If (when) there's a conection it will get sent to CouchDB via the sync engine and REST to CouchDB -> Plugins then get their data from CouchDB -> Send the result to CouchDB -> REST -> Sync engine -> App gets result.

Plugins

  • Back end
  • hoodie.app

Published on NPM.

Finally

Open source, Apache licence, on Github. Currently development preview - try it and see if it works for you but don't rely on it. Core is nearly stable.

Can now build data driven apps that work in the real world without the pain of building a back end.

You can create an app that doesn't rely on the server which is infinitely scalable. Then you could charge for the server side features as premium.

Should run in modern browsers with localStorage. CORS isn't required but it's better if you have it.