Search code examples
architectureclean-architecture

Is there a good way to merge Vertical Slice and Clean Architecture?


I would like to know if it is a good idea to merge the Vertical Slice Architecture with Clean Architecture.

Create something like, we have inside of the solution, the WebApi project, Application project, Domain project and Infrastructure project.

I saw a lot people creating all things inside of the Vertical UseCase directory, but when the project is growing it is a good chance to create more and more files. And my doubt is if it is a good idea to separate in each Vertical has your own Domain and Infrastructure layer.


Solution

  • As Jimmy Bogard writes in his blog post the beauty of the approach is that each slice can use abstractions which are appropriate for it:

    With this approach, each of our vertical slices can decide for itself how to best fulfill the request:

    enter image description here

    Obviously it would be preferable not to go wild implementing every slice with completely different approach but still you can select appropriate ones depended on the case without need to force one style for all.

    but when the project is growing it is a good chance to create more and more files.

    Is this such a big problem though? Since they will be grouped up pretty nicely it should not be a problem from developer perspective and I highly doubt that there will be chance that you will have enough to choke the compiler.