I'm developing a TODO app for myself. It has to be offline first so data synchronization became a problem soon. As to my searches, CouchDB does data sync (replication) very well but I'm having some confusion here.
First of all, I'm using Flutter and Dart programming language and there isn't any couch client on Dart. For javascript, there is PouchDB which apparently makes data sync with remote database automatic (Am I right?) as far as I know I should be good to go without any third party library since CouchDB comes with native HTTP API, I can just store user data as a JSON file and just sync it with CouchDB server as a document (Am I right?)
Another confusion for me is that should user data be stored as a document or should I create 1 database per user(In other words does couch syncs database or document?) It also raises authorizations. A user which has access to a database has access to all documents. I want to restrict each user to its documents without placing another API between couch and end-user application.