Hi, I need to create a well-structured layered architecture for medium-sized projects. I chose this approach because the projects I'm gonna build will not be large, instead just medium-sized applications. DDD is an overkill for them, especially when I want to create MVPs quickly and in an easy way and I think trying to use DDD for example would do more harm than good. I want to find conventions and advice that could help me create a solid and straightforward structure for projects. I won't change DB in the furure, I won't change my ORM which is PrismaORM.
Therefore I've got some questions concerning the correct implementation of layered architecture:
- while some actions would require some logic should I create one service per use case for example: CreateOrderAndEmptyCartService
- what about queries, as they do not contain business logic should all of them be in one service?
- I've seen repository pattern in layered architecture, is it suitable to my use cases where I won't change DB, ORM and I'm using Prisma? I tried to create a repositoy for User for example, but I've got an impression that I just made an additional class which is a wrapper to for example findFirst method (and other) which with only Prisma takes just one line of code. More than that, when I want to have types inferred correctly, I can not dynamically pass include: { account: true } for example and I have no other idea than giving all possible includes in the repository method and then not to use most of the join results when I do not need them which seems kinda lame.
- should I make different services for different roles for example Admin and User in a case when Admin has to receive different responseDto than User for the same query?
Last but not least, do you have any example of medium-sized applications to share so I could see how it should be done?
Regards