Let's say a project has an application layer and a domain layer.
AFAIK services implemented in the application layer execute use cases.
The methods defined in the services often contain ubiquitous language. Do the interfaces of these services belong in the application layer or the domain layer?
-
Why do these interfaces exist? Place them in the most ‘inner’ layer where you use them. Also, the ubiquitous language should not only exist in the domain layer, but everywhere in your bounded context. It doesn’t make sense not to use the ubiquitous language in API controllers, application services, database tables, etc.Rik D– Rik D02/06/2025 18:34:24Commented Feb 6 at 18:34
1 Answer 1
The most principled place for such an interface would be in its own abstractions library along with any models specific to the service.
However. This can end up with a million libraries each containing only one interface. It's not very practical when you probably only use the service in one application and never make other interface implementations.
Unless you are publishing to the world I would either just have the interface in the same library as the service. OR consider it part of the domain and put it with the domain models