I’ve been working on a few frontend and node server projects — which use CB + CB sync gateway + node SDK + PouchDB — so I’ve become very interested to see other developers implementations. There isn’t anything particular I’m looking for but I thought it would be a great way to get ideas or inspiration.
So far my projects are working great but perhaps there are some usage scenarios I’ve missed or opportunities for performance/stability improvement, so they’re the main things I’d be seeking out.
Hi Max, I didn’t use PouchDB in the demo. Do you need local offline storage for browsers?
It’s a bit much to go into the full architecture here, but basically the node server supplies REST endpoints that correspond to the various data/query requests. So, for example, there’s an endpoint to get the geolocation of a group of patients. I use bluebird promises for async operation to keep everything non-blocking.
The mobile side is quite straight-forward. Changes made by the web client automatically feed out to the mobile side based on channels.
Maybe the less obvious parts, to give some idea of usage scenarios, are the full-text search and the geolocation query parts. One nice piece is the use of the built-in cURL capabilities. It allows you to use a cURL-style api to retrieve data from an external source and treat it just like data from the database (meaning you can do joins and other complex N1QL actions with it directly).
I would have been shocked if you used PouchDB — there’s quite a number of issues with CBSG + PouchDB but it does work. Yes, I use it for offline storage. I’m aiming for an “offline first” PWA experience.
If you do publish the source, please do reply here