Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (30 sloc) 1.77 KB


The surprisingly simple way to write CouchApps.

  • Flexible - a lightweight CommonJS environment
  • Reduces code fragmentation - by bringing the client-side and server-side together
  • Automatic history support - adds pushState and hash-based URLs automatically
  • Searchable and degradable - add Google-indexable pages and support clients without JavaScript
  • Familiar - all this can be done by using the CouchDB design doc APIs


The Idea

With a normal CouchApp, you define the behaviour of your app in a design document which you push to CouchDB. This can describe URL patterns, validation rules and even respond dynamically to requests using show and list functions.

This allows CouchDB to communicate with the browser according to the rules defined in your design document. Being able to host an application directly from CouchDB removes a whole layer from your stack, and is one of the main attractions of using a CouchApp.

To do more complex operations and provide a nicer interface, CouchApps usually involve a lot of client-side code. This means repeating lots of logic from the design document using Sammy.js, Evently or a number of other JavaScript frameworks.

This isn't very DRY!

But wait a moment! The design doc is just JSON and our functions stored there are plain JavaScript... with a little work it should be possible to implement much of the design doc's API, in the browser. Meaning we can re-use our functions and cut out the extra client-side code!

The simple idea behind Kanso is to support the design doc API in the browser. You're already defining much of the application's behaviour in the design doc, why should you have to redefine it all over again?