On Managing Applications on Cloudant
A fairly common question we get asked is "how do I manage my view code in
insert your favorite version control system here?". As people develop more
complicated apps this question becomes increasingly important. Fortunately
there are a set of tools that make transferring code from a version controlled
directory into your database easy.
At the heart of Cloudant is Apache CouchDB. Applications that run out of CouchDB are known as "CouchApps". At their most basic these applications are nothing more than a design document containing a view. There are a raft of tools that simplify the development of these applications that are served directly out of CouchDB. They each target slightly different use cases, from a minimal wrapper to upload code into the database to a fully featured development platform.
At the most basic level these tools enable developers to version control their views and other code, and "compile" and push them into the server. More advanced use enables development of "two-tier" applications, pulling in various libraries to build complex, dynamic applications; even ones available offline.
Below is a quick summary of the various tools that let you build and push code from your local system into the database. It's by no means exhaustive, and I'd love any .
- CouchApp.py The original and reference implementation for CouchApp clients this python application is no longer under active development (Benoit has moved on to Erica) but it is still widely used and recieves occasional updates. It turns the structure of a design document into a filesystem layout, mapping the various functions of your application to files in a defined location on your disk.
- Erica Erica is a CouchApp client built in erlang, effectively the next version of CouchApp.py. It has basically the same feature set as CouchApp.py.
- Soca Soca takes a different approach to CouchApp.py/Erica, allowing any directory structure for the app and compiles the application into a single json file following a layout defined in a file, rather than the filesystem itself. It builds applications around Sammy.js by default.
- node.couchapp.js node.couchapp.js is a node application for building CouchApps. It requires all the functions (views, lists etc) of the application be defined in a single json file, with attachments (images, html, external scripts) loaded from a defined location.
- Reupholster Reupholster is a Java application that builds CouchApps in the same style as node.couchapp.js. It provides an end-to-end development tool, managing creation of the application, automated testing and pushing to the server.
- Kanso Kanso is another node application, described as "the NPM for CouchApps". It has a very comprehensive set of packages that enable easy management of various third party libraries and frameworks.
- Situp situp.py is modeled after the python setup.py install script. It is a single self contained file with no dependencies. It's the tool I use for my own applications that I develop on or for Cloudant, but it's also written by me so you'd hope I would use it! It aims to support development of more complex CouchApps, and can pull in Kanso packages.
- Mouch Mouch takes the metaphor of a build file a step further, resulting in a minimal application "for people who love purism. For people who keep complete control over their bytes. For people who love things speeding fast, keeping dependencies as minimal as possible."
CouchDB has supported running applications out of the database since 2009, and the associated tools are in a reasonable state of maturity. It's nice to see other databases getting similar functionality now; it can only be a benefit to developers creating two-tier, dynamic applications.
For very simple tasks (e.g. pushing a view into the database) there isn't much to differentiate between the various tools; it's a very subjective choice. As you go "further down the rabbit hole" you may find one tool fits your application or workflow better than another.