Architectural Styles Reference

A reference page mapping all architectural styles covered in this wiki, with brief descriptions and guidance on when to choose each.

Layering & Structuring Styles

StyleCore IdeaWhen to Use
Layered ArchitectureTechnical layers: Presentation → Business Logic → Data AccessCRUD apps, simple domains, small teams
Onion ArchitectureDomain at center; all dependencies inward; infrastructure at the edgeDomain-rich apps; want to isolate domain from persistence
Clean ArchitectureAdds explicit Use Cases to Onion; uncle Bob’s variantLong-lived apps; maximal testability; strong dependency rules
Hexagonal ArchitecturePorts (interfaces) and Adapters (implementations); domain in centerMultiple integration points; need to swap storage/messaging easily
Vertical Slice ArchitectureOrganize by feature, not layer; each feature is a vertical cutFeature-driven teams; CQRS-heavy; want high cohesion per feature

Deployment & Distribution Styles

StyleCore IdeaWhen to Use
Modular MonolithSingle deployable; strict internal module boundariesNew projects; smaller teams; microservices not yet justified
Microservices ArchitectureIndependent services per business capability; own DB eachScale, team autonomy, polyglot tech needs justified the cost
Service-Oriented ArchitectureServices share infrastructure (ESB); coarser-grained than microservicesEnterprise integration; legacy modernization

Communication & Event Styles

StyleCore IdeaWhen to Use
Event-Driven ArchitectureServices communicate via events; loose temporal couplingAudit logs, async processing, integration between systems
CQRSSeparate read model from write modelHigh-scale reads; complex query requirements; event sourcing
Event SourcingState = log of events; never update, only appendAudit trail required; temporal queries; complex domain history
Actor Model ArchitectureState in actors; communicate via messages; supervision hierarchiesHigh concurrency; distributed stateful entities; IoT

Domain-Centric Approaches

StyleCore IdeaWhen to Use
Domain-Driven DesignModel domain expertly; bounded contexts; ubiquitous languageComplex business domains; need tight alignment with domain experts
Vertical Slice ArchitectureFeatures as slices; aligns with DDD use casesFeature-oriented teams; good CQRS/MediatR fit

Architecture Selection Guide

Choosing Your Deployment Style

New project?
├── Small/medium domain + small team → [[Modular Monolith]]
│   └── When genuinely outgrown → [[Microservices Architecture]]
└── Already operating microservices → [[Microservices Architecture]]
    └── Legacy migrating → [[Strangler Fig Pattern]]

Choosing Your Internal Code Organization

What's most important?
├── Testability + DDD richness → [[Clean Architecture]] or [[Hexagonal Architecture]]
├── Domain isolation + DDD → [[Onion Architecture]]
├── Feature cohesion + speed → [[Vertical Slice Architecture]]
└── Simplest that works → [[Layered Architecture]]

Choosing Your Consistency Model

Need distributed transactions?
├── Strong consistency required → [[Distributed Transactions]] (2PC)
└── Can tolerate eventual consistency → [[Saga Pattern]] + [[Outbox Pattern]]
    └── Understand → [[CAP Theorem]] + [[Eventual Consistency]]