I don’t have to tell you that in the long run, open source software beats closed source software, in any domain where the software is broadly useful, or in those domains where users are generally technical enough to hack their own gear. Proprietary web-servers and filesystems just can’t keep up with the free competition. As programming gets easier, the open-source advantage is moving up the stack. Microsoft burns out generations of programmers trying to keep up with Rails and Django, and they still don’t have the other advantages of freedom.
I also don’t have to tell you that web development is where all the new developers are cutting their teeth these days. Middle-schoolers the world over are learning to hack by hitting “view source” and having that a-ha moment when they realize those angle brackets correspond to the web apps they use everyday.
The road from kludging together HTML and stolen JavaScript to piloting high-level frameworks like Rails and Django is arduous and fraught with dead ends and distractions, but enough of us make it here to have created this vibrant community of enlightened hackers. We learn from each other’s code, but we still haven’t found a compelling way to share the whole stack. There are a few open-source web application success stories, like WordPress and Trac, but most of us work on applications that will die when the original business case goes away. We certainly haven’t seen an explosion of end-user friendly open-source web apps, to rival the proliferation of free development tools, frameworks, and even end-user software like browsers and media tools.
You only have to Google AGPL to get an idea of the tensions seething under the surface of the Free Software movement. The rub: companies have grown fat and happy using proprietary forks of open-source software to power web services. Because they aren’t distributing the software, just distributing the ability to use the software, they aren’t required to share their code under traditional licenses. It can be discouraging to pour energy in to free software, only to see big companies turn a handsome profit with it, and fail to contribute back to the community.
Some say the solution is to require source distribution to accompany usage distribution. I say the solution is to out-compete the applications that don’t distribute their source. If we build apps that derive a lot of value from the fact that they can run locally or over a network, and we provide an easy way for users to share the applications, I think we can give people a reason to prefer freedom over convenience. Once users expect the benefits that come from taking ownership of their data and their application code, they’ll look at closed-source web apps as dinosaurs.
I’m not saying it’s the only way, but I will say that CouchDB is uniquely positioned to open up this new space. The affordances it creates around sharing apps and data make the opportunity cost of not sharing your applications and data higher than the costs of doing so. If you’re interested in my thoughts about the technical ins and outs of shareable apps, I just posted today on the topic of peer-to-peer apps on the CouchDB mailing list.
If you just want to get down and dirty, and have a copy of the latest CouchDB trunk, let’s install my CouchDB Twitter client. Once you’ve got CouchDB installed and running on your local machine, installing it should take about a minute.
Let’s do this step by step – with screenshots!
First, go to your local machine’s CouchDB futon and create a database.

Now go to the Replicator, where we’ll enter the information we need to copy the CouchDB Twitter Client from my public database.
The remote database is http://jchris.mfdz.com:5984/twitter-client-design (I created a special database with just the application code, because in this case the Twitter client tends to accumulate quite a lot of information over time.) There’s a sad bug that was introduced for a few revs of CouchDB’s trunk, having to do with URL escaping. It’s fixed now so if replicating doesn’t work, try running svn up and rebuilding before you retry replication.
Now you have the app! Lets use it. Go back to the “Overview” page (the one you started on) and click into the twitter-client db. Now choose “Design documents” from the drop down menu.
Now click the _design/twitter-client document, and you’ll be happy you did because boy is it awesome! All it takes to enter the application is to click index.html.
And this is what it should look like, only with your friends’ updates instead of mine. If you don’t have a Twitter account, there won’t be anything to see here. There’s also a strange failure mode for some users where it just seems totally broken. This might be due to too many Twitter API accesses, so if you’re gung-ho, try quitting your other Twitter clients and give it an hour or so. If it still doesn’t work, well, you’ve got the source code all in that design document!
Note that you can add standing searches to your timeline by click the star in the lower-left.
Enjoy!
9 comments on My Couch or Yours? Shareable Apps Are The Future
I seem to have a problem replicating even at the latest trunk version. I’m on OS X with Erlang R12B and the following svn info:
Path: . URL: http://svn.apache.org/repos/asf/incubator/couchdb/trunk Repository Root: http://svn.apache.org/repos/asf Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68 Revision: 718930 Node Kind: directory Schedule: normal Last Changed Author: jchris Last Changed Rev: 718650 Last Changed Date: 2008-11-19 01:01:02 +0800 (Wed, 19 Nov 2008)
I only managed to get it to replicate one doc:
ID: d7f2585d5684936d877595d479480443 rev: 644933357
Got the following crash report that looks like a time-out:
Wed, 19 Nov 2008 11:44:41 GMT [<0.89.0>] {error_report,<0.37.0>, {<0.89.0>,crash_report, [[{pid,<0.89.0>}, {registered_name,[]}, {error_info, {exit, {tcp_error,#Port<0.206>,etimedout}, open_revs=[\”2506991380\”]&latest=true”,
But when I fetch the URL manually using curl, there’s no problem.
Any idea?
This post is confusing.
You initially start off with a rant about open source. Then you go on to build a CLIENT to a propriety closed source web application.
I thought you were going to build a full blown twitter clone.
What you don’t realise is that there has been a trend away from propriety software on the server and desktop and as the explosion of web2.0 propriety software web applications. All the VCs throwing cash at these companies are going to fund open source applications.
I so don’t think that affordances is a word. I know it’s on wikipedia, but still!
Chris… you continue to fascinate me with your projects.
I gotta try couchdb out soon. :)
Hello.
Yesterday i had the opportunity to have a long talk with Jan Lehnardt, after his presentation at Codebits ( Lisbon, http://codebits.sapo.pt/ ).
Talking about lucky… after the usuall questions around locking and replication i’ve ask him for a few comments around a weird idea that i had a few weeks ago while trying to hack filezilla.
“We already a few sites where the view source option is available. Why don’t we just add the edit option and let users change the logic behind the website?”
I was expecting a typical surprise face but instead he told me something like: “Wait! Stop! You must read this right now! Let’s go to your laptop!”
“Standalone Applications with CouchDB” http://jchris.mfdz.com/code/2008/10/standalone_applications_with_co
Brain melted down imediately!
Your description it’s just amazing!
My perspective is that, even with a narrow range of capable users that can change source, it will rock alot if you just can change the source code and decide by yourself why replication servers you want to use to keep yourself transparently sync’ed.
This will be the same what wikipedia is today for offline paper dumb encyclopedias.
BTW, using web interfaces just to code is not new.
In 2000 i had the oportunity to work with Mario Valente ( http://mv.asterisco.pt/ ) and he introduced me to Zope ( http://www.zope.org/ ) and their application management interface ( ZMI ).
The flexibility of a web interface to code ( even without syntax highlight, code completition and so on ) is impressive!
And coincidence or not, Mario has spend the last months trying to kick me up to start coding on this new vision of him about web development… javascript all the way ( presentation, business logic and even storage )... weird like sometimes lego just fits right!
Thank you Chris, Thank you Jan!
@905, Nbk
Very cool! This is a really helpful example app. Thanks for posting it.
I get a syntax error in replication using the latest version of CouchDBX.
@ericflo, that’s not too surprising. It should work with trunk.
Can you tell me where do I configure my twitter account?
Thanks!!