Part of the unified study index: Home · canonical decision guidance in selection guide .
Two tracks: how code is structured inside one project vs how services and infrastructure communicate at scale. All pages are original prose with text-native Mermaid diagrams and illustrative pseudocode.
Layered — horizontal layers, each talks only to the layer below.
Hexagonal — core logic isolated behind ports, adapters face the outside.
Onion — domain model at the center, inward-pointing dependencies.
Clean — concentric rings around Entities and Use Cases, strict dependency rule.
Vertical Slice — organize by feature slice, not technical layers.
MVC / MVVM / MVP — UI separations compared in one table.
Each application page below now includes its complex scenario, edge cases, and expanded failure-mode guidance.
Monolithic — one codebase, one deployable unit.
Modular Monolith — one deployable, strict module boundaries inside.
Microservices — small independently deployable services, each owning its data.
Event-Driven — async events via a broker decouple producers from consumers.
Serverless — ephemeral functions and managed backends, no servers to run.
SOA — larger reusable enterprise services, often coordinated via an ESB.
CQRS & Event Sourcing — separate read/write models, every change stored as an event.
Each system page below now includes its complex scenario, edge cases, and expanded failure-mode guidance.
Layered, Monolithic — the baseline everything else reacts to.
Vertical Slice, Modular Monolith — first escapes from pure layering.
Hexagonal, Onion, Clean — ports, rings, and dependency rules as a group.
MVC / MVVM / MVP — UI separations after core structure clicks.
Microservices, Event-Driven — distribution and async as a group.
SOA, Serverless, CQRS & Event Sourcing — enterprise, functions, and data separation last.
Question Hexagonal Onion Clean
Center Application core Domain model Entities + Use Cases
Mechanism Ports (interfaces) + adapters Concentric rings, inward deps Rings + strict dependency rule
Choose when Swapping UI/DB/API matters most Domain purity with infra outside Enforcing layered rules at scale
Question Layered Vertical Slice
Organized by Technical layer Feature
Change shape Cross-layer for one feature One folder per feature
Choose when Small team, uniform stack Features evolve independently
Question Modular Monolith Microservices
Deployables One Many
Boundaries In-code modules, enforced Service + database per capability
Choose when One team, need boundaries first Independent scaling and deploys outweigh ops cost
Question Event-Driven CQRS & Event Sourcing
Center Events triggering decoupled services Read/write separation + immutable event log
Transport Broker delivery Event log as source of truth
Choose when Reacting across services Reads and writes scale or evolve differently
Solo project, simple CRUD → Layered + Monolithic.
Growing team, one deployable → Vertical Slice + Modular Monolith.
Swappable UI/DB/providers → Hexagonal (or Onion/Clean if domain-centric).
UI-heavy client → MVC / MVVM / MVP per platform norms.
Independent scaling per capability → Microservices; add Event-Driven for async flows.
Enterprise reuse across business units → SOA with ESB governance.
Spiky workloads, minimal ops → Serverless functions + managed backends.
Read-heavy with complex writes → CQRS; add Event Sourcing when audit/replay matters.
Combinations are normal: e.g., Clean inside a Modular Monolith module, or Vertical Slices each exposing ports, or Microservices communicating via events with CQRS on the hot path.