cordova - Architecture of an app when using CouchDB/PouchDB -


i wondering how architecture should when using pouchdb local storage in mobile app instead of localstorage.

at moment used cache app's data localstorage , when needed perform api call backend request or post data. backend holding logic. such as:

  • does user has correct permission/role action?
  • any other logic needed check if action can done

all data stored relational database. have been reading nosql databases , in particular couchdb , pouchdb. wondering how architecture like? 3 questions arise @ point me:

  1. if have multiple users there own authentication, how can make sure users access data? , still have 1 database on server end?
  2. pouchdb on client side can in sync remote pouchdb. when application build javascript how make sure people not inserting data pouchdb 'hacking' client-side javascript?
  3. would use of backend gone in these kinds of setups? , if want have api 3rd party, put example sails.js backend around couchdb?

pouchdb maintainer here, happy answer questions. :)

if have multiple users there own authentication, how can make sure users access data? , still have 1 database on server end?

there guide in the pouchdb-authentication readme. cloudant , couchbase have own systems managing users.

pouchdb on client side can in sync remote pouchdb. when application build javascript how make sure people not inserting data pouchdb 'hacking' client-side javascript?

you write validate_doc_update function on server side. when pouchdb tries sync couchdb, failed documents emit 'denied' event, , documents not sync.

as local database, cannot prevent users writing bad data (they can open console , whatever want), can use pouchdb-validation re-use validation function on client side. or can when put() document.

would use of backend gone in these kinds of setups? , if want have api 3rd party, put example sails.js backend around couchdb?

some people write pouchdb apps without backend (just using pure couchdb/cloudant/couchbase), whereas others mix database server architecture of choice. it's you. :)

one interesting solution if you're using express use express-pouchdb, can expose pouchdb server-like endpoint inside of existing architecture. sails.js, though, you'd have write own.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -