Architecture styles¶
How to choose and combine structural styles such as monoliths, microservices, layered, hexagonal/clean and event-driven.
Entries are sorted by score from 1 to 10 (criteria): 9โ10 start here or strongly recommended, 6โ8 recommended, 1โ5 further reading or conditional.
Adopted references¶
- 9 Azure Architecture Center: architecture styles: each style with its benefits, challenges and when to use it. Use it as the default catalogue when comparing styles.
- 9 Azure cloud design patterns: a pattern catalogue with problem, solution and when to use each pattern.
- 9 Microservices (Lewis and Fowler): the defining article on microservice characteristics.
- 8 Microservice Architecture pattern language (Chris Richardson): patterns for decomposition, data, communication and deployment.
- 8 Enterprise Integration Patterns (Hohpe and Woolf): the vocabulary for messaging and integration.
Key rules¶
Monolith or microservices¶
- 8
STYLE-1Start with a well-structured monolith and split it once the boundaries are understood. Most successful microservice systems started as monoliths that grew too big. (Fowler, Monolith First) - 8
STYLE-3Organise services around business capabilities and let each service own its data. (Lewis and Fowler, Microservices, microservices.io, Database per service) - 7
STYLE-2Have rapid provisioning, basic monitoring and rapid deployment in place before adopting microservices. (Fowler, Microservice Prerequisites) - 7
STYLE-4Treat microservices as a premium you pay to manage complexity. Don't pay it for systems that aren't complex enough to need it. (Fowler, Microservice Premium) - 6
STYLE-5Consider a modular monolith: one deployable with strictly enforced module boundaries. (Shopify Engineering, Deconstructing the Monolith, Modular Monolith with DDD reference implementation)
Inside an application¶
- 9
STYLE-6Keep the domain independent of UI, frameworks and databases, so that dependencies point inwards. Hexagonal, Onion and Clean Architecture all express this. Apply it in proportion to the domain's complexity: a simple CRUD app that wraps a database doesn't need separate layers (Percival and Gregory, Architecture Patterns with Python: Repository pattern). (Cockburn, Hexagonal Architecture, Palermo, Onion Architecture, Martin, The Clean Architecture) - 7
STYLE-7Layer presentation, domain and data, but in larger systems make domain modules the top-level split. (Fowler, Presentation Domain Data Layering)
Events and messaging¶
- 7
STYLE-8Apply CQRS only to the specific parts of a system that need it. For most systems it adds risky complexity. (Fowler, CQRS, Azure, CQRS pattern) - 7
STYLE-9Use event sourcing where a full history of changes is a requirement, not as a default persistence model. (Fowler, Event Sourcing, Azure, Event Sourcing pattern) - 5
STYLE-10Say which event-driven pattern you mean: event notification, event-carried state transfer, event sourcing or CQRS. They have very different trade-offs. (Fowler, What do you mean by "Event-Driven"?)
Evolving existing systems¶
- 6
STYLE-11Replace legacy systems incrementally behind a facade (Strangler Fig) rather than with a big-bang rewrite. (Fowler, Strangler Fig, Azure, Strangler Fig pattern) - 6
STYLE-12Put an anti-corruption layer between your model and legacy or external models. (Azure, Anti-corruption Layer pattern) - 5
STYLE-13When extracting services, start with a simple, loosely coupled capability and decouple by business capability, not by technical layer. (Dehghani, How to break a Monolith into Microservices)
Tutorials and further reading¶
- 8 Azure: microservices architecture style: a guided path through designing microservices.
- 7 Building Microservices, 2nd edition (Sam Newman).
- 5 Serverless Architectures (Mike Roberts): what serverless is, with its benefits and drawbacks.