recently I started a personal application using Angular 16 and NestJS as backend. I'm newbie with these technologies and I like all related with design patterns and architectural styles, so I would like to implement clean architecture in nestJS. I've seen videos explaining layers, folders structures, however trying to applying them, I've been facing difficulties to carry out a good separation of concerns related with what should be in which layer.
Here is my folder structure:
My project uses libraries such as JWT, TypeORM, Swagger, automapper, etc. and the difficulties are related with the decorators these libraries impose to the different classes forcing me to change the layer the classes have to reside.
The main reason as far I understand is because the innest layer such as domain should not depends on any external libraries/dependencies, however, my entities or domain models into domain layer requires ORM decorators to work as expected and decorators depends on the library, so I had to move these classes to infrastructure as seen below:
Same happened with DTOs that use swagger decorators, and interfaces that depends on such DTOs. I had to move many things causing that infrastructure layer get heavy containing a lot of folders and with a major responability and domain and application layers turned into a super thin layers with few files.
This kind of dependencies made me reconsider if trying to implement clean architecture is worth or better use the normal folder distribution.
Can you help me about this or what am I wrong?
thanks