Skip to content

Domain Layer

The Domain Layer contains the core business logic. It is completely independent of infrastructure concerns.

In This Section

Key Principles

Independence: The Domain Layer has no dependencies on other layers. It defines interfaces (ports) that infrastructure implements.

Immutability: Value Objects are readonly classes and return new instances on state changes. Entities use readonly on identity properties; state properties mutate in place via behavior methods.

Self-Validation: Value Objects validate their data in constructors. Invalid data cannot exist.

Ubiquitous Language: Class and method names reflect business terminology.