#Doubts about Microservices

4 messages · Page 1 of 1 (latest)

sage prairie
#

Hello everyone, I have a small question that I would like to clarify with you. I am creating a microservices application in which I currently have 3 Microservices (api-gateway, user microservice and authentication microservice)

In the user microservice I manage all the information of the users and their operations (use TypeORM) and create the users entity within that microservice.

However, from the authentication microservice I need to access that table in some way (so that I still don’t know how to achieve)

I know I can do SQL queries natively with the TypeORM entity manager but I don’t know how safe that is.

What do you recommend to me to be able to access the login data in the user microservice?

The two Microservices share the same database.

leaden leaf
#

The question you should ask yourself is, what data do the two services really need to know about? That determines their entities. For instance, the auth service only needs to know what is needed to authorize the user. Maybe username and password? Theoretically services can use the same database, but they shouldn't share schema. So, each service should have its own table or tables. I hope that makes sense.

grim vessel
#

to ad on Scotts reply you might want to read up on bounded contexts to get a better idea (not essential)

sage prairie