hexagonal-architecture

Hexagonal Architecture - Should I put repository interface in the Domain Layer or Application Layer


I can't find the ultimate answer for hexagonal architecture.

The question is in the title.

Should I put the repository interface in the Domain Layer or Application Layer ? Both seems to be correct but what is the main difference ?


Solution

  • This question has nothing to do with hexagonal architecture, but with DDD. And according to DDD, the repository interface belongs to the domain model. As a direct client of the domain, application layer calls the methods on repository interface.