host several applications in the same Ruby process ▸ Each of them can be a component, such as the user facing web interface, the admin pane, metrics, HTTP API etc. ▸ These apps are a delivery mechanism to the business logic that lives under lib/ (entities, repositories, mailers) ▸ Generators: hanami new demoapp --application_name=api hanami generate app admin
Repository ▸ Entities hold the models attributes, but it doesn't deal with the persistence layer ▸ Repositories are responsible for dealing with the persistence of entities (storage independent) ▸ Shared between the Hanami applications ▸ Querying methods (like where, limit, order) are private to the repository context
== Hanami templates ▸ A view is an object that's responsible for rendering a template ▸ Partials, similar to Rails ▸ Presenters included in framework ▸ Many supported rendering engines, including ERb, Haml, Slim, CoffeeScript, SASS etc.
simply modules that group many actions together ▸ Controller actions are classes (single responsibility!) ▸ Using expose method to expose variable of the action with the view ▸ Validations are performed in Controller Actions using dry- validations ▸ Callbacks support, easy error handling etc.
expose :users def call(params) @users = UserRepository.new.all end end end module Admin::Controllers::Users class Show include Admin::Action expose :user def call(params) @user = UserRepository.new.find(id: params[:id]) end end end HANAMI apps/admin/controllers/users/index.rb apps/admin/controllers/users/show.rb
terms of ecosystem - the community is still young, most popular gems are targeting Rails ▸ Be prepared to "roll up your sleeves" to get to the bottom of issues, ﬁgure how to do things that aren't covered by the guides