3 ms·
We recently went in the opposite direction for a student project I'm working. We have a full SPA Angular frontend, and we use CouchDB as our datastore. There is
by morpheuskafka 8y ago
We recently went in the opposite direction for a student project I'm working. We have a full SPA Angular frontend, and we use CouchDB as our datastore. There is a Node "backend," but it only serves things like Slack integration, the browser has a local PouchDB instance that directly syncs with the server's CouchDB. This way, we can deploy hotspots with nothing more than a Couch install and a static server for the SPA.
The modern, offline web is great. If we had to do this in a native app we would never have gotten the project off the ground, because we initially need to use BYOD phones which were evenly split from iOS/Android. We'd have had to use three languages, but a Mac, get developer licenses, and learn Swift and Java just to get an offline frontend, and sharing business logic code would be impossible.
- pspeter3 8y agoAre you running your own CouchDB instance?
- morpheuskafka 8y agoYep, although the local hosts for offline use will be ARM so we are actually using PouchDB server which is really easy to work with in Node.
- raihansaputra 8y agoThis sounds interesting. I'm light on details on how CouchDB and its sync works, but how do you deal with data validation/data conflict? Or maybe malicious actors tampering your data? Or is it a closed app that already have those dealt with in the spec? It would be awesome if you can share more about the project.
- morpheuskafka 8y agoI'll email you a copy of the whitepaper once it is finished. The famous quote is, "CouchDB is bad at everything, except syncing." It has a built in revision system that will create two conflicting revisions on both ends, and allow your code to implement the business logic to determine the one true revision. This could be a prompt, or a rule based on the data (ex newer timestamp winds), or even an average of various data fields to create a whole new field. http://guide.couchdb.org/draft/conflicts.html http://guide.couchdb.org/draft/conflicts.html
- raihansaputra 8y agoWow, the revision system is really interesting. Makes sense why you used it that way. Thanks for the link! Am excited to wait for the whitepaper.