Hanami exposes a project level Rack middleware stack to be configured like this:

    1. # config/environment.rb
    2. Hanami.configure do
    3. middleware.use MyRackMiddleware
    4. end

    It’s worth noticing that this is equivalent to add a middleware in config.ru file. The only difference is that third-party plugins can hook into Hanami.configure to inject their own middleware.