Check out View Server protocol for details. Paul Davis suggests the following :--
In the test subdirectory there is a Ruby spec file that tests view
server implementations for protocol compatibility. Its a
JSON-over-stdio protocol, so for all CouchDB cares, you could write a
view server in Bash.
It all goes to the view server. I'd suggest checking out that rspec
test suite as well as ./share/server/validate.js and
./share/server/loop.js to see how calls get passed. The protocol is
something like:
Input:
["validate", functionSrc, newDoc, oldDoc, request]\n
Ouput:
1\n
or
0\n
The DesignDocument needs to take optional validation functions to be fired during all subsequent document updates.