Definition

  • An API Gateway.
  • A reverse proxy (Based on Nginx + OpenResty).
  • A traffic control layer for microservices.
Client (Browser / Mobile / Game)
        |
        v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        API Gateway      β”‚
β”‚  (Routing / Auth / CORS)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        |
        v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ player-serviceβ”‚ battle-serviceβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        |
        v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Database / Cache      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Concepts

Service

Represents an upstream backend service.

Service:    player-service
URL:        http://player-service:8080

One backend service = usually one Kong Service.

Route

  • Defines how requests are matched and forwarded to a Service.
  • Routes can match by:
    • Path (/api/players)
    • Host (api.example.com)
    • Method (GET, POST)
    • Headers (Route β†’ Service)

Plugin

  • Adds functionality without touching backend code.
  • Common plugins:
    • Authentication (JWT, Key Auth)
    • CORS
    • Rate Limiting
    • Request / Response Transformation
    • Logging & Metrics
  • Plugins can be attached to:
    • Global
    • Service
    • Route
    • Consumer

Consumer

  • Represents anΒ API client / user.
  • Used together with auth plugins:
    • API keys
    • JWT credentials
    • OAuth tokens