Completed

Lightweight API Gateway

A high-performance API gateway with rate limiting, authentication, and request routing.

Go Redis Docker Prometheus

Overview

A lightweight, high-performance API gateway designed for microservices architectures. Handles authentication, rate limiting, and request routing with minimal latency overhead.

Features

  • Rate Limiting: Token bucket algorithm with Redis backend
  • Authentication: JWT validation and API key management
  • Routing: Path-based and header-based routing rules
  • Observability: Prometheus metrics and structured logging
  • Configuration: Hot-reload configuration without restart

Architecture

┌─────────────┐     ┌──────────────┐     ┌────────────┐
│   Client    │────▶│  API Gateway │────▶│  Services  │
└─────────────┘     └──────────────┘     └────────────┘
                           │
                    ┌──────┴──────┐
                    │    Redis    │
                    └─────────────┘

Performance

Benchmarked at 50,000+ requests per second on modest hardware with:

  • P99 latency under 5ms
  • Memory usage under 100MB

Configuration Example

routes:
  - path: /api/users/*
    upstream: http://users-service:8080
    rate_limit: 100/minute

  - path: /api/orders/*
    upstream: http://orders-service:8080
    auth: jwt

Deployment

Available as a Docker image:

docker run -p 8080:8080 vikasmishra/api-gateway