Middleware stack for the client