Hi! I recently completed the "NestJS Architecture & Advanced Patterns" course (which was excellent!), but I still feel a bit uncertain about communication between different modules.
The structure presented in this course looks like in the attachment.
The course primarily focused on a single "main" module - Alarms, which was well-organized and straightforward. However, I find it to be somewhat unrealistic.
Consider a scenario where we have a Products module instead. Following a similar structure, we would have a products/domain/product.ts model. However, all products typically belong to certain categories. In such a case, we'd include category: Category in our Product model, which ideally should reside in a separate Categories module, alongside its corresponding domain model, categories/domain/category.ts.
My question is: Is it appropriate for a product model to depend on a model from a different module? While they technically exist within the same layer, they are part of different modules. One alternative could be to redefine our module structure. Instead of separate Products and Categories modules, we could consolidate them into a single PIM (Product Information Management) module. However, this might lead to similar considerations for modules like Importer or Invoices down the line. Ultimately, some level of interconnection between models seems inevitable.
How are you, guys, solving it?