CodePark/ questions / Monolith, modular monolith & microservices
START PRACTICINGPRACTICE
Backend question · System design & architecture › Monolith, modular monolith & microservices

In a microservices system using database per service, the Order service needs a customer's credit limit, which the Customer service owns. What is the right approach?

Call the Customer service's API, or keep a local read-only copy updated from its events

Database per service means you can only reach a service's data through its API or the events it publishes. This lets the owning service change its schema freely. So the Order service should call the Customer service's API, or keep a local read-only copy updated from its events.

"Query the Customer service's tables directly from the Order service" is wrong. It ties the two services together at the schema level. This recreates a
distributed monolith: services that are deployed separately but cannot change separately.