HELM
Ch 11 · Service Architectures
Chapter 11 · How services fit together

Monolith, Microservices, Mesh — and the honest answer in between

The pendulum has swung from monolith → micro-anything → modular monolith → "right-sized services". This chapter teaches you to land on the right side of that pendulum every time.

11.1 · The five shapes

ShapeWhen
Monolith0–20 engineers; one domain; speed matters more than scale.
Modular monolithSame deployable, strong internal boundaries; the modern default for most products.
MicroservicesMultiple teams owning distinct domains; independent deploy cadence.
Service meshYou have many services and need uniform retries, mTLS, traffic shaping.
Cells / micro-frontendsYou can split user populations into isolated stacks for blast-radius control.

11.2 · Monolith done right

  • Single deployable; one DB; one repo.
  • Boring tech; mature framework (Rails, Django, Spring, Phoenix, Laravel, .NET).
  • Boundaries via packages, not network hops.
  • Background jobs in the same monolith with a queue worker.
  • The "best speed-to-revenue" architecture for < 10 engineers.

11.3 · Modular monolith — the underrated middle

  • One deployable. Strict internal modules with explicit APIs between them.
  • If a module needs its own scale, lift it into a service later (cheap to do because boundaries were clean).
  • Tools: Java modules / Kotlin Gradle subprojects / Rust workspaces / TS workspace + nx boundaries.

11.4 · Microservices — only when you need them

ProCon
Independent deploys per teamNetwork + serialisation cost on every call
Tech polyglotOperational footprint multiplies
Smaller blast radiusDistributed bugs are 10× harder
Scale per serviceNeed mesh, OTel, contracts to stay sane
The bar
You should not pay the microservices tax until you have multiple teams whose release cadences actually conflict. Conway's Law cuts both ways.

11.5 · BFF — Backend For Frontend

One backend per client surface (web, iOS, Android, partner). Each tailored to its consumer's needs — composing downstream services. Pairs well with GraphQL or tRPC.

11.6 · Service mesh — Istio, Linkerd, Consul, Cilium

  • Sidecar proxy (Envoy) per pod, or sidecar-less (Cilium eBPF, Istio Ambient).
  • Gives you uniformly: mTLS, retries, timeouts, circuit breaking, traffic shifting, telemetry.
  • Cost: operational complexity. Pick a mesh once your service count is > ~10.

11.7 · Hexagonal / Clean / Onion architecture

Same idea, three names: core domain at the centre, surrounded by ports (interfaces) and adapters (DB, HTTP, queue). Lets you swap infrastructure without touching domain logic.

Domain Application services Adapters (HTTP, DB, queue, UI)

11.8 · DDD — bounded contexts

  • Identify bounded contexts — each with its own ubiquitous language. "Order" in shipping ≠ "Order" in billing.
  • Strategic patterns: partnership, customer–supplier, conformist, anti-corruption layer.
  • Tactical patterns: entity, value object, aggregate, repository, domain event.
  • Use DDD heavily when the domain is the hard part (insurance, lending, healthcare).

11.9 · CQRS & Event Sourcing

  • CQRS: separate models (and possibly stores) for commands (writes) and queries (reads).
  • Event sourcing: store events, derive state. Full audit history; rebuild any read model.
  • Pairs with: Kafka, EventStoreDB, Marten, Axon.
  • Cost: complexity. Use only when audit + temporal queries justify it (finance, accounting, regulated workflows).

11.10 · Migration — strangler fig

  1. Route new traffic to the new service via a façade/proxy.
  2. Move features one by one; both old and new run in parallel.
  3. When the legacy has no traffic left, retire it.

The only sane way to evolve a monolith into services without a big-bang rewrite.

11.11 · Self-check

Q1 · A 6-engineer team building a new SaaS picks…
15 microservices
A modular monolith
A service mesh from day 1
CQRS + event sourcing