I’m a little late to the party on this one, but CouchDB sure is the new hotness. We’ve been tossing around an idea for a new project and it’s a great fit for so many reasons. Schema-less? Check. Distributed and fault-tolerant? Yup. Document revision-aware? and it speaks JSON natively via a RESTful API? Oh yes. It’s easy to see why so many people are getting excited about it.
If you’re used to working with relational databases, it definitely requires a bit of mental reprogramming to really grok Couch, particularly when it comes to working with views and designing document relationships without traditional joins, etc etc. It’s powerful stuff, and after working with it just a little bit, I’m pretty enthusiastic, but still feel like I’ve got a ton to learn.
Anyway, in terms of Ruby client interfaces… there are a surprisingly large number of options that’ll make your life easier. Candidates include ActiveCouch, CouchFu, and RelaxDB. There’s also a DataMapper adapter. My personal pick would have to be jchris’s CouchRest library though. The core of it is very simple, modeled around Couch’s own couch.js library. Plus, the ExtendedDocument model stuff gives you most of what you’d want from a traditional ORM through properties, callbacks, validation mixins (lifted from DataMapper), in-line views (think of them as finder/scopes on steroids), attachments, and so on.
Before diving in too deep I figured I’d port a simple project over to Couch in order to familiarize myself with it. So I created a branch of the Retweet project that uses CouchRest instead of DataMapper. Check it out if you want to see how the CouchRest::ExtendedDocument stuff works in a simple project — only one model in this case. It’s quite nice. There’s also a CouchDB branch of sinatra-template, if you wanna use that to bootstrap your own ideas.
Btw, if you’re on a Mac, and using MacPorts, make sure to port selfupdate to the latest and greatest and then port install couchdb-devel to fetch CouchDB 0.9.0. Anything older than that won’t work with CouchRest.