Couch It

Couch It

CouchDB code resides in design documents. Couch It is an application to make it easier to build design documents.

Developers generally code using an IDE that stores files in a directory structure on a file system. Since CouchDB can store files, why not use it for storage and write a minimum IDE for design documents using CouchDB itself. As time goes on, perhaps it will not be so minimal. We'll see.

Design Documents

CouchDB stores documents. Design documents are a special case where instead of application data you store application code. Nearly every CouchDB database is going to have one or more design documents.

Design documents contain code for views (map/reduce) and validations. There can be multiple views and validations. There are also shows, lists, attachments, libs and signatures. The initial version of Couch It will focus on the first group.

The document should look something like this:

{
"_id": "_design/designit",
"_rev": "1-1880256933",
"language": "javascript",
"validate_doc_update": "function (newDoc, oldDoc, user(tx) { ...}",
"views": {
  "by_type": {
    "map": "function(doc) { ... };",
    "reduce": "function(keys, values, rereduce) { ... };"
  }
}
}

Developer Interface

My initial thoughts for the interface of CouchIt are to have "outline" type of view of the code in the design document. Select views and it expands to show you all of the view. Keep drilling down until you see the function for the map or reduce.

[*] views
      [*] by_type
          [ ] map
              [textbox with code here ] [json validation button]
          [*] reduce

[button to save] [deploy]
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License