If we have a SaaS app with multiple clients/accounts, is there a way to limit what is synced to only data related to the client(s)? Hopefully there is, or could be, a connection to Security Providers to limit what is synced.
I wouldn’t want someone to access the database outside of the application interface and see every other client’s data.
You could have multiple CouchDB databases with different sets of data to be synced.
You can even have a primary relational database that copies a subset of data to the CouchDB to be synced with the clients.
Separate database per client is not supported as you can’t sync it with one central database.
Which security provider you will only be able to secure and restrict the database access but not the data, so it is all or nothing.
So indeed as the full database is replicated to all clients ( also with uploaded files in it which we will support shortly) it will have specific use cases when you need your full database available offline.
It would be great if we could hook that up to some db table/value (currentUser.account = record.account) so only records the client should get are sent from couch to pouch.
Where was Couchbase Mobile/Lite when we pushed for this? Seems like it recently introduced scopes and collections that would help with multi-tenant data seperation.
I have also been wondering how to integrate / use CouchDB/PouchDB in a SaaS project where each clients’ data is stored with a clientID that is used to filter from the pool of data.
With CouchDB there is a possibility to have a database per user. Actually working with CouchDB is different as databases are very lightweight and you can have a lot of them on a single server.
So you can be working with multiple databases, some shared for all users - others specific user dedicated.
On the clinet side you connect only with the databases you want to sync, like the common ones and the user specific ones.
We will investigate if you can add also an option for per user databases. But we will have to also adapt the security provider to this model as well.
It seems, at least conceptually, that couchDB will function in a multi-tenant SaaS app. However, if there were some examples of this kind of scenario in Wappler, it would be easier to comprehend the integration and encourage user adoption of the technology.
One challenge I may have with doing everything in Wappler is that my database is created and managed outside of Database Manager and is highly dependent on things that Database Manager doesn’t support like MySQL views…
Perhaps we should actually wait until the feature is finished and documented before going down this route. If this is a full implementation there is so much more to come!
CouchDB is highly flexible and should easily be capable of multi-tenanted database structures but no doubt it requires a completely new approach and a new way of thinking as it can be much more granular in approach, for example each tenant feeding it’s own couchDB via pouchDB in app connect but then a central replication of all the sub databases into a central CouchDB (if needed).
One of the benefits of Couch is that it supports multiple bidirectional replication so databases can take on a tree like structure but this also needs new thinking
Exactly the type of mysql or postgresql db replication I was referring to here in the Server component forum as a Wappler Database Manager extension on CouchDB setup.