Last April, Atul Varma of Mozilla posted an article on an implementation of a local storage wrapper that mimicked CouchDB's map-reduce query interface.

In the comments, my friend Mikeal posted If you could add replication this would give the current Weave stuff a run for it's money

I thought about it and this seemed like a perfect solution to what I see as one of the most important areas in the development of the web platform. Ever since Mikeal got me interested in CouchDB, I've followed its development, and been excited at how native to the web it feels. Using nothing but a REST interface, and javascript for queries, it is marvellously fast and simple.

A javascript library that wrapped both local storage and the REST interface to a CouchDB server could exploit couch's replication and versioning to provide a simple storage API whilst offline, and then transparently sync it to the server once connectivity resumed.

In a world where HTML5 is becoming the only open platform for mobile app development, and where locally stored and owned data is becoming rare, this concept was not only exciting from an engineering standpoint, but also tied in with my ideological views on open data.

For a year, the idea percolated through my head, but until about a month ago I hadn't done anything about it.

After leaving Slide last month, I had lot of free time to work on personal projects. I forked a repository on github and began almost immediately. Within a few days I had replication working.

I've been working on it off and on ever since. I'd love to hear your feedback — it's not in a stable state yet, although the unit tests run and replication to localhost works, but I'd love to get as much feedback on the API design as possible before I release a 0.1 version, as it'll be much harder to make such changes if people start to use it.

So what's on the todo-list?

Well, as was pointed out to me by the intimidatingly smart people at couchio, I'm doing replication all wrong - I need to store _seq numbers and a by sequence tree. That's the next major change I plan to make.

I also want to get Futon working on it, which will require a lot of work.

As always, feel free to fork it or comment on my commits.