0

I would like to build a microservices architecture to handle the following scenario: I have a building. The building has some kinds of devices. And the devices can be used by the users. In the system, the administrator can add a user and allow the user to use selected devices in the building.

I have user service, device service, building service, authentication service. Each service has own database. The problem is where to store relations between users and buildings, buildings and devices?

To indicate which user has access to the device I need to store relation: device_id - user_id but it should be in the table devices_users in the user service or in device service? The same for the relation building_id - user_id and device_id - building_id. Could anyone help my with this issue? Maybe I have designed the microservices in wrong way?

  • Why did you split this simple scenario into four services? – Lutz Horn May 15 at 11:16
  • I have no experience in microservices architecture and I split it based on domains/entities. So each microservice handle each type of entity. Maybe I should split it another way... – michalk93 May 15 at 12:10
  • A domain usually does not contain a single entity. It looks like the entities belong to the same domain. In this case I would not split at all but implement a single service that handles this domain. – Lutz Horn May 15 at 12:11
  • So should I have one microservice that handles users data, devices data, building data and relations between them? It seems to simple for microservices architecture at all, isn't it? – michalk93 May 15 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.