Table of contents

This document was written in october 2016.

Couchdb plugins analysis

(original discussion is at

Existing packages

Plan B - Make our own from net/http

If we go this way, it will be a good idea to look at the code of the other packages for each function, some pitfalls could be avoided :


Considerations on how we will use it

(see the architecture for more info)


Going further (thanks @tomquest)

Another advantage of a DIY solution: building exactly what stack needs. This is orienting the CouchDB access code for Cozy usage. And this could be implemented as a DSL.

For example: (if I understand the architecture, the goal is for an User to have many Databases, one for each DocumentType)

// Create an Email
    .Doc(anEmail) // deduce the database from the type of the parameters
    // .Update()
    // .Delete()
// List emails from 100 to 200
emails = couchdb
    .emails() // pick the appropriate database
    .Order(DATE, DESC)
    .select() // Create the adhoc CouchDb query (`Mango` style ?)

BTW, couchdb could be an already configured object with the appropriate user credentials.



Current decision

We will make our own driver by cherry picking relevant codes in other libraries.