add doc for middleware interface