Application Architecture Using CouchDB / PouchDB

I am wondering what the architecture should look like when used PouchDBas local storage in a mobile application instead localStorage.

At this point, I use to cache my application data in localStorage, and if necessary, I make an API call to the backend to request or send data. The backend adheres to all logic. For instance:

  • Does this user have the correct permission / role to perform this action?
  • Any other logic needed to verify whether an action can be performed.

All data is then stored in a relational database. Now I am reading about NoSQL databases and, in particular, CouchDBand PouchDB. So I wonder what this architecture looks like? At the moment, three questions arise for me:

  • If I have several users with their own authentication, how can I make sure that users only access their data? And will I still have 1 database on the server?
  • PouchDBon the client side can synchronize with the remote PouchDB. But when an application is created using Javascript, how do you make sure that people don’t paste data in PouchDBby β€œhacking” client-side Javascript?
  • Will there be a backend in such installations? And if you want to have an API for 3rd party, you just put, for example, a backend Sails.jsaround CouchDB?
+4
source share
2 answers

The PouchDB assistant is here to answer your questions with pleasure. :)

If I have several users with their own authentication, how can I make sure that users only access their data? And will I have 1 more database on the server?

The necessary instructions for checking pouchdb-authentication README authenticity . Cloudant and Couchbase also have their own user management systems.

PouchDB PouchDB. Javascript, , PouchDB, "" Javascript?

validate_doc_update . PouchDB CouchDB, 'denied', .

, ( , ), - pouchdb-validation, . , put() .

? API , , , Sails.js CouchDB?

PouchDB - ( CouchDB/Cloudant/Couchbase), . .:)

, Express, express-pouchdb, , PouchDB, . Sails.js, , .

+9

PouchDB PouchDB. Javascript, , PouchDB, "" Javascript?

, / window.PouchDB. , ( ), :

function(){
    // your closure
    var PouchDB = window.PouchDB;
    window.PouchDB = null;
    Object.freeze(window);
}

PouchDB , .

window, - , . Object.freeze(window) , . , , .

Object.freeze gurantees / PouchDB , , (IDB/WebSQL) "" .

+1

All Articles