Skip to content

Kairos Gateway

Welcome to the official documentation for Kairos Gateway, a high-performance, multi-protocol API gateway built with Rust and Actix-Web.

Crates.io Documentation License

What is Kairos?

Kairos is designed to be a modern, production-ready gateway that handles not just HTTP, but multiple protocols including WebSocket, FTP, and DNS. It incorporates intelligent AI-driven routing capabilities, making it a forward-thinking choice for modern microservices architectures.

Key Features

  • 🚀 High Performance: Built with Rust and Actix-Web for maximum throughput and minimal latency.
  • ⚡ In-Memory Caching: High-throughput response caching with configurable TTL, auto-invalidation, and $O(1)$ dynamic route match caching.
  • 🔀 Transformations: Fine-grained request/response headers, path rewrites, query param modification, and status code mapping.
  • 🧠 AI-Powered Routing: Route requests dynamically based on content complexity using LLMs.
  • 🔄 Multi-Protocol Support: Seamlessly proxy HTTP/HTTPS, WebSockets, FTP, and DNS.
  • ⚖️ Advanced Load Balancing: Round-robin, least connections, random, weighted, and IP hash strategies.
  • 🛡️ Robust Security: Built-in JWT authentication, rate limiting, and request validation.
  • 🏥 Resilience: Circuit breakers, automatic health checks, and configurable retry logic with exponential backoff.
  • 📊 Observability: Prometheus metrics, real-time WebSocket metrics streaming, and a modern Vue 3 web UI dashboard.
  • 🔧 Hot Reload: Update your routing configuration without dropping a single connection.

Quick Start

1. Installation

You can run Kairos Gateway using Docker (recommended) or install it via Cargo.

docker pull ghcr.io/danielsarmiento04/kairos-rs:latest
cargo install kairos-gateway
git clone https://github.com/DanielSarmiento04/kairos-rs.git
cd kairos-rs
cargo build --release --bin kairos-gateway

2. Basic Configuration

Create a config.json file to define your routes:

{
  "version": 1,
  "server": {
    "host": "0.0.0.0",
    "port": 5900
  },
  "routers": [
    {
      "external_path": "/api/users",
      "internal_path": "/users",
      "methods": ["GET", "POST"],
      "backends": [
        {
          "host": "http://localhost",
          "port": 8080,
          "weight": 1
        }
      ]
    }
  ]
}

3. Run the Gateway

docker run -d \
  -p 5900:5900 \
  -v $(pwd)/config.json:/app/config.json:ro \
  ghcr.io/danielsarmiento04/kairos-rs:latest
kairos-gateway --config ./config.json

4. Verify

Check the health of your gateway:

curl http://localhost:5900/health

Next Steps

Explore the guides to unlock the full potential of Kairos Gateway:

  • Architecture & Design: Deep dive into internal modules, request lifecycle, and caching layers.
  • Configuration Guide: Learn how to configure load balancing, rate limiting, circuit breakers, and transformations.
  • SSL Offloading & TLS Termination: Deploy behind reverse proxies (Nginx, Caddy, Cloud ALBs) with HTTPS and WebSocket offloading.
  • AI Routing Guide: Discover how to use LLMs for smart request routing.
  • UI Dashboard: Set up and use the real-time Vue 3 web administration interface.
  • Examples: Try out ready-to-run Docker Compose examples.