Inter-service communication and data integrity in NestJS
Now that we understand how NestJS supports the microservices architecture, let’s see how microservices communicate with one another. Before we proceed, we need to transform our current structure into a mono repo one. Note that depending on the application’s requirements, you may need to have multiple repositories. We will keep things simple for now and use a mono repo structure.
To do this transition – from the standard mode to a mono repo structure – we can use the power of the nest-cli
and generate multiple applications easily. We need to have a unique API gateway project, which will expose the entry point to our clients, and two more services, for example, the order service and the inventory service. Feel free to use any example that resonates better with you.
To generate those services, use the following command at the root of the project:
$ nest generate app order # then $ nest generate...