royib / clean-architecture-nestJS

An in-depth implementation of Clean Architecture using NestJS and type-script
795 stars 192 forks source link

Using Framework import in core module #4

Open MTA1711 opened 2 years ago

MTA1711 commented 2 years ago

Hi,

Thanks for your article. I noticed that in your core module you are using element from class-validator and @nestjs/mapped-types. Does the core module shouldn't use that king of stuff

royibenita commented 2 years ago

Hey, You have raised a good point Dto's belong to the controller (interface adapters) layer. our entities and use cases are the only components that belongs to the entities (Enterprise business rules) layer. the location of the dto files in the core layer is just for convenient and personal preference, you can move them to a different location that will be more clear for you as long as you preserve the dependency rules. Unlike .Net and Spring, Node.js doesn't come with a lot of tools, In our architecture we use NestJS as our core framework, all the tools that belong to NestJs aren't considered to be a clean architecture "Framework". so it is ok to use "class-validator" in the interface adapters layer