Thursday, February 16, 2012

Relax, or, adventures with CouchDB for fun and profit.

My employer is pretty cool about allowing devs freedom in choosing tools. They also support R&D-based “play time” to explore new technologies as they pertain to our problem domains. I’ve had a great time over the past year and half specializing in JavaScript development using tools like Backbone.js, RequireJS, Node, etc., while continuing full-stack development for the enterprise.

Recently I got the opportunity to use CouchDB for a customer-facing project. Before he left to pursue greener pastures, our former Development Director authored a conference registration site using CouchDB and CouchApp. Since I’ve earned the “JavaScript Guy” moniker here, I was presented the opportunity of taking over the app for this year’s conference.

Apache CouchDB is a document-oriented database that can be queried and indexed using JavaScript in a MapReduce fashion. CouchDB provides a RESTful JSON API than can be accessed from any environment that allows HTTP requests. CouchApps are JavaScript and HTML5 applications served directly from CouchDB. Assuming your application can fit 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).

CouchDB represents a significant paradigm shift coming from a relational SQL background. It is extremely flexible as a document store, it is ad-hoc and schema-free, and provides powerful incremental peer-based replication for distributed storage. Like all NoSQL databases, it is not intended as a panacea, nor intended as a substitute for relational databases. It is simply another available tool to evaluate based on a project needs basis.

This project also gave me some exposure to nginx, which is used as a proxy to CouchDB, and Python, which is used for some administrative features behind the scenes.

It’s been pretty awesome getting to know CouchDB, and adding it to my tool belt for consideration on future projects. I’ll try to post more specifics as time permits.