Expand description
OxiGeo API Gateway
Enterprise-grade API gateway for geospatial services, built on a real axum 0.8 HTTP serving layer that wires together every component below.
§Features
- Rate Limiting: Token bucket, leaky bucket, fixed/sliding window algorithms
- Authentication: API keys, JWT, OAuth2, session management, MFA
- API Versioning: Multiple version support with negotiation and migration
- GraphQL: Full GraphQL server with subscriptions and DataLoader
- WebSocket: Connection multiplexing and message routing
- Middleware: CORS, compression, caching, logging, metrics
- Load Balancing: Multiple strategies with health checks and circuit breaker
- Transformation: Request/response transformation and format adaptation
- Serving Layer:
GatewayServerbinds the above into an axum router
§Routes
| Method | Path | Purpose |
|---|---|---|
| GET | /health | Liveness plus a per-backend health snapshot |
| GET | /gateway/metrics | Aggregate request/response/error counters (JSON) |
| POST | /graphql | GraphQL queries and mutations (when enabled) |
| GET | /graphql | GraphiQL playground (when introspection is enabled) |
| * | /graphql/ws | GraphQL subscriptions (when subscriptions enabled) |
| GET | /ws | WebSocket upgrade (when WebSockets are enabled) |
| * | (fallback) | Load-balanced reverse proxy to registered backends |
§Example
use oxigeo_gateway::{Gateway, GatewayConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = GatewayConfig::default();
let gateway = Gateway::new(config)?;
gateway.serve("0.0.0.0:8080").await?;
Ok(())
}For finer control (backends, custom handlers, versioning, transformation), build a
GatewayServer directly:
use oxigeo_gateway::{GatewayConfig, GatewayServer};
use oxigeo_gateway::loadbalancer::Backend;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let server = GatewayServer::builder(GatewayConfig::default())
.with_backend(Backend::new("api".into(), "http://127.0.0.1:9000".into(), 1))
.require_auth(false)
.build()?;
server.serve("0.0.0.0:8080").await?;
Ok(())
}Re-exports§
pub use error::GatewayError;pub use error::Result;pub use server::GatewayServer;pub use server::GatewayServerBuilder;
Modules§
- auth
- Authentication and authorization module.
- error
- Error types for the OxiGeo API Gateway.
- graphql
- GraphQL module structure
- loadbalancer
- Load balancing module.
- middleware
- Gateway middleware module.
- rate_
limit - Rate limiting framework for API gateway.
- server
- Axum-based HTTP serving layer for the OxiGeo API gateway.
- transform
- Request/response transformation module.
- versioning
- API versioning framework.
- websocket
- WebSocket multiplexing and connection management.
Structs§
- Gateway
- API Gateway instance.
- Gateway
Config - Gateway configuration.