#How to Handle Many-to-Many Relationships Across Microservices with Separate Databases?

5 messages · Page 1 of 1 (latest)

uncut forge
#

I’m currently practicing developing a project using a microservice architecture, which includes:
• Authentication: Manages user authentication, authorization, and user information
• Course: Manages course-related data

Each service has its own separate database. So how can I handle many-to-many relationships across services? I would appreciate any advice or suggestions.
Sincerely, thank you!

hollow quail
#

Can you explain how you want to relate these two services and data etc? (will help anyone trying to help you 🙂 )

uncut forge
#

Here for example I have two services auth and course, auth will manage users and roles (admin, teacher, student ....), now I want to get all courses of a student
for example so now I am calling api to service course with student id, So is there any better way! remember that each service manages separate database

willow spade
#

Are the microservices completely separate projects, or is it modularized monolith?

And what do you mean by "many-to-many" relationship? A database query runs on one specific connection, and it can't reach across to a different connection, even if it's just a different schema on the same server. BelongsToMany relationships use joins to identify related rows, so it needs to have all the tables available.

uncut forge