Backend Architecture Patterns — A Practical Guide for 2026
Watch a repo team turn architecture context into a reviewed change.
The sample scopes the work, gathers repository evidence, proposes a patch, checks it, and pauses for approval.
Architecture is about trade-offs, not trends#
Every backend architecture pattern exists because it solves a specific problem. The mistake most teams make is choosing a pattern because it's popular, not because it fits their constraints.
Here are the 7 patterns that matter in 2026, when each works, and when each will hurt you.
1. Monolith#
One codebase, one deployment, one database.
When it works:
- Team of 1-15 engineers
- Product is still finding product-market fit
- You need to ship fast and iterate
- Your domain boundaries aren't clear yet
When it hurts:
- Independent teams need to deploy different features at different cadences
- One component's scaling needs are 100x another's
- Deploys take 30+ minutes because everything is coupled
The truth: Most startups should start here. You can always extract services later when you understand your domain.
2. Microservices#
Independent services, each owning its data, communicating via APIs or messages.
When it works:
- Large teams (50+ engineers) with clear domain ownership
- Components have vastly different scaling needs
- You need independent deployment per team
- You have the DevOps capacity to run distributed systems
When it hurts:
- Small teams without distributed systems expertise
- Unclear domain boundaries (you'll get them wrong)
- You don't have observability, tracing, and service mesh infrastructure
- Network latency and partial failures haven't been planned for
Key insight: Microservices trade code complexity for operational complexity. Make sure you're ready for both.
3. Modular monolith#
Structured like microservices (clear module boundaries, defined interfaces) but deployed as one unit.
When it works:
- You want clean architecture without operational overhead
- Team is growing and needs clear ownership boundaries
- You plan to extract services later but aren't ready yet
- Domain boundaries are becoming clear
Why it's underrated: You get 80% of microservices benefits (clean boundaries, independent development) with 20% of the operational cost. This is the sweet spot for most growing startups.
Structure:
src/
modules/
users/ # User domain
api.ts # Public interface
service.ts # Business logic
repository.ts # Data access
orders/ # Order domain
api.ts
service.ts
repository.ts
payments/ # Payment domain
...
Modules communicate only through their public APIs. No reaching into another module's internals.
4. Event-driven architecture#
Components communicate by publishing and subscribing to events rather than direct API calls.
When it works:
- Loose coupling between services is critical
- You need to react to changes across multiple systems
- Workflows are naturally asynchronous (order placed → send email → update inventory → notify warehouse)
- You need an audit trail of everything that happened
When it hurts:
- Simple request-response workflows
- You need immediate consistency (event processing has latency)
- Debugging is hard when events flow through 10 services
- Your team hasn't invested in event schema management
Patterns within this pattern:
- Event sourcing: Store events as the source of truth, derive state from them
- CQRS: Separate read and write models (see below)
- Saga pattern: Coordinate long-running transactions across services
5. CQRS (Command Query Responsibility Segregation)#
Separate the write path (commands) from the read path (queries). Each can have its own data model, storage, and scaling.
When it works:
- Read and write patterns are fundamentally different
- Read side needs to be 100x faster than write side
- You need different data shapes for different consumers
- Combined with event sourcing for complex domains
When it hurts:
- Simple CRUD applications
- Eventual consistency between read and write is unacceptable
- Your team is unfamiliar with the pattern (steep learning curve)
- The added complexity isn't justified by your scale
Example: An e-commerce platform where writes go to a normalized database and reads are served from a denormalized cache optimized for product pages.
6. Serverless#
Functions as a Service (FaaS) — code runs in response to events, infrastructure is fully managed.
When it works:
- Unpredictable or spiky traffic (pay per invocation)
- Event-driven workloads (file upload → process → store)
- APIs with low-to-moderate traffic
- You want zero server management
When it hurts:
- Consistent high traffic (becomes expensive)
- Long-running processes (cold starts, execution limits)
- Complex workflows with state
- You need WebSockets or persistent connections
- Vendor lock-in is a concern
The cold start trap: Serverless is cheap at low scale and expensive at high scale. Model your costs before committing.
7. Hexagonal architecture (Ports and Adapters)#
Core business logic at the center, surrounded by adapters for databases, APIs, and external services. The core has no dependencies on infrastructure.
When it works:
- Business logic is complex and needs thorough testing
- You want to swap databases, message queues, or external services easily
- Long-lived applications where infrastructure will change over time
- Teams that prioritize testability
Structure:
core/ # Pure business logic, no dependencies
domain/ # Entities, value objects
ports/ # Interfaces (what the core needs)
use-cases/ # Application logic
adapters/ # Infrastructure implementations
database/ # Implements repository ports
http/ # REST/GraphQL controllers
messaging/ # Queue adapters
The core never imports from adapters. Adapters implement the ports defined by the core.
How to choose#
| Question | If yes → |
|---|---|
| Team < 15 people? | Monolith or modular monolith |
| Need independent deployments? | Microservices |
| Read/write patterns very different? | CQRS |
| Workflows are async? | Event-driven |
| Traffic is spiky/unpredictable? | Serverless |
| Business logic is complex? | Hexagonal |
| Domain boundaries unclear? | Modular monolith (figure them out first) |
Most real systems combine patterns. A modular monolith with event-driven communication between modules is a great starting point.
Visualize before you build#
The best way to evaluate architecture patterns is to see how components connect. Try describing your system in Codelit — it generates interactive diagrams showing services, data flows, and dependencies. Compare patterns side-by-side before writing code.
Key takeaways#
- Start simple — monolith or modular monolith for most teams
- Earn complexity — add patterns when you hit the problems they solve
- Modular monolith is underrated — 80% of microservices benefits, 20% of the cost
- Event-driven isn't always better — it adds debugging complexity
- CQRS and event sourcing are powerful but complex — don't use them for CRUD
- Serverless costs scale linearly — model costs before committing
- Hexagonal architecture pays off long-term — testable, swappable, clean
Explore the Stripe architecture interactively
Try it →Watch a repo team turn architecture context into a reviewed change.
The sample scopes the work, gathers repository evidence, proposes a patch, checks it, and pauses for approval.
Try these templates
Netflix Video Streaming Architecture
Global video streaming platform with adaptive bitrate, CDN distribution, and recommendation engine.
10 componentsSearch Engine Architecture
Web-scale search with crawling, indexing, ranking, and sub-second query serving.
8 componentsMultiplayer Game Backend
Real-time multiplayer game server with matchmaking, state sync, leaderboards, and anti-cheat.
8 componentsContinue learning
Go deeper on system design
As an Amazon Associate I earn from qualifying purchases. Codelit may receive a commission at no extra cost to you.
Building Microservices
Sam Newman · 2021
600 pages on splitting a monolith: service boundaries, data decomposition, migration order.
Release It!
Michael T. Nygard · 2018
Post-mortems of real outages, then the stability patterns (circuit breaker, bulkhead) that stop them.
4.6 (501)#4 in Client-Server Networking SystemsA Philosophy of Software Design
John Ousterhout · 2021
Short book on module depth and complexity, with before/after code showing why an interface is too wide.
Fundamentals of Software Architecture
Mark Richards, Neal Ford · 2025
Scores eight architecture styles against the same characteristics, so trade-offs are side by side.