Skip to content

Sliced Bread Architecture

Group code by business concept. Let structure emerge from pressure. Keep every dependency arrow pointing in a permitted direction.

Import direction

Arrows point in a permitted direction: entrypoints/app/domains/*domains/common/, plus app/bootstrapadapters/. A slice may import a sibling slice’s public API directly. Only the composition root imports concrete adapters, and nothing imports entrypoints/.

Crust integrity

External consumers use a slice’s public seam in the language’s native form — exported identifiers, a package __init__, an index module. Internals can be renamed, split, or reorganized freely.

Model purity

Domain code imports stdlib, common/, and sibling public APIs. Infrastructure hides behind ports the domain defines and adapters implement.

Growth justification

Add directories and abstractions only after demonstrated pressure. Two concrete consumers are normal evidence, not a hard requirement; cycle-breaking dispatch and positional privacy are canonical examples of pressure with one consumer.

Event usage

Events resolve reverse dependencies — B reacts to A without A knowing B. They are not general-purpose messaging.

Demonstrated pressure, not a numeric count, justifies new directories and abstractions. Two concrete consumers are the normal evidence threshold, not a hard requirement. A cycle-breaking event dispatcher and a one-file positional crust are canonical examples of pressure that can justify structure with one consumer.