1

I'm currently working on an architecture with an offline mobile client and a database server.

I was thinking about using the sync-gateway component from couchbase, hence, couchbase as a server db and pouchdb as a client db. The business logic is quite complex, though and as far as I understand, synchronization filtering, data validation and authorization is made through the gateway configuration. Is this a good idea or couchbase synchronization capabilities are preferred for simpler logics and I should stick to a more Spring Rest API and fill the local indexDB manually.

Matthew Groves
  • 25,181
  • 9
  • 71
  • 121

1 Answers1

0

Couchbase Sync Gateway is used in very large enterprise grade deployments of varying complexity and scale so that shouldn't be an issue. The decision you would need to make is whether you need sync or you are looking for a simple request-response approach (that's better suited for connected environments). FWIW, Sync Gateway also supports a REST interface - so you can use indexedDB requesting data via the REST interface as well.

You mention offline mobile client so why are you not using couchbase lite as the embedded database? Is this a PWA? The synchronization protocol between Couchbase lite and Sync Gateway is more performant and advanced compared to the couchDB based approach used between the likes of PouchDB and Sync Gateway.

rajagp
  • 1,443
  • 8
  • 10
  • Hi, and thanks for your answer! It is indeed PWA as, in addition to the mobile app, we'll have a desktop client through Electron as well as an online webapp. We definitely need synchronization: the mobile webapp will be used in different places with unreachable network, with all features being available. My concerns are specifically on the business data validation (via sync-gateway configuration) and permissions (expressed though channels as far as I understand). Implementing such things through configuration seems a bit odd to me, I'm quite new to CouchBase ways. – Christian German Nov 18 '20 at 17:51
  • You are configuring the access control policies on Sync Gateway as that's the enforcement point. You can define dynamic policies via a JS sync function specified in the sync gateway config or statically via REST endpoint. Not sure why that would be odd though unless you are alluding to not having a UI to do the configuration as odd ? – rajagp Nov 18 '20 at 20:56