I'm currently designing a new online platform where the frontend will be Angular using Angular Universal and the backend will be a sort of Node.js clustered microservices.

The question itself is what is the best approach for the microservices:

  1. One clustered NestJS API Gateway serving the frontend with REST End points, connected internally via Kafka with all the microservices
  2. Several NestJS microservices each serving their own REST APIs with nginx as loadbalancer & reverse proxy serving everything to the frontend

Thank you! H

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Nov 3, 2021 at 21:44

1 Answer 1


There is no such thing as "best approach" in engineering: every choice is taken considering requirements, context, organizational concerns. The question needs to be elaborated a bit more...but in general:

  • an API gateway acts as a façade towards the platform internals: it lets client to consume your services through a consitent interface (in a nutshell: a single base URL) and manages cross cutting API management concerns, such as authentication, composition, rate limiting etc

  • Load balancer/reverse proxy can be seen as a "baby API gateway" since it offers to map ingress routes to backend services, but afaik no prodcut offers the same flexibility of an API gateway, which is designed to manipulate requests and responses on behalf of core microservices

  • A load balancer/ reverse proxy is not always meant as a replacement of an API Gateway: the latter still needs to horizontally scale, so you will bootstrap or shutdown replicas as request load changes, so a load balancer can route requests towards each replica

  • API gateway is especially useful when it can serve 3rd party applications (public API) or client rendered UI (SPAs, mobile apps, desktop apps)

  • Server-side rendered UIs are more well suited to directly consume data from core microservices as they are not exposed outside the boundaries of the platform. Also client rendered UIs might need something more sophisticated than an API gateway (which basically only does mapping beetween ingoing/outgoung calls and applies processing pipelines) because some applications need to perform complex presentation logic. This is the case where Backend-for-frontend pattern is applied

So the answer to the question involves some evaluation about the composition of the clients, the infrastructure architecture as well as considering the development process, since every change in the platform core API might involve changes in the edge layer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.