Skip to content

Gatify

Self-hosted API gateway with intelligent rate limiting, real-time analytics, and zero vendor lock-in.

2025Go, Redis, TimescaleDB, Docker, API Gateway

Problem

Commercial API gateways come with vendor lock-in, opaque pricing, and limited customization. Developers need a self-hosted alternative that's easy to deploy, performant, and gives full control over rate limiting rules and analytics.

Constraints

  • Must handle 10K+ requests per second with sub-millisecond overhead
  • Rate limiting state must be distributed (Redis) for horizontal scaling
  • One-command deployment with Docker Compose
  • Zero vendor lock-in, fully self-hosted and open source

Key Decisions

  1. Go over Node.js for the gateway

    API gateways need raw throughput and low latency at the proxy layer.

    Chose Go for its goroutine concurrency model, low memory footprint, and excellent HTTP performance for proxy workloads.

    Trade-off: More verbose than Node.js, but significantly better performance for high-throughput proxy workloads where every microsecond counts.
  2. Sliding window over fixed window rate limiting

    Fixed window allows burst traffic at window boundaries.

    Implemented sliding window algorithm in Redis for smooth, accurate rate limiting without boundary bursts.

    Trade-off: Slightly more Redis operations per request, but prevents the 2x burst problem at window boundaries that fixed windows allow.
  3. TimescaleDB over plain PostgreSQL for analytics

    Analytics data is time-series, need efficient time-range queries and automatic partitioning.

    Used TimescaleDB (PostgreSQL extension) for hypertables with automatic time-based partitioning and compression.

    Trade-off: Adds a specialized database dependency, but dramatically improves query performance on time-series analytics data.
Timeline
2025
Stack
Go, Redis, TimescaleDB, Docker, API Gateway, Rate Limiting, Open Source