EASYFundamentalssenior engineer

API Gateway vs Load Balancer

Explain the differences between an API Gateway and a Load Balancer. When would you use each?

Estimated Time: 15 minutes
#fundamentals#networking#architecture

Solution Overview

API Gateways route requests, authenticate/authorize, rate-limit, and transform payloads. Request/response interceptors implement cross-cutting concerns. Circuit breakers protect backends. Caching reduces upstream load.

Architecture Pattern

Request router with middleware pipeline and backend pool management

Key Concepts

RoutingMiddleware PipelineCircuit BreakerRequest TransformationRate Limiting

Used By Companies

KongAWS API GatewayEnvoy

Learn Implementation Details

Explore a complete guide for building this system from scratch with step-by-step tutorials:

Solution Overview

API Gateways route requests, authenticate/authorize, rate-limit, and transform payloads. Request/response interceptors implement cross-cutting concerns. Circuit breakers protect backends. Caching reduces upstream load.

Hints to Get Started
1

Consider the OSI model layers

2

Think about what happens to the request at each component

Companies
  • Kong
  • AWS API Gateway
  • Envoy
Key Concepts
  • Routing
  • Middleware Pipeline
  • Circuit Breaker
  • Request Transformation
  • Rate Limiting
Implementation Url

https://github.com/codecrafters-io/build-your-own-x#build-your-own-command-line-tool