I’d like to check with your opinions on how to design the API services in Lagom. I have something that I want to try.
Let’s say in my Lagom project, I have following services:
Admin service is like an “internal gateway” service, that any interactions between internal company staffs and the system will be done through this admin service.
The service will be responsible for authenticating the internal users, and also responsible for invoking the other services like accounting service on behalf of the caller.
The reason for doing this is that the business domain requires very strict auditing of all user activities within the system.
So let’s say, if the internal staff wants to check the account balance of the system, from the GUI, internal user will invoke the end-point exposed by the Admin Service, Admin Service will authenticate the user, and check if the user has the right permission to make that call, if so, it makes the synchronous call using “.invoke()” to the Accounting service and return the result back to the user.
Also, if the internal staff wants to create a new record in the system, she will make POST call the Admin Service end-point and so on.
The plan is that in Kubernetes, only the Admin Service will be exposed to the load balancer, and the Admin GUI only interacts with the Admin Service APIs, nothing else.
What do you think about this kind of architecture?
Also, is it okay for API service to have dependencies on the other API services in Lagom? This is in order to avoid having to duplicate the data structure at the API level when invoking other services.