My application consists of 2 parts:
- admin
- platform
Let's imagine we have a Cats entity, which we want to allow to CRUD on both sites. It means we need a service for it.
We also need controllers (note that DTO would be different in both sites). I think a good idea is to keep admin-related and platform-related controllers separately. So, I come up with the following structure:
- controllers
- admin
- cats.controller.ts
- ...
- admin.module.ts (contains all admin-related controllers and imports of required services)
- platform
- cats.controller.ts
- ...
- platform.module.ts (contains all platform-related controllers and imports of required services)
- controllers.module.ts (contains admin and platform controller modules)
- services
- ....
The structure seems organized enough for me so far, but I have seen a recommended nestjs way is to keep entity, controller, service and module together in the same directory, but I didn't find a nice way to do so under the requirements. Is the structure above alright? Is there any other better way to achieve what is needed?