Lior Ohana
Lior Ohana

Reputation: 3527

Gateway API vs Frontend Service

I'm struggling in what would be a better approach for a project I'm working on. I'm working on a micro-service based SaaS where I have several services for some functionality, each one with its own REST APIs. My dilemma right now is whether to:

  1. Include my frontend UI in a gateway service that will provide both UI and business logic that will proxy requests to other services.
  2. Have a service that will only allow the user access to the UI while all content will be retrieved via AJAX directly with the different services.

Thoughts?

Thanks

Upvotes: 1

Views: 948

Answers (1)

Sergey Alaev
Sergey Alaev

Reputation: 3962

Here are some considerations:

  1. Security. If your micro services are data-oriented (as they should be) do they know about end-user accounts and implement necessary checks? If you are going to call them via AJAX directly, they must be secured.

  2. Performance. To get good performance, microservices must be called in parallel. Does your client architecture support that?

  3. Service locator. What do you use to locate service instances, do healthcheck and failover? Usually all that is too complex to be used directly from javascript.

  4. API. Think about cost of maintaining backward compatibility for multiple small all-around APIs vs single application-specific API.

  5. I'm not saying that you should go and create Gateway. Because not creating gateway is less code and less APIs. You should weight everything and decide for yourself.

Upvotes: 1

Related Questions