Skip to main content
Glossary

API Gateway

A server that acts as a single entry point for API calls, routing requests to appropriate services, handling authentication, and enforcing policies.

Detailed Explanation

An API gateway sits between clients and backend services, providing a unified API surface. It handles: request routing (forward to appropriate service), authentication (verify tokens), rate limiting (prevent abuse), request/response transformation (adapt formats), caching (reduce backend load), and monitoring (log all requests).

Popular API gateways: Kong (open-source, NGINX-based), AWS API Gateway (managed), Cloudflare API Shield, and Express Gateway (Node.js). API gateways are essential in microservices architectures where clients need to communicate with many services.

Why It Matters

API gateways simplify client integration, enforce security policies, and provide a unified interface to microservices. They are essential for managing complex service architectures.

Real-World Example

A mobile app calls one API gateway endpoint. The gateway authenticates the request, routes it to the appropriate microservice (users, orders, products), aggregates the response, and returns a single result to the app.

When to Use

When you have multiple backend services that clients need to access, or when you need centralized authentication, rate limiting, and monitoring for your APIs.

Advantages

  • Single entry point for clients
  • Centralized authentication and authorization
  • Rate limiting and throttling
  • Request/response transformation
  • Monitoring and logging

Disadvantages

  • Single point of failure if not redundant
  • Added latency for each request
  • Can become a bottleneck
  • Configuration complexity
  • May not support all backend protocols

Frequently Asked Questions

Do I need an API gateway for a small application?

Not always. For a simple monolith with a few endpoints, direct access is fine. For microservices or when you need centralized auth, rate limiting, and monitoring, an API gateway adds significant value.

What is the difference between API gateway and load balancer?

A load balancer distributes traffic across servers. An API gateway provides routing, authentication, rate limiting, and transformation. A gateway includes load balancing but adds more functionality.

Which API gateway should I use?

Kong (open-source, NGINX-based), AWS API Gateway (managed, AWS-native), Cloudflare API Shield (edge, CDN-integrated), or Traefik (modern, auto-discovery). Choose based on your infrastructure and requirements.

Can an API gateway handle GraphQL?

Some can (Kong, Apollo Federation). Most API gateways are designed for REST. For GraphQL, consider a GraphQL gateway (Apollo Federation, Schema Stitching) that federates multiple GraphQL services.

What is request transformation in an API gateway?

Request transformation modifies incoming requests before forwarding: adding headers, changing paths, converting formats (JSON to XML), and enriching with data from other services. It decouples client and backend APIs.

Back to Glossary

Browse all terms in our software development glossary.

Browse All Terms