Software architecture patterns
25 software architecture patterns, from the monolith to RAG. Each page explains the pattern, when to use it and when not to, with a diagram you can open and edit in one click.
Application structure 8
-
Monolithic architecture
One codebase, one deployable, one database. The default for new products. -
Modular monolith
One deployable, split into modules that own their data and talk through public APIs. -
Layered (n-tier) architecture
Presentation, business logic and data access stacked so each layer calls only the one below. -
Hexagonal architecture (ports and adapters)
The domain in the middle, talking to the outside world only through ports and adapters. -
Clean architecture
Entities, use cases, adapters and frameworks, with every dependency pointing inwards. -
Onion architecture
Rings around the domain model; infrastructure on the outside depends on everything inside. -
Microkernel (plug-in) architecture
A small core with extension points, and features added as independent plug-ins. -
Pipe-and-filter architecture
Independent processing steps connected by pipes, each doing one transformation.
Distributed systems 8
-
Microservices architecture
Small services that each own one capability and its data, deployed independently. -
Service-oriented architecture (SOA)
Enterprise-wide services connected through a service bus, often in front of legacy systems. -
API gateway pattern
One entry point in front of many services: routing, auth, rate limits and aggregation. -
Backend for frontend (BFF)
One small backend per client type, shaped to exactly what that client needs. -
Service mesh architecture
Sidecar proxies next to every service handle mTLS, retries and telemetry, steered by a control plane. -
Serverless architecture
Functions and managed services that scale to zero; you run no servers. -
Strangler fig pattern
Replace a legacy system piece by piece behind a facade, until nothing of it is left. -
Multi-tenant SaaS architecture
Many customers on one platform: pooled resources for most, dedicated ones where needed.
Events and consistency 4
-
Event-driven architecture
Services announce what happened; others react, without knowing who sent it. -
CQRS (command query responsibility segregation)
Writes and reads take different paths, each with a model built for its job. -
Event sourcing
Store every change as an event; current state is whatever the events add up to. -
Saga pattern
A business transaction across services as a series of local steps, undone by compensations.
Data and AI 5
-
Lambda architecture (data)
A batch layer for accurate history plus a speed layer for fresh data, merged at query time. -
Kappa architecture
Streaming only: one codebase, and reprocessing by replaying the event log. -
Data mesh
Domain teams own and publish their data as products, on a shared self-serve platform. -
Lakehouse architecture
Warehouse-style tables on cheap object storage, used by SQL, BI and ML alike. -
Retrieval-augmented generation (RAG)
Find the relevant documents first, then let the LLM answer from them.