We're creating a Capacitor app for fishing vessels for logging catches etc. We're contemplating using PouchDB/PouchDB-authentication with a CouchDB peruser configuration on the remote server. I've only worked with sql databases before, never document-based. I've read all the docs, but I'm still having a hard time wrapping my head around document-based and planning the database structure.
Core requirements:
- For each vessel, there will be a small number of users (<9) which should have separate login credentials.
- For each vessel, fishing trips will be added as they occur. Each trip will consist of multiple catch messages which can be easily stored as json.
- There's no need to read data from multiple vessels at once. There are other mechanisms attending to that. (Not controlled by us).
What we need to know/decide:
- Peruser setup. Can the users onboard a specific vessel share that vessel's data even if they have separate databases? If not, can we make peruser to be "per vessel" and keep the vessel's users in a document? I guess the users then would have to share the vessel's credentials among them, and not have personal credentials. It might be a viable option, however not ideal.
- Authentication. I'm not to happy about storing the admin credentials in users' devices, it isn't safe. I'm thinking about creating a second "admin-light" user and reducing it's access rights with a design document, i.e. only allowing the creation of new users (vessels). It might also be an option that we create each vessel credentials on our own, then we wouldn't have to store any admin credentials on user devices at all.
- For simplicity, we would very much like to avoid having a proxy script between http and CouchDB. But if it can't be avoided for this use case, then I can't see any reason why we should use document-based at all? In such case I'd rather do an sql solution instead.
Thoughts from experienced document-based database devs are very welcome!