CouchApps are JavaScript and HTML5 applications served directly from CouchDB. If you can fit your application into those constraints, then you get CouchDB's scalability and flexibility "for free" (and deploying your app is as simple as replicating it to the production server).

The original CouchApp command-line tools were created in 2008 / 2009 by @benoitc and @jchris. They still work, and have been feature complete for a long time. Couchapp has been replaced and is compatible with the old couchapp tool. There are also new tools for deploying browser-based apps to JSON web servers and I think PouchDB is the future of browser based sync apps. It can sync with the same sync protocols but uses the built-in storage of HTML5.

Get Started

CouchApp Development Tools

To develop a CouchApp, you will need a way to get your javascript, html and other resources onto your CouchDB instance. Typically this is done with a CouchApp command line tool that maps application assets and CouchDB views, lists, shows, etc into one or more Design Documents.

Curl

The simplest way to develop a couchapp would be to use curl from the command line.

CouchApp command line tool (python)

The CouchApp command line tool is used to generate code templates in your application and to push your changes to an instance of couchdb, among other things. Here is how to get started with the CouchApp command line tool:

CouchApp command line tool (node.couchapp.js)

This is an alternative tooling to the Python couchapp utility that is instead written in Node.js. It uses a much simpler folder structure than it's Python counterpart and is a generally more minimalist/simplified way of writing couchapps. Note that you cannot use Python couchapp to push couchapps written using node.couchapp.js into Couch and vice versa.

erica

erica is an Erlang-based command line tool that is compatible with the Python and Node.js "couchapp" tools.

Kanso

A comprehensive, framework-agnostic build tool for CouchApps.

The Kanso command-line tool can build projects designed for node.couchapp.js, or even the Python couchapp tool, while providing many other options for building your app. These build steps and other code can be shared using the online package repository. Compiling coffee-script, .less CSS templates etc. is as easy as including the relevant package.

"NPM for CouchApps"

Kanso also lets you merge design docs together, which allows reusable components built with any of the available couchapp tools. The Kanso tool can help you manage dependencies and share code between projects, as well as providing a library of JavaScript modules for use with CouchDB.

Kanso Homepage

soca

soca is a command line tool written in ruby for building and pushing couchapps. It is similar to the canonical couchapp python tool, with a number of key differences:

Unlike a traditional couchapp, a soca couchapp is one way - your source directory structure is actually 'compiled' into into the couchapp _design document format.

compile time plugins:

soca on Github

Reupholster

Reupholster is geared for CouchApp beginners and simple CouchApps. What reupholster does is allows you to experience writing a CouchApp as fast as possible, with very little learning curve. It just feels like you are editing a normal web project.

Reupholster Homepage

Javascript Application Programming

All application logic in a couchapp is provided by Javascript. There is a library called jquery.couch.js that is distributed with every CouchDB installation. Here is the documentation for jquery.couch.js

Example Applications

You can download the following applications and try them out yourself.

Pages

The wiki software behind couchapp.org

online

A couchapp for keeping teams on the same page

Sofa

Standalone CouchDB Blog, used by the O'Reilly CouchDB book (note: sofa does not work as well with couchdb 1.0.1 or 1.0.2, the edit and create new pages do not work. Also, there is a different version of mustache.js in the /designdocname/lib directory that is used to render all the _list functions. The normal mustache.js file is in the vendor/couchapp directory. )

TweetEater

A Couchapp which displays tweets harvested from Twitter's streaming API by an accompanying Ruby program.

Other resources

Files attached to Simple JavaScript application hosted in Apache CouchDB: