← Academy

API Gateways

Centralized entry points for microservices routing

In microservice architectures, clients (web/mobile apps) shouldn't talk directly to dozens of backend services. Instead, they hit a single entry point called the API Gateway.

The API Gateway is responsible for:

  • Routing: Inspecting path prefixes (e.g. /api/v1/users or /api/v1/posts) and forwarding request queries to the correct microservice fleet.
  • Security & Authentication: Ensuring requests are authenticated before passing them back.
  • Rate Limiting: Preventing denial-of-service (DoS) attacks by throttling heavy traffic.
  • Load Balancing: Distributing requests across servers inside each microservice pool.
  • In the diagram, our API Gateway has rules configured:

  • /api/v1/posts maps to POST_SERVICE (balanced across Server 2 and Server 3).
  • /api/v1/users maps to USER_SERVICE (balanced to Server 1).
  • If a client requests an endpoint path that is not defined, or if the destination server doesn't expose it, the gateway handles routing validation and returns 404 Not Found or 405 Method Not Allowed.


    Interactive Checkpoints:

    Simulate Wrong Gateway Routing

    Load

    Click to point all posts routes to USER_SERVICE on Server 1. Watch how the gateway routes post requests to Server 1, causing endpoint mismatches.

    Running1/0

    No frames available