Slicing and Dicing Through Complexity with Hanami
Sean Collins
• Boulder, CO
•
Talk
Date: October 06, 2025
Published: not published
Announced: unknown
As a Rails app grows, complexity tends to scatter across loosely defined layers, leaking through porous boundaries. Hanami 2 is a flexible Ruby framework that helps you organize complexity with clear, intentional boundaries. At the core of its philosophy is a first-class concept called slices: optional, modular boundaries that let you organize your application by feature, not just by layer. Your billing logic can live in its own world, completely isolated from onboarding or authentication, yet still integrate cleanly through explicit, well-defined interfaces. Slices can even be deployed independently, making them a strong fit for scaling both teams and infrastructure.
Hanami chops up the traditional MVC stack into small, single-purpose layers. Each action gets its own class to handle parameters and orchestration with the rest of your system. Views are plain Ruby objects that prepare data for rendering, cleanly separated from templates. And the persistence layer, powered by ROM, encourages immutability and composability through simple data structs and repositories which access and modify data through relations.
The result is a framework that feels lightweight but powerful: one that lets you spend your days writing Ruby, with clear straightforward APIs. Hanami doesn't dictate architecture, it gives you the freedom and tools to structure your application as you see fit. The modular monolith is not a myth: it's just that the framework for building modular Ruby apps is Hanami, not Rails. With Hanami, you spend less time bending Rails to your architecture, and more time writing focused, testable Ruby.
Rocky Mountain Ruby 2025