Service Boundaries and Decomposition
What you'll learn: How to identify and define microservice boundaries using business capabilities to create maintainable, loosely-coupled services.
The Core Challenge
When breaking a monolith into microservices (or designing them from scratch), the hardest question is: where do I draw the lines? Cut services too small, and you create a distributed nightmare of chatty dependencies. Cut them too large, and you haven't really escaped the monolith's problems.
Business Capabilities as Your Guide
The most effective strategy is decomposing by business capability—the things your organization does to provide value. Think "order management," "inventory tracking," or "customer profiles," not "database access layer" or "notification sender."
Each business capability should encapsulate:
- Its own data and state
- The logic to fulfill its responsibility
- Clear interfaces for interaction
Example: An e-commerce platform might decompose into:
- Product Catalog Service – manages product information
- Order Service – handles order creation and tracking
- Payment Service – processes payments
- Shipping Service – coordinates deliveries
Each owns its domain completely. The Order Service doesn't reach into the Payment Service's database; it calls the Payment API.
Identifying Boundaries
Look for:
- High cohesion within – related functions grouped together
- Loose coupling between – minimal dependencies across boundaries
- Clear ownership – one team can understand and maintain it
- Independent change – updates don't cascade everywhere
- Natural data boundaries – each service owns its entities
Avoid decomposing by technical layers (UI, business logic, data access)—this creates distributed monoliths where every feature change touches multiple services.
Key Takeaway: Define microservice boundaries around business capabilities, not technical concerns. Each service should represent a complete business function with its own data, enabling independent development and deployment.