I would like to know if couchbase server, or sync gateway, support server-side execution of custom logic.
No you cannot add serverside logic in the current release Couchbase Server. The main reason is -predictable- performance, if you start to add such logic in the server it may impact the performance.
For the Sync Gateway you have:
1) data routing to channels. channel access control. This is the sync function
2) asynchronous workers -- eg a server process that follows the changes feed for a few channels and does work based on what documents come through changes.
You can find example of this here: