DEV Community

Cover image for API Gateway
Pragya Sapkota
Pragya Sapkota

Posted on • Originally published at pragyasapkota.Medium

API Gateway

We have API management tools that help create a bridge between a client and the backend services. As the name gateway itself suggests, this is an entry point to get into the system so that the clients can have a well-tailored API. Apart from these, an API gateway is responsible for authentication, monitoring, load balancing, caching, throttling, logging, etc. With the APIs provided by different microservices, the clients can easily interact with multiple kinds of services.

The main purpose of an API gateway is to create an entry point that lets the clients in the system work with various features. Some common examples of API gateways are Amazon API Gateway, Apigee API Gateway, Azure Gateway, Kong API Gateway, etc.

Features of API Gateway

Advantages

  • The client code is simplified.
  • Some features like monitoring, analytics, tracing, etc.
  • The internal structure of an API is encapsulated.

Disadvantages

  • The configuration operations are challenging.
  • Performance might be affected.
  • A single point of failure can cause problems to find out.
  • Scaling should be done properly to avoid bottlenecks.

BFF Pattern

BFF stood for Backend for Frontend and was first introduced by Sam Newman. It can be defined as a pattern where we create separate backend services for a specific frontend interface. We can implement a BFF pattern if we wish to avoid customizing a single backend service for multiple interfaces.

However, the output might sometimes differ from the format of the front end. We can have the front end loaded with some logic to reformat the data so that the BFF can be used to shift some logic to the intermediate layer.

The pattern also gets the formats and sends the data after receiving it from the service. GraphQL is an excellent example of BFF performance.

There are some conditions where it would be a great deal if the BFF pattern is used.

  • If you want to optimize the backend to meet the expectations of a specific client.
  • If we need to customize general-purpose backends to accommodate multiple interfaces.
  • If the general-purpose backend must be maintained with substantial development overhead.

I hope this article was helpful to you.

Please don’t forget to follow me!!!

Any kind of feedback or comment is welcome!!!

Thank you for your time and support!!!!

Keep Reading!! Keep Learning!!!

Top comments (0)