Skip to main content

Getting Started with Gateway Service

The Gateway Service is a high-performance API Gateway implemented in Rust using Actix Web.

Overview

The Gateway Service provides:

  • Request routing and proxying
  • Authentication and authorization
  • Rate limiting (Redis-based)
  • Circuit breaker
  • GraphQL federation
  • WebSocket proxying
  • gRPC proxying

Features

  • ✅ High performance (Rust/Actix Web)
  • ✅ Adaptive rate limiting
  • ✅ QoS priority queuing
  • ✅ Smart compression
  • ✅ ML-based routing
  • ✅ GraphQL complexity analysis
  • ✅ API versioning
  • ✅ Zero-trust security

Prerequisites

  • Rust 1.70+
  • PostgreSQL 14+ (optional, for persistence)
  • Redis (for rate limiting)
  • Docker (optional)

Quick Start

# Navigate to gateway service
cd shared/gateway

# Build and run
cargo run

# Or in release mode
cargo build --release
cargo run --release

Environment Variables

# Server
HOST=0.0.0.0
PORT=8000

# Authentication Service
AUTHENTICATION_SERVICE_URL=http://authentication:8001

# Redis (for rate limiting)
REDIS_URL=redis://localhost:6379

# Database (optional)
DATABASE_URL=postgresql://user:password@localhost:5432/wanga_gateway

# Logging
RUST_LOG=info,gateway=debug

Service Endpoints

The Gateway Service runs on port 8000 by default.

  • Health Check: GET http://localhost:8000/health
  • GraphQL Endpoint: POST http://localhost:8000/api/graphql
  • REST API: http://localhost:8000/api/v1/
  • Metrics: GET http://localhost:8000/metrics

Next Steps