I’m currently looking into Hanami as an alternative to Rails
One big advantage Rails has over a lot of solutions (not just in the Ruby world, but in general) is the ecosystem of libraries around it. I think this is hard to replicate. So my thought was: What if the ecosystem wasn’t “Hanami” but “Rails/Rack applications” instead? This would allow the smaller Ruby frameworks like Hanami, Brut and Yippee to join forces instead of implementing the same functionality multiple times. Rails has a longer history of “sherlocking” popular solutions over the years (for example, Active Storage & Solid Queue) which drained a lot of energy out of the original projects. I propose to not follow that pattern, and instead of putting everything in the box, offer recipes to integrate solutions.
The Core of Hanami
In my humble opinion, the core of Hanami would be: Code Loading, Routing, Controllers, Views, Form Handling, Caching, integration with an asset pipeline and the model layer. The model layer is a bit more complicated, but I would like to leave this out of this discussion. The one thing I see missing here is internationalization, as it is closely integrated with the view layer. There is a discussion about it here.
Authentication
I think authentication is an excellent example. @timriley wrote a great post on how to use Rodauth with Hanami (Discussion). For me, Rodauth would definitely be the first thing to try when setting up a Hanami app.
Authorization
For Authorization, I think Pundit and CanCanCan should both just work ![]()
Jobs (Background Processing, Recurring Jobs)
Sidekiq is definitely a solid choice in this area, and I assume it will just work with Hanami. For people that want to store their jobs in the database, I’m not sure if there is a good option:
- SolidQueue and GoodJob are both bound to ActiveJob/Rails
- Que could be an option (for PostgreSQL only) and looks maintained
So I would probably go with either Sidekiq or Que here.
File Uploads
Looking at the solutions at Ruby Toolbox:
- carrierwave still seems to be maintained - it is slightly bound to Rails, but might work?
- refile was an attempt by the same team to “do it better this time”, but the last commit is over 5 years ago.
- paperclip is deprecated
- shrine is really independent of the framework. But activity on it seems to have gone down quite a lot.
- The others all seem to be dead
So I’m not sure what I would go with here.
Mails
Not sure. The mail gem is at the core of ActionMailer, but I think it is quite attractive to have a solution that can also work with transactional email providers, as this is what I commonly use in production. Anyone got any ideas here?
Deployment
Both a classic setup with Capistrano and something like Ansible or a PaaS solution would work. For people who want a Container-based solution, kamal would work as well, but I’m not sure how many want to use a solution from 37signals ![]()
Logging & Instrumentation
Structured logging would be quite good. semantic_logger should work. For further instrumentation, I’m not sure. I would also be interested to see how well rack-mini-profiler works. I regularly use it in Rails app, and think it is quite helpful.
Testing
Both Minitest and RSpec will work with Hanami.