Open gr2m opened 7 years ago
ping @nolanlawson @daleharvey @garrensmith
@gr2m I like the ideas here. The big thing for me is that the PouchDB core team is really small. So any changes we do to PouchDB-server need to make it easier to maintain. Ideally pouchdb-server needs to be a super thin layer on top of PouchDB.
I want to help maintaining PouchDB Server and agree :100:
It's hard to split pouchdb-server up into a bunch of independent routes. I tried, the current 'mode' functionality which allows for enabling/disabling stuff but still keeps everything inside the express-pouchdb module was the best I could do. I don't remember the details, but there is just too much shared state between modules necessary IIRC. The most obvious one being the configuration and a (wrapped) PouchDB object, but there's probably more.
It might actually be easier to do this when building it on top of pouchdb-express-router. But that does mean doing away with some couchdb compatibility, and it hasn't been updated recently so there's probably still a couple of bugs (https://github.com/pouchdb/pouchdb-express-router/issues/5).
I would like to create a custom server which exposes only the CouchDB APIs that I need, similar to PouchDB’s custom builds which only have the features that I need.
A package like
pouchdb-express-router
could then be implemented like thisand be used like this
An "all inclusive" express middleware could be published as
@pouchdb-server/express
Dreaming
@pouchdb-server/security
&@pouchdb-server/express-security
Just as it is today, I would like to separate logic like CouchDB’s security into two packages:
@pouchdb-server/security
A generic module with APIs needed for security. It uses the passed PouchDB to persist and lookup security settings
@pouchdb-server/express-security
An express middleware which uses the security module in its route handlers. The logic in the route handlers should be minimal, the bulk of the work should happen in the security module
@pouchdb-server/express-security
would look something like this@pouchdb-server/security
would keep a local cache of the current database security setting for faster lookup. It could store the security setting internally in a_local/security
document.I’m sure there is lot of things I did not consider. But I think it would be good to get a conversation going of where we want to go with PouchDB Server. And this is my input :)