How does an application service differ from a domain service, and where should repository interfaces live?
Short answer
An application service orchestrates a use case (load, call the domain, save, transaction); it is thin and holds no rules. A domain service holds business rules that belong to no single entity, and knows nothing about transactions or HTTP.
3 points to say:
- Application service: orchestrates, thin, knows transactions, authorization, publishing events.
- Domain service: rules spanning several aggregates (a transfer fee between two accounts); put logic in entities/value objects first.
- The repository interface lives in the domain, next to the aggregate it stores; the implementation lives in infrastructure.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.