Skip to content

Latest commit

 

History

History
129 lines (66 loc) · 3.73 KB

File metadata and controls

129 lines (66 loc) · 3.73 KB

Gateway

[TOC]

api_gateway_summary

API Gateway

An API Gateway is a key component in system design, particularly in microservices architectures and modern web applications. It serves as a centralized entry point for managing and routing requests from clients to the appropriate microservices or backend services within a system.

api_gateway

Methods Of Authentication

  • API Keys
  • OAuth
  • JWT(JSON Web Tokens)
  • LDAP(Lightweight Directory Access Protocol)

API Gateway Workflow

working_of_api_gateway

  • Routing

    Directs client requests to the appropriate service based on URL, method, or headers.

  • Protocol Translation

    Converts requests between protocols (e.g., HTTP -> gRPC/WebSocket).

  • Request Aggregation

    Combines multiple backend class into one to reduce round trips.

  • Authentication & Authorization

    Verifies client identity and access permissions.

  • Rate Limiting & Throttling

    Controls request rates to prevent abuse and ensure resource balance.

  • Load Balancing

    Distributes requests across service instances for scalability and availability.

  • Caching

    Stores backend responses to speed up repeated requests.

  • Monitoring & Logging

    Tracks metrics and logs for performance and usage insights.

API Gateway with Microservices

api_gateway_with_microservices

  • The web application communicates with the API Gateway.
  • The API Gateway routes requests to the appropriate microservices.
  • It handles authentication, rate limiting, caching, and other functions.
  • Error responses are also standardized by the API Gateway.

API Gateway with Monolith

api_gateway_with_monolith

  • The web application communicates with the API Gateway.
  • The API Gateway simplifies client interactions and provides security and caching and other features.
  • It also manages API versioning and error handling.

API Gateway Use Cases

api_gateway_use_case

Example 1: Tinder’s API Gateway

High-Level Design

tinder_api_gateway_high_lvl_design

(TAG: Tinder API Gateway)

This design unlocks three critical outcomes:

  • Faster developer workflows, since most changes require no code, only config.
  • Stronger security boundaries, because teams own and isolate their gateway instances.
  • Better reuse, through shared filters and common middleware patterns.

Boot Flow

tinder_proc_flow

This design ensures that routing logic executes with minimal overhead. Every decision has already been made. Every route, predicate, and filter is compiled into the runtime graph.

Request Lifecycle

tinder_request_lifecycle

When a request hits a TAG-powered gateway, it passes through a well-defined pipeline of filters, transformations, and lookups before reaching the backend.

Summary

API Gateway vs Service Mesh

api_gateway_vs_service_mesh

Reference

[1] What is API Gateway?

[2] API Gateway

[3] API Gateway vs Service Mesh - Which One Do You Need

[4] How Tinder’s API Gateway Handles A Billion Swipes Per Day

[5] Top 4 API Gateway Use Cases

[6] API Gateway