wayneacarter
You may want to take a look at Couchbase Mobile and see if it meets your needs. It has an embedded database, synchronization, user/role based security, and secure REST/Stream/Batch APIs.
As stated by jtolly710, Couchbase and Couchbase Mobile, which have foundations in CouchDB, are alive and well. Take a look at Couchbase, Couchbase Lite, and Sync Gateway and see if they meet your needs. If you want application level security and internet facing secure REST/Stream/Batch APIs Sync Gateway will be of particular interest. If you need a secure embedded NoSQL database Couchbase Lite will be of interest.
Couchbase Mobile is open-sourced under Apache 2 and has all of the database and sync functionality of Firebase. From a database perspective it is more complete than Firebase. It also has enterprise level security, REST/Stream/Batch APIs, etc. Take a look and see if it meets your needs.
The formatting and modularization of your sync function code will strongly influence both it's readability and maintainability.
I've published and example of one that is well formatted and modularized. The example includes Navigation Flow, Wireframes, Data Modeling, and a Sync Function (which is the security layer).
https://github.com/waynecarter/couchbase-mobile-examples/wik...
Let me know if you have any other questions around this and I will add it to the example.
We hear you and we're working on that. A good place to start is w/ our mini-hacks. Here is an iOS one that I think could help: https://github.com/couchbaselabs/mini-hacks/tree/master/kitc...