Volume 7 · Chapter 3 — Microservices and System Design

Decomposing by Domain

Goutham Mayaluri 8 min read AWSCloudMicroservicesSystem Design

3.1 Introduction

If you decide microservices are warranted, the hardest question is where to draw the boundaries - how to split the system into services. Getting this wrong produces services that are too chatty, tightly coupled, or share data, which combines the costs of distribution with none of the independence. The guiding discipline is to decompose around business domains and capabilities, not technical layers, and this chapter explains that principle - drawn from domain-driven design - because it’s central to good microservice design and a common senior-interview theme.

3.2 Decompose by Business Capability

The core principle is to split services around business capabilities - the distinct things the business does - rather than around technical layers. Each service should own a cohesive business function end-to-end: a payments service owns everything about payments, an accounts service owns accounts, a notifications service owns notifications. This is the opposite of splitting by technical layer (a “database service,” a “UI service”), which creates services that must all change together for any feature and are tightly coupled. When services align to business capabilities, a change to how payments work stays within the payments service, teams own coherent areas, and the boundaries match how the business actually thinks - which is what makes independent development and deployment real rather than nominal.

3.3 Bounded Contexts

Domain-driven design offers the concept of a bounded context - a boundary within which a particular model and its terms have a specific, consistent meaning. Different parts of a business understand the same word differently: a “customer” means something different to the payments context than to the marketing context. A bounded context draws a boundary around a coherent part of the domain with its own consistent model, and these boundaries are excellent candidates for service boundaries, because a service aligned to a bounded context owns a coherent, self-consistent slice of the domain. Identifying bounded contexts - the natural seams in the business domain where models and language shift - is how you find where to split, rather than splitting arbitrarily or by technical convenience.

flowchart TB
  subgraph Good[Decompose by business capability - low coupling]
      Pay[Payments context\nowns payment model end-to-end]
      Acc[Accounts context\nowns account model]
      Not[Notifications context]
  end
  subgraph Bad[Decompose by technical layer - high coupling]
      UI[UI service] --- Logic[Logic service] --- DB[Database service]
      NoteB[Every feature touches all three\ntightly coupled, not independent]
  end

3.4 High Cohesion, Loose Coupling, and Data Ownership

Good boundaries produce high cohesion within a service (everything about one capability lives together) and loose coupling between services (services interact through well-defined interfaces, not by reaching into each other’s internals). A critical rule that enforces this is that each service owns its own data - other services never directly access its database; they go through its API or receive its events. This data ownership is what makes services truly independent: a service can change its internal data model without breaking others, because no one else touches its data. Sharing a database between services recouples them through the schema and is the classic mistake that turns “microservices” into a distributed monolith. The measure of good decomposition is that services are cohesive, loosely coupled, and each owns its data.

3.5 Right-Sizing Services

Services shouldn’t be too large (a mini-monolith owning too many unrelated capabilities) or too small (so fine-grained that a single business operation requires many chatty cross-service calls, compounding latency and coupling). The right size is a service that owns a cohesive business capability - big enough to be meaningful and self-contained, small enough to be independently owned and deployed. If a common operation constantly requires several services to talk, the boundaries are probably too fine or drawn wrong; if a service is a sprawling catch-all, it’s too coarse. The goal is boundaries where most changes and operations stay within a single service, and cross-service interaction is the exception, aligned to genuine business seams.

3.6 Banking Production Scenario

A bank decomposes its platform along business capabilities and bounded contexts: payments, accounts, transfers, cards, and notifications are separate services, each owning its domain end-to-end and its own data. The payments service owns the payment model and database; no other service touches payments data directly - they call its API or consume its events. Because boundaries follow how the business actually works, most changes stay within one service, teams own coherent areas, and services are cohesive and loosely coupled. The bank explicitly avoids splitting by technical layer and never shares a database across services, because that would recouple them and recreate a distributed monolith. Where a business operation spans contexts (a transfer affecting two accounts), it’s coordinated through well-defined interactions rather than shared data.

3.7 Troubleshooting: Bad Boundaries

Poor decomposition has clear symptoms. Services that must always deploy together, or where one change forces changes in several, indicate boundaries drawn by technical layer or too fine - realign to business capabilities. Services sharing a database are coupled through the schema - give each its own data and interact through APIs and events. Chatty cross-service calls for a single operation mean the split is too granular or misplaced - consolidate to a cohesive capability. A sprawling catch-all service is too coarse - split it along its distinct capabilities. Confusion over which service owns a concept means the domain boundaries (bounded contexts) aren’t clear - map them from the business domain. The fix in every case is to realign boundaries to cohesive business capabilities with clear data ownership, so services become genuinely independent rather than a distributed monolith.

Interview Question

How do you decide where to draw microservice boundaries?

I draw microservice boundaries around business capabilities and domains, not technical layers, because that’s what produces services that are genuinely independent rather than a distributed monolith. The core principle is that each service should own a cohesive business capability end-to-end - a payments service owns everything about payments, an accounts service owns accounts - so the boundaries match the distinct things the business does. This is deliberately the opposite of splitting by technical layer, like a “database service” and a “UI service,” because layer-based splits create services that all have to change together for any feature and are tightly coupled - the worst of both worlds, distribution cost with no independence. To find the boundaries I use the domain-driven design concept of a bounded context: a boundary within which a particular model and its terminology have a specific, consistent meaning. Different parts of a business understand the same term differently - a “customer” means something different in the payments context than in marketing - and a bounded context draws a line around a coherent part of the domain with its own consistent model. Those bounded contexts, the natural seams where the domain’s models and language shift, are excellent candidates for service boundaries, because a service aligned to one owns a coherent, self-consistent slice of the domain. Good boundaries produce two properties: high cohesion within a service (everything about one capability lives together) and loose coupling between services (they interact through well-defined interfaces, not by reaching into each other’s internals). A critical rule that enforces this is data ownership: each service owns its own data and no other service accesses its database directly - they go through its API or consume its events. That’s what makes a service truly independent, because it can change its internal data model without breaking anyone; sharing a database recouples services through the schema and is the classic mistake that turns microservices into a distributed monolith. I also right-size services: not so large they become mini-monoliths owning unrelated capabilities, and not so small that a single business operation needs many chatty cross-service calls - the right size owns a cohesive capability where most changes and operations stay within one service. The tell-tale signs of bad boundaries are services that always deploy together, that share a database, or that constantly chatter for one operation - all signalling the split is by layer, too fine, or misplaced. So I decompose along business capabilities and bounded contexts, ensure high cohesion and loose coupling with each service owning its data, and size services so most work stays within one - which is how you get boundaries that deliver the independence microservices are supposed to provide.

Chapter Revision Notes

  • Decompose around business capabilities/domains, not technical layers - each service owns a cohesive business function end-to-end.
  • Bounded contexts (DDD) - the seams where the domain’s model and language shift - are strong candidates for service boundaries.
  • Aim for high cohesion within services and loose coupling between them, interacting via well-defined interfaces.
  • Each service owns its own data; never share a database (that recouples services into a distributed monolith).
  • Right-size services: not mini-monoliths, not so fine that one operation needs many chatty calls - most work stays within one service.