Let's say you have an app like Facebook, where each Publish can be labeled with a Place. Now the entire backend API of the social application (essentially the entire client API) is built using nodejs + postgres. But Places autocomplete is a custom API that is built in Golang for example.
Since the Places API is essentially based on a stateless database (using postgres) as it only stores information which should not be manipulated by the user, it makes sense to put it in its own micro-service.
So it makes sense to have the following architecture:
Service A – the main client's API / backend. In this service, I can like a message, follow a friend and post new messages.
Service B – will have all the information about the places and the API. This means that it will have tables with cities and countries and will expose an API to retrieve this information.
So, if a user posts a new message in London, department A will manage this action and create a record in their database inside the "Messages" table, where one of the columns will have the 39; London ID (found in the service table B).
Now the next time I want to get this message, I will only have the place id, but obviously we would like to show the information of this place (city name, country name, etc.) .).
This means that for an endpoint of "getPost (id = 2)" in service A, we will have to join the Places tables in service B. And that's the problem. Microservices should ideally not have intercommunication between them which would constitute a load of unwanted traffic. Frankly, I don't even know how and if it's even technically plausible.
The alternatives would be to have a monorepo with the Places in Go project, and the Main project in nodejs, with the same DB, or with 2 databases.
I am not able to properly weigh the pros and cons and likelihood of these alternatives, and would like to understand what is usually done in cases like this?
** P.S – Whether it is Monorepo architecture or micro-service, I intend to use Docker + Kubernetes.