Middleware composition utility