← Graph

Typical DDDomains In Rails Apps

talk 41 connections

Andrzej Krzywda's wroclove.rb 2022 talk arguing that most Rails projects share the same 'typical' domains — pricing, authentication, shipping, inventory, payments, taxes, invoicing, calendar, etc. — and only a small 'pink' core domain is genuinely unique. Krzywda revisits his own 10-year-old advocacy of service objects, lists the debates they cause (naming, call vs execute, return values, grouping, testing, params-driven flow) and calls them a 'gateway drug' to DDD — useful but not enough. He introduces a two-layer split: an application layer containing Rails controllers, service objects, form objects and read models (and things like admin panels, mobile APIs, GraphQL, Shopify web hooks), and a domain layer that lives OUTSIDE the Rails directory (e.g. in an `ecommerce/` folder), has no dependency on Rails or Active Support, and treats each domain as a pure function from commands to events. Domains don't know about each other; business processes — reactive rules mapping events onto commands — coordinate them. Service objects become thin mappers from params to commands (often collapsible into controllers); form objects validate input but must not save; read models subscribe to events (possibly from multiple domains), are persisted (often as Active Record), are decoupled from one another, and pair well with Hotwire for broadcasting. He demos the rails_event_store 'ecommerce' reference repository, the Event Browser (written in Elm), a DSL for read models, and explains GDPR via per-event encryption keys. Argues the approach is more junior-friendly (smaller building blocks, clearer tickets) and more estimation-friendly than fat Rails, and hopes generic domains will eventually ship as open-source gems. Warns against microservices, Rails engines, Trailblazer-then-removed experiments, and reusing service objects across applications. Closes with Q&A on AOP (subsumed by events), GDPR with backups, risks of modularising too early, DDD without event sourcing, reading from read models, unit testing with fakes, and the overhead of DDD vs Rails' 'fast first weeks, slow later' curve.

date
2022-03-11
type
talk
talk Typical DDDomains In Rails Apps
about
Entire talk pitches a layered DDD approach in Rails.
talk Typical DDDomains In Rails Apps
about
Typical Domain concept
Core thesis: typical domains (pricing, inventory, shipping…) repeat across Rails projects.
talk Typical DDDomains In Rails Apps
about
Introduces the two-layer architectural split as the fix for single-level modularisation.
talk Typical DDDomains In Rails Apps
about
Defines each domain as a function from commands to events.
talk Typical DDDomains In Rails Apps
about
Processes coordinate otherwise-decoupled domains by reacting to events with commands.
talk Typical DDDomains In Rails Apps
about
Read Model concept
Read models as event-subscribed persisted projections for different applications.
talk Typical DDDomains In Rails Apps
about
Service Object concept
Revisits service objects and collapses them into param-to-command mappers.
talk Typical DDDomains In Rails Apps
about
Form Object concept
Form objects belong before service objects; must not save.
talk Typical DDDomains In Rails Apps
about
Named and criticised as an anti-pattern in the talk.
talk Typical DDDomains In Rails Apps
about
Command Bus concept
Service objects dispatch commands on a command bus the talk describes.
talk Typical DDDomains In Rails Apps
about
Event Sourcing concept
Discussed as an optional persistence mechanism for domains.
talk Typical DDDomains In Rails Apps
about
Demoed as the tooling for events, commands and read models.
talk Typical DDDomains In Rails Apps
about
Reference repo demonstrated during the talk.
talk Typical DDDomains In Rails Apps
about
Hanami tool
Pointed to as a Rails-free host for the same domain layer; Hanami port is in progress.
talk Typical DDDomains In Rails Apps
about
Hotwire tool
Argued to pair well with read models via Active Record broadcasts.
talk Typical DDDomains In Rails Apps
about
Cited as a popular modularisation attempt often later removed from codebases.
talk Typical DDDomains In Rails Apps
about
GraphQL tool
Cited as an application-layer integration that 'sucks too' but is fortunately manageable.
talk Typical DDDomains In Rails Apps
about
Avo tool
Discussed as acceptable only if it can hook into service objects or commands.
talk Typical DDDomains In Rails Apps
about
Discussed and dismissed for directly manipulating Active Records.
talk Typical DDDomains In Rails Apps
about
Demoed as a UI that reduces debugging time with granular events and commands.
talk Typical DDDomains In Rails Apps
about
Primary framework whose MVC, engines, callbacks and philosophy are re-examined.
asked_at
Typical DDDomains In Rails Apps talk
Asked during the talk's Q&A.
asked_at
Typical DDDomains In Rails Apps talk
Asked during Q&A.
asked_at
Typical DDDomains In Rails Apps talk
Asked during Q&A.
asked_at
Typical DDDomains In Rails Apps talk
Asked during Q&A.
asked_at
Typical DDDomains In Rails Apps talk
Asked during Q&A.
asked_at
Typical DDDomains In Rails Apps talk
Follow-up question in Q&A.
asked_at
Typical DDDomains In Rails Apps talk
Asked during Q&A.
asked_at
Typical DDDomains In Rails Apps talk
Asked during Q&A.
asked_at
Typical DDDomains In Rails Apps talk
Asked during Q&A.
authored
Typical DDDomains In Rails Apps talk
Delivered the talk at wroclove.rb 2022.
from_talk
Typical DDDomains In Rails Apps talk
Central recommendation of the talk.
from_talk
Typical DDDomains In Rails Apps talk
Repeatedly emphasised in the talk.
from_talk
Typical DDDomains In Rails Apps talk
Stated explicitly as a common mistake to avoid.
from_talk
Typical DDDomains In Rails Apps talk
Guidance given when discussing multiple application-layer apps.
from_talk
Typical DDDomains In Rails Apps talk
Named as an anti-pattern to drop.
from_talk
Typical DDDomains In Rails Apps talk
Warning given while surveying failed modularisation attempts.
from_talk
Typical DDDomains In Rails Apps talk
Conclusion slide of the talk.
from_talk
Typical DDDomains In Rails Apps talk
The 'bold claim' near the end of the talk.
talk Typical DDDomains In Rails Apps
presented_at
Single-speaker presentation at wroclove.rb 2022.
related_to
Typical DDDomains In Rails Apps talk
Wójtowicz explicitly references Krzywda's previous-day talk, citing the application-vs-domain fat line and layered-DDD as an intuitive abstraction barrier example.

Provenance

Created
2026-04-17 16:17 seed
Read by
18 extractions