api: better segregate client and server code