Microservices Design Patterns - API Gateway

Problem Statement

Microservice architecture structures an application as a set of loosely coupled microservices and each service can be developed independently in agile manner to enable continous delivery/deployment. When a large, complex application is to be built using microservice architecture, microservices can use different protocols. For example, some microservices are using REST and some are following AMQP. Now problem is how to allow clients to access each microservice seemlessly without worrying about protocols and other intricacies.


We can define an API Gateway which will acts as single entry point for all type of clients. Following are the other benefits of API Gateway −

  • Simple Proxy − API Gateway can acts as simple proxy to some requests to redirects them to relevant service.

  • Multiple Services − API Gateway can redirects call to multiple services.

  • Client Specific API − API Gateway can provide client specific API as well, like a different API for Desktop version than a Mobile Application.

  • Protocol Handling − API Gateway handles the communication protocols to each service call internally and clients are concerned only with request/response.

  • Security and Authentication − API Gateway can implement a security that each request goes to service only after authentication and authorization.


Consider an example of an Online Book Store. API Gateway allows to use the online Book store APIs on multiple devices seemlessly.

API Gateway Design Pattern


  • Client Insulation − Clients are insulated from knowing the location of microservices or how to call them.

  • Multiple Service Calls − API Gateway can handle multiple services and give result as one and thus can reduce the round trips and increase the performance.

  • Standard Interface − API Gateway provides a standard interface to Clients to get responses from microservices.

Kickstart Your Career

Get certified by completing the course

Get Started