Rack Middleware
Hanami mounts a very thin default middleware stack. Additional components can be mounted globally, at the application level, or locally.
Project Middleware
There is also another way (the recommended one) to mount a Rack middleware: at the project level:
Action Middleware
Sometimes we need a middleware only to be used for a set of well known resources. If we mount it at the global or application level the performance will start to degrade. Actions allow us to mount a fine grained middleware stack.