move the middleware interface to the types package