← Tuesday, October 20, 2026DatabasesGuide

Hanami’s database layer separates relations, repositories, and structs

aaronmallen.me 14 min read Editor score 6/10

The overview explains how Hanami organizes its database layer around relations, repositories, and structs rather than a traditional Rails-style model layer. It offers a useful framework-design comparison for engineers evaluating data-access patterns.

What
Hanami’s database layer uses Relations, Repos, and Structs instead of a traditional model layer.
How
Relations define schemas, relationships, and datasets; Repos operate on relations; Structs are frozen object representations with presentation logic.
Why it matters
This separation gives engineers building large systems distinct places for data shape, multi-relation operations, and object presentation.

Discussion

Discussion is not switched on yet. Use Note above to keep your own thoughts on this story.

Headline, summary, brief and diagram are written by a model from the source's own text; the link, byline and numbers come from the source. Read the original before relying on a claim.

Your note

Private to you. Stored in this browser, and synced to your account when you are signed in.