api-gateway-patterns

Design API gateway architectures with rate limiting, authentication, routing, and circuit breaking.

7|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/camilooscargbaptista/cto-toolkit --skill api-gateway-patterns-camilooscargbaptista
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-gateway-patterns
Source: https://github.com/camilooscargbaptista/cto-toolkit/tree/main/api-gateway-patterns
Command: npx skills add https://github.com/camilooscargbaptista/cto-toolkit --skill api-gateway-patterns-camilooscargbaptista

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralizes cross-cutting gateway concerns so teams can consistently enforce rate limiting, authentication, routing, versioning, and resilience across microservices without duplicating logic in each service.

Core Features & Use Cases

  • Rate limiting patterns: Token bucket, sliding window, and tiered limits to control burst and sustained traffic.
  • Authentication & Versioning: Gateway-level auth (JWT, API keys) and URL/header-based versioning strategies with deprecation policies.
  • BFF & Transformations: Backend-for-Frontend patterns and request/response aggregation for mobile and web clients to optimize payloads and graceful degradation.
  • Fault tolerance: Circuit breaker state management, timeouts, health checks, and logging/tracing at the gateway.
  • Use case: When launching a mobile app behind Envoy, create a Mobile BFF for slim payloads, enforce per-tier rate limits, and add circuit breakers around payment and third-party APIs.

Quick Start

Generate an API gateway design for my microservices using Envoy that includes token-bucket rate limiting, header-based authentication, URL path versioning, a mobile BFF, and circuit breakers for external services.

Frequently Asked Questions about api-gateway-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design an API gateway architecture for microservices using Envoy?

An API gateway architecture centralizes cross-cutting concerns like request routing, JWT authentication, and circuit breaking across microservices. Using Envoy, you configure gateway policies to handle traffic management, versioning, and resilience without duplicating logic in each service.

What is the difference between token-bucket and sliding-window rate limiting?

Token-bucket rate limiting controls burst traffic by accumulating tokens over time, while sliding-window rate limiting smooths out request patterns by evaluating counts within a moving time frame. Both manage sustained traffic but suit different burst tolerance needs.

How do I implement a Backend-for-Frontend pattern for mobile clients?

A Backend-for-Frontend (BFF) pattern optimizes mobile payloads by aggregating requests and transforming responses at the gateway level. You configure the gateway to perform request and response aggregation, ensuring slim payloads and graceful degradation for mobile clients.

Does this API gateway design support Kong, NGINX, and Traefik?

Yes, the API gateway design applies to projects using Kong, NGINX, Traefik, or Envoy. You can map the gateway policies for authentication, routing, and rate limiting into the specific configuration format of your chosen gateway platform.

What is the best way to handle API versioning at the gateway level?

The best approach is enforcing URL or header-based API versioning strategies at the gateway. This centralizes version routing and allows you to apply deprecation policies consistently without requiring individual microservices to manage version parsing.

How do circuit breakers work in an API gateway?

Circuit breakers in an API gateway manage state to prevent cascading failures when external services fail. The gateway monitors timeouts and health checks, tripping the circuit to stop requests and allow downstream services to recover.