Glossary
Aggregate
What is an Aggregate?

In Domain-Driven Design (DDD), an Aggregate is a cluster of domain objects that are treated as a single unit. An aggregate contains one or more entities, with one designated as the Aggregate Root. The aggregate root is the only permitted entry point for modifying any of the entities within the aggregate boundary, ensuring consistency by enforcing business rules across the entire aggregate.

Key points about an aggregate:

  • It encapsulates a group of objects that must be treated as a unit to maintain data integrity.
  • Operations outside the aggregate must interact through the aggregate root, not act directly on its internal entities.
  • Aggregates help organize and structure complex domains, ensuring boundaries and consistency in your domain model.

Example:

In an e-commerce system, an Order aggregate might include the order entity, line items, and shipping details, with the Order being the aggregate root. All modifications or queries related to the order are performed through the aggregate root.