Let's say I have NestJs project, that consists of following parts, each with it's own git repository and deployed on different machines:
- Api service
- Message-queue processing workers service
Both of the services require part #3 - library for accessing RabbitMq. Let's say that #3 is some abstraction around the RabbitMq client that defines entities and services, that access MQ, so the modules #1. and #2. doesn't even know, they are working with RabbitMq. #3 is planned to be included / used as a library in #1 and #2, not as a microservice.
How should this be integrated together? Let's assume it from the perspective of API service:
- It has the RabbitMq module inside the node_modules folder.
- I want to use e.g. dependency injection in that RabbitMq library. Ideally, expose it as NestJs module, to be used in @Module imports of API module.
Should I use NestJs as peerDependency in the RabbitMq module?
I have like 3-4 shared-modules I need to share between the modules #1 and #2. Not just MQ.