Service Boundaries
Lesson 7Beginner1h 14mAssessment-backed

Service Boundaries

Learn how to split responsibilities across services without creating accidental distributed complexity.

What you will be able to do

Explain what a service boundary is and why it matters.
Choose boundaries around ownership, data, change rate, scale, and reliability needs.
Avoid premature microservices and accidental distributed transactions.
Understand when a modular monolith is stronger than many services.
Map service deployment options to AWS, GCP, and Azure.

A service boundary decides who owns behavior and data. Good boundaries reduce coordination. Bad boundaries create network calls, duplicate logic, unclear ownership, and harder incidents.

What Is a Service Boundary?

A service boundary is the line around a responsibility: what the service owns, what data it controls, what API it exposes, what it promises, and what it refuses to know.

Service boundaries around order payment notification and catalog responsibilities
Boundaries should group behavior and data that change together.
Boundary signalWhat it meansExample
Business capabilityA clear product responsibilityPayments owns charges, refunds, receipts.
Data ownershipOne service is source of truthCatalog owns product title and price version.
Change rateParts change independentlyRecommendation ranking changes faster than billing rules.
Scale profileTraffic patterns differSearch reads scale differently from order writes.
Reliability needFailure impact differsPayment correctness matters more than marketing email delivery.

Scenario: Ecommerce Platform

An ecommerce system may include catalog, cart, checkout, payment, inventory, notification, search, and analytics. Splitting all of them into services on day one is not automatically professional. The right boundary depends on ownership, scale, data consistency, and operational maturity.

CapabilityPossible ownerBoundary concern
CatalogCatalog service or moduleProduct data changes often and powers browsing/search.
CartCart service or moduleNeeds low-latency user-specific state.
CheckoutCheckout orchestratorCoordinates order creation and payment intent.
PaymentPayment serviceHigh correctness, audit, provider integration.
InventoryInventory serviceConsistency required for scarce items.
NotificationNotification serviceAsync retries and provider failures.

Modular Monolith vs Services

A modular monolith can be an excellent architecture when the team is small and the domain is still changing. Services become useful when independent ownership, deployment, scale, or reliability needs justify the operational cost.

OptionUse whenRisk
Modular monolithOne team, early product, shared deployment acceptableCan decay into tangled code without internal boundaries.
Few coarse servicesClear capabilities and separate scale/reliability needsRequires API contracts and operational maturity.
Many microservicesMany teams own mature domains independentlyNetwork failures, distributed debugging, and data consistency complexity.

Design principle

Do not split services to look advanced. Split when the boundary reduces product, data, scaling, deployment, or ownership complexity more than it adds operational complexity.

Data Ownership

The hardest part of service boundaries is data. If two services write the same table, ownership is unclear. If every service needs a synchronous call to complete basic work, the boundary may be too fine.

RuleWhy
One source of truth per business entityAvoids conflicting updates and unclear ownership.
Expose data through API or events, not shared writable tablesKeeps boundaries enforceable.
Avoid distributed transactions when possibleThey increase failure and coordination complexity.
Duplicate read models deliberatelyDenormalized views can improve reads if ownership is clear.
Use events for state changes other services need to knowReduces direct coupling when immediate response is not required.

Cloud Deployment Options

Architecture styleAWSGCPAzure
Modular monolith containerECS/EKSCloud Run/GKEContainer Apps/AKS
Independent servicesECS services/EKS deployments/LambdaCloud Run services/GKE deployments/FunctionsContainer Apps/AKS/Functions
Service-to-service routingALB/API Gateway/App MeshCloud Load Balancing/Service MeshApplication Gateway/API Management/Service Mesh
Events between servicesSNS/EventBridge/SQSPub/Sub/Eventarc/Cloud TasksEvent Grid/Service Bus
Secrets/configSecrets Manager/Parameter StoreSecret ManagerKey Vault/App Configuration

Boundary Review Questions

  • Who owns this behavior when it breaks?
  • Which service is source of truth for this data?
  • Does this boundary reduce or increase the number of synchronous calls?
  • Can this part deploy independently without forcing many clients to change?
  • Does this part have a different scale, reliability, or compliance need?

Beginner Mistakes

  • Splitting into microservices before the product domain is understood.
  • Letting multiple services write the same data directly.
  • Creating chatty synchronous calls between tiny services.
  • Treating team structure as irrelevant to architecture.
  • Ignoring how logs, metrics, tracing, and deployments become harder with more services.

Guided Practice

Practice task

For a food delivery product, propose boundaries for restaurant menu, order, payment, rider location, and notification. State which one should probably be async.

Sample Answer

CapabilityBoundary decision
Restaurant menuCatalog/menu owner because menus change independently and power browsing.
OrderOrder owner because order state transitions are core product truth.
PaymentSeparate payment boundary because correctness, audit, provider integration, and compliance matter.
Rider locationSeparate high-write location stream/read model because scale profile differs.
NotificationAsync notification boundary because delivery can retry and provider outages should not break order creation.

Before You Continue

  • You should know what a service boundary owns.
  • You should understand why data ownership matters.
  • You should be able to argue for a monolith, coarse services, or microservices.
  • You should be ready to choose synchronous or asynchronous communication between boundaries.