We are a software consultancy based in Berlin, Germany. We deliver
high quality web apps in short timespans.

Upstream Agile GmbH

Diplom thesis: a distributed application with CouchDB and Javascript

October 27, 2010 by Lena

Today I finally released the thesis I wrote at Upstream during the best part of the last year. The title is "Implementation of a distributed application using the document-oriented database CouchDB — An outliner as a replicable distributed system". I investigated the capabilities of CouchDB in general and CouchApps in particular to see if they're a good choice for implementing a distributed system. Before that, several other approaches to implementing such a system were examined. The main part is a description of the concept and realisation of the outliner (see below). Where it made sense, snippets of the source code have been used to illustrate certain issues. Also included is a presentation of the used technologies, which include Sammy.js as routing framework, JQuery for the user interface, Cucumber/Culerity and JSpec for testing purposes, CouchDB Lounge for scaling and Amazon EC2 for deployment.

In the course of the research I implemented an outliner that allows collaborative editing of documents. An outliner is an editor you can use to organize text into a tree structure. The idea for this has been heavily inspired by Upstream's SaaS product doingText. The application I wrote is a CouchApp, which means it is Javascript code which is served by a local CouchDB instance. It therefore runs locally in the browser and is also usable when users have unreliable internet access or none at all. Using CouchDB's built-in replication and conflict detection features, the documents can be exchanged and synchronised whenever there is an internet connection available. Quite a part of the development effort went into the handling and resolution of conflicts that may occur during replication.

You can view or download English and German versions of the thesis on my blog. There you can also find links to the deployed application and to the source code on github.

Along the way I learned tons of things, mainly about CouchDB and concepts of modern web applications. It was also great to be able to use Javascript for more than just UI enhancement, this gave me the chance to properly grok Javascript as a first class language. Thanks a lot to Upstream for sponsoring my work and the professional support along the way!