My Couch or Yours? Shareable Apps Are The Future
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.
h2. We Don't Need No Affero
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.
h2. CouchDB Rocks, Duh
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
h2. Let's Do It!
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!
by Robby Russell, 2008/11/14 02:00:33 +0000
Chris... you continue to fascinate me with your projects.
I gotta try couchdb out soon. :)
by Eric Florenzano, 2008/11/14 19:39:50 +0000
I get a syntax error in replication using the latest version of CouchDBX.
by Chris Anderson, 2008/11/14 19:51:41 +0000
@ericflo, that's not too surprising. It should work with trunk.
by Lucas, 2008/11/14 20:18:59 +0000
Can you tell me where do I configure my twitter account?
Thanks!!
by Olavo Santos, 2008/11/14 20:39:47 +0000
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/standaloneapplicationswith_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
by Wil Tan, 2008/11/19 11:51:49 +0000
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] [error] [<0.89.0>] {errorreport,<0.37.0>, {<0.89.0>,crashreport, [[{pid,<0.89.0>}, {registeredname,[]}, {errorinfo, {exit, {tcperror,#Port<0.206>,etimedout}, [{genserver,terminate,6},{proclib,initp,5}]}}, {initialcall, {httpchandler,init, [[{request,#Ref<0.0.0.445>,<0.86.0>,0,http, {"jchris.mfdz.com",5984}, "/twitter-client-design/076c5e35f67bad78b6b2c000d673301f", "?revs=true&attachments=true&openrevs=[\"2506991380\"]&latest=true", get, {httprequesth,undefined,"keep-alive",undefined, undefined,undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined,undefined, undefined,undefined,undefined,"jchris.mfdz.com", undefined,undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined,[],undefined, undefined,undefined,undefined,"0",undefined, undefined,undefined,undefined,undefined,undefined,[]}, {[],[]}, {httpoptions,"HTTP/1.1",infinity,true,[],undefined, false}, "http://jchris.mfdz.com:5984/twitter-client-design/076c5e35f67bad78b6b2c000d673301f?revs=true&attachments=true& openrevs=[\"2506991380\"]&latest=true", [],none,[]}, {options,{undefined,[]},0,2,2,disabled,enabled,false}, httpcmanager]]}}, {ancestors,[httpchandlersup,httpcsup,inetssup,<0.38.0>]}, {messages,[]}, {links,[<0.44.0>]}, {dictionary,[]}, {trapexit,true}, {status,running}, {heapsize,2584}, {stack_size,23}, {reductions,991}], []]}}
But when I fetch the URL manually using curl, there's no problem.
Any idea?
by Confused, 2008/12/06 10:40:19 +0000
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.
by Tom Robinson, 2008/12/06 22:25:39 +0000
Very cool! This is a really helpful example app. Thanks for posting it.
by Medical revision, 2008/12/29 16:56:58 +0000
I so don't think that affordances is a word. I know it's on wikipedia, but still!
by Chris Moyer, 2009/01/24 04:24:25 +0000
Just a note, as I finally got a chance to try this out, after grabbing 0.9a from git: If you grab this, you'll need to edit twitter-couch.js, search for "count" and change it to "limit".
Very cool.
by Jon Gilbert, 2009/01/28 08:29:40 +0000
Ahoy. I think that this is pure win.
But don't just stop at shareable/moddable web apps. Lets redo all file systems. I'd like it if instead of existing inside of folders, that exist inside of folders, that exist at the root, instead, each file would simply exist in teh CouchDB. Each document could then be a file or set of files; each folder a view :D OS X has "smart folders" but this is kludgy as hell, and makes you realize that the rest of the folders are what... freaking stupid folders?? Yes, yes they are.
by daonb, 2009/02/08 12:11:42 +0000
replication failed for me. here's what I got:
<code> Replication failed: [{lists,map,[#Fun<couchrep.10.28922857>,ok]}, {couchrep,opendocrevs,4}, {couchrep,'-enumdocsparallel/3-fun-1-',3}, {couchrep,'-spawn_worker/3-fun-0-',3}] </code>
by Mike Linksvayer, 2009/04/04 22:28:08 +0000
I'm with @Confused re your example -- needlessly confusing. How about an OpenMicroBlogging server CouchDB app. That would be unconfusing. :-)
And I find a link to the enwp article on affordance highly annoying. Link to a page (maybe on the CouchDB wiki) describing the affordances you're talking about. Do you think people don't know what an affordance is and really need to know?
Those minor complaints aside, I think there's great wisdom in this article, in particular in the two paragraphs following the (don't need) Affero heading. Deployment mechanisms that make code sharing natural and obviously advantageous are probably going to be more important than copyright enforcement. However, the two are orthogonal. The AGPL may not be necessary, but it may well help, just as the GPL is not necessary but may well have helped with non-network code.
by Greg Tappero, 2009/10/16 16:54:23 +0000
It seems that the url http://jchris.mfdz.com:5984/twitter-client-design is down. Maybe the post is out of date.
Anyway couchdb ROXX
by AndyUK, 2009/11/01 20:17:22 +0000
New URL is: http://jchrisa.net/twitter-client-design
Replication failed for me. Would be great if you can get it working again.
by Pereira, 2009/11/12 12:53:06 +0000
Same here.
using 0.10.0
any tips?
by Vincent RABAH, 2010/02/08 11:19:27 +0000
Same here with 0.10.0 and http://jchrisa.net/twitter-client-design ...
Any ideas, any tips ?
{"sessionid":"c151277abc9f2103fd81466f4298c2b8","starttime":"Sun, 07 Feb 2010 21:21:23 GMT","endtime":"Sun, 07 Feb 2010 21:21:23 GMT","startlastseq":0,"endlastseq":1,"recordedseq":1,"missingchecked":0,"missingfound":1,"docsread":1,"docswritten":1,"docwritefailures":0}