Sharing code between microservices is always tricky. We need to make sure that a common dependency does not break our microservices freedom. The major goals that we want to achieve while sharing code are:
- Share common code among our microservices, while making sure that our code is Don't Repeat Yourself (DRY)—it is a coding principle with the main aim to reduce any repetition of code
- Avoid tight coupling through any common shared library, as it eliminates the freedom of microservices
- Enable simple changes in order to sync the code we can share between our microservices
Microservices are something that introduce code duplications. Creating an npm package with a new code base for any such business use case is highly ...