11 comments

[ 338 ms ] story [ 825 ms ] thread
Syncing complex data from offline storage to a hosted backend is hard, especially if the data can change in both places at once. If this solves that problem, it could be very useful.
PouchDB uses the exact same replication API as CouchDB, its fairly simple (although not so much to implement)

Conflicts (when the data has been modified on both sides independantly) are simple dealt with by storing both versions of the document, the app author can then choose one, or merge to create a new document to fix the conflict.

http://guide.couchdb.org/draft/conflicts.html - has some more information

It is a hard problem, you have to deal with offline edits + conflicts, minimizing the amount of changes that are transferred, Hopefully this is useful for people dealing with those problems so they dont need to start from scratch

I looked into this a month ago, and it didn't appear to be there yet: https://github.com/daleharvey/pouchdb/issues/25

(The issue is currently open, but it looks as if it may land shortly.)

The data syncing is there, that bug is related to a particular issue of communicating with external hosts

If your app and your CouchDB instance are on the same host (either with a proxy or couchapps) then there is no issue, if the CouchDB instance you want to sync with is on a seperate host then you need to add CORS headers to data served from couch, this is a few lines change in nginx, I run a local proxy for development because its just more convenient

No offense but I can barely read that text, you might want to darken that shit. Cool library though
This is a truly powerful thing, especially for mobile web-apps where you need to constantly synch with a central server.

Also, native mobile apps using WebKit don't need to embed CouchDB in their app anymore - they simply use PouchDB to synch with their couches.

Not to mention the benefits this could bring to desktop development. All you virtually need is a WebKit instance to build a truly scalable desktop application that uses open standards for most of its components - HTML5/CSS3 for interface and a Couch API for storage.

Really awesome! Keep up the good work.

Thanks for that comment, its awesome that people see the exact same potential as I do in this model.
I think local storage in web apps with sync could be a big deal in the future. Probably for mobile html5 apps in particular but also for the desktop. Great work!
Good stuff! This is more appealing than that fire whatever it was database. Agree with other posters, if we could get an implementation for localStorage this would be beyond awesome. I might attempt to tackle that as I had wanted to build something like this.

FYI, there is a backbone model adapter for it as well :)

Can it be used with some other database like MySQL? I mean the main database is MySQL and in the offline mode PouchDB can collect data.

Also, what about security of the main database? How does the syncing take place?

CouchDB has a plugin based auth system, with in built support for http / cookie / oauth, so its a matter of only allowing access to a database against an authenticated client, it can all go over https of course.

Its possible / in the plans to use on top of sqllite (and thus mysql), but it wouldnt be possible to use in the way you invisage, PouchDB + CouchDB allow you to sync data due to its data model and api, you wont be able to sync data out of your current application written with rdbms in mind and have it 'just work'