Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (28 sloc) 1.68 KB

Flexible SproutCore DataSource for CouchDB

This framework provides a flexible DataSource for CouchDB that just works, given you don't care about performance. You probably only want to use this DataSource during the prototyping of your app.


Clone this repo in the frameworks directory of your app.

Make sure you have couchdb installed (use the following for homebrew)

brew install couchdb

Make sure your buildfile has something like the following

config :all, :required => [:sproutcore, :couchdb]

proxy "/sc-datasource", :to => "localhost:5984"

Add the following lines to your core.js file, remove other similar lines

store: SC.Store.create({
  commitRecordsAutomatically: YES

Create the CouchDB database:

curl -X PUT

Add a design document to the database:

curl -X PUT -d '{"_id": "_design/sc_datasource", "views": { "by-sc-type": { "map": "function(doc) { if (doc.sc_type) { emit(doc.sc_type, doc); } };" } } }'

To test if that worked:


This should give you the following output:


Thats it.


Battletest this framework while prototyping. I have currently confirmed that it works with the Sample Todo app and with my own app. I need more people to use it before I know it flexible enough.


Ido Ran for creating the Couchdb tutorial ( Some of the code is actually from his examples.