Search code examples
cqrsclean-architecture

In Clean Architecture with CQRS pattern, should a type used only in a command go in the Application or in the Entities layer?


In Clean Architecture applied to an API with CQRS pattern, if I have a command in the Application layer for modeling the post payload of an endpoint and that command has a property of type X that is only used in that command: should that type X go in the Entities layer or in the same Application layer?


Solution

  • According to clean architecture the entities layer only contains "cross enterprise logic". So if your type X is only used by this command, this type should be on the application layer as well.