You m ay have found an issue with the way your solution is structured but in fact I think it's completely unrealistic to expect any decent sized application to not share code across microservices. I think loose coupling is a good goal in general but must be balanced with other considerations. For example we share a domain class library across services and a data access layer along with "interface" libraries that allow us to standardize on known interfaces. Although there are shared dependencies each service is independently deployable because they can depend on different versions of the library, managed by our package feed. Without code reuse the amount of duplicated work would be enormous. You can try to mitigate coupling by considering bounded contexts for each service.

--

--

Lee Dale

I am a lead software developer with a keen interest in cybersecurity . Currently studying for a MSc in Advanced Information Security and Digital Forensics.