Course contentsShow
← Software Engineering
Lesson 1306 of 1,93339. Microservices ArchitectureFree lesson

Domain-Driven Design Bounded Contexts

Using DDD bounded contexts to define service boundaries where each service owns its domain model and ubiquitous language.

Domain-Driven Design Bounded Contexts

What You'll Learn

You'll understand how to use DDD bounded contexts to define clear service boundaries in microservices architecture, where each service owns its domain model and speaks its own consistent language.

The Core Idea

A bounded context is an explicit boundary within which a domain model and its ubiquitous language are internally consistent. In microservices, each service should align with one bounded context—meaning it owns its complete domain model, data, and terminology without sharing these directly with other services.

Think of bounded contexts like different departments in a company. "Customer" means something specific in Sales (someone who buys), but something different in Support (someone who needs help). Each department (context) has its own complete understanding of what "Customer" means, and they don't share the same customer object—they translate information when communicating across department boundaries.

How It Defines Service Boundaries

When you identify bounded contexts in your domain:

  1. Each context becomes a microservice with its own database and model
  2. Same term, different meanings are isolated (e.g., "Order" in Checkout vs. Fulfillment)
  3. Translation happens at boundaries through well-defined APIs or events
  4. No shared domain objects across contexts—each service has its own representation

For example, an e-commerce platform might have:

  • Catalog Context: Product as searchable items with descriptions
  • Inventory Context: Product as stock units with quantities
  • Order Context: Product as line items with prices at purchase time

Each service has its own Product concept tailored to its needs, preventing the "god object" problem.

Benefits for Microservices

Bounded contexts prevent services from becoming tightly coupled through shared models. Teams can evolve their domain model independently as long as the API contract remains stable.

Key Takeaway: Use DDD bounded contexts to create microservices where each service owns its complete domain model and ubiquitous language, translating between contexts at service boundaries rather than sharing models directly.