FARPβ’ and Octopus Gatewayβ’ are open-source projects maintained by XRAPHβ’. Octopus Gatewayβ’ is an HTTP/API gateway that natively speaks FARPβ’.
High-Performance, Extensible API Gateway in Rust
A cloud-native API gateway with automatic service discovery (FARP), dynamic routing, multi-protocol support, and a powerful plugin system.
- π Automatic Service Discovery - FARP protocol integration for zero-config routing
- β‘ High Performance - 100k+ RPS per instance, P99 latency < 10ms
- π Extensible - Dynamic plugin system for custom functionality
- π Multi-Protocol - REST, gRPC, WebSocket, SSE, GraphQL, WebTransport
- π Observability - Prometheus metrics, OpenTelemetry tracing, structured logging
- π‘οΈ Production Ready - Health checks, circuit breakers, graceful shutdown
- π Auto-Generated Docs - Federated OpenAPI/AsyncAPI from services
| Protocol | Status | Description |
|---|---|---|
| HTTP/1.1 | β | Full support with connection pooling |
| HTTP/2 | β | Multiplexing, server push |
| HTTP/3 (QUIC) | π§ | Experimental |
| gRPC | β | Proxying, reflection, transcoding |
| WebSocket | β | Bidirectional proxying |
| SSE | β | Server-Sent Events |
| GraphQL | β | Federation support |
| WebTransport | π§ | Experimental |
| Custom | β | Via plugins |
- β Kubernetes (native support)
- β Consul
- β etcd
- β Eureka
- β DNS SRV records
- β Static configuration
# From source
cargo install octopus-gateway
# Or download binary
curl -L https://github.com/xraph/octopus/releases/latest/download/octopus-linux-amd64 -o octopus
chmod +x octopus# config.yaml
server:
http_port: 8080
admin_port: 9090
discovery:
backend: kubernetes
kubernetes:
namespace: default
farp:
enabled: true
watch_interval: 5s# Run the gateway
octopus --config config.yaml
# Check health
curl http://localhost:9090/_/health
# View auto-generated OpenAPI docs
curl http://localhost:9090/_/openapi.json- Architecture Guide - System design and components
- FARP Integration - Service discovery details
- Plugin System - Creating plugins
- Agent Guide - For AI agents and contributors
- API Reference - REST API documentation
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Layer β
β HTTP/HTTPS β gRPC β WebSocket β GraphQL β Custom β
βββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β Octopus API Gateway β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Protocol Layer: HTTP β gRPC β WS β GraphQL β β
β ββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ β
β β Middleware: Auth β RateLimit β CORS β Scripting β β
β ββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ β
β β Router: Trie-based matching, Load balancing β β
β ββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ β
β β Service Registry (FARP Client) β β
β ββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ β
β β Plugin System: Dynamic loading, lifecycle mgmt β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β Discovery: K8s β Consul β etcd β Eureka β
βββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β Upstream Services β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- JWT Authentication - RS256, HS256, ES256 support
- Rate Limiter - Token bucket, distributed (Redis)
- Redis Cache - Response caching with TTL
- Kafka Producer - Event logging
- Metrics Exporter - InfluxDB, Datadog
use octopus_plugins::prelude::*;
pub struct MyPlugin;
#[async_trait]
impl Plugin for MyPlugin {
fn metadata(&self) -> PluginMetadata {
PluginMetadata {
name: "my-plugin".to_string(),
version: semver::Version::new(1, 0, 0),
// ...
}
}
fn middleware(&self) -> Vec<Arc<dyn Middleware>> {
vec![Arc::new(MyMiddleware)]
}
}
octopus_plugins::export_plugin!(MyPlugin);FARP (Forge API Gateway Registration Protocol) enables automatic service discovery and route generation.
- Services register with a
SchemaManifest(OpenAPI, AsyncAPI, gRPC protos) - Octopus watches discovery backend for manifest changes
- Gateway fetches schemas and generates routes dynamically
- Auto-generates federated API documentation
- Zero-downtime updates on schema changes
{
"version": "1.0.0",
"service_name": "user-service",
"service_version": "v1.2.3",
"schemas": [
{
"type": "openapi",
"spec_version": "3.1.0",
"location": {
"type": "http",
"url": "http://user-service:8080/openapi.json"
}
}
],
"capabilities": ["rest", "websocket"],
"endpoints": {
"health": "/health",
"metrics": "/metrics"
}
}See FARP Integration Guide for details.
server:
http_port: 8080
https_port: 8443
admin_port: 9090
workers: auto # CPU cores
tls:
enabled: true
cert: /etc/octopus/tls/cert.pem
key: /etc/octopus/tls/key.pem
discovery:
backend: kubernetes
kubernetes:
namespace: default
label_selector: "app.kubernetes.io/part-of=octopus"
farp:
enabled: true
watch_interval: 5s
schema_cache_ttl: 5m
routing:
load_balance: round-robin
timeout: 30s
retries: 3
circuit_breaker:
failure_threshold: 5
timeout: 60s
middleware:
- auth
- rate_limit
- cors
- compression
plugins:
- name: jwt-auth
path: /plugins/jwt-auth.so
config:
secret: ${JWT_SECRET}
admin:
enabled: true
address: 0.0.0.0:9090
auth:
type: basic
username: admin
password_hash: $2b$...
observability:
metrics:
enabled: true
path: /metrics
tracing:
enabled: true
exporter: otlp
endpoint: http://jaeger:4317
logging:
level: info
format: json# Gateway metrics
octopus_requests_total{method, status, route}
octopus_request_duration_seconds{method, route}
octopus_upstream_requests_total{upstream, status}
octopus_active_connections
octopus_circuit_breaker_state{upstream}
# FARP metrics
octopus_farp_services_total
octopus_farp_routes_total{service, type}
octopus_farp_schema_updates_total{service}
# Plugin metrics
octopus_plugin_loaded{plugin, version}
- OpenTelemetry support
- W3C Trace Context propagation
- Jaeger, Zipkin, Datadog exporters
{
"timestamp": "2025-11-01T12:00:00Z",
"level": "info",
"message": "request processed",
"trace_id": "abc123",
"method": "GET",
"path": "/users/123",
"status": 200,
"duration_ms": 45,
"upstream": "user-service-v1"
}docker run -p 8080:8080 -p 9090:9090 \
-v $(pwd)/config.yaml:/etc/octopus/config.yaml \
octopus/octopus:latestapiVersion: apps/v1
kind: Deployment
metadata:
name: octopus-gateway
spec:
replicas: 3
template:
spec:
containers:
- name: octopus
image: octopus/octopus:latest
ports:
- containerPort: 8080
name: http
- containerPort: 9090
name: admin
env:
- name: DISCOVERY_BACKEND
value: kubernetes
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "2000m"helm repo add octopus https://octopus.xraph.com/charts
helm install my-gateway xraph/octopus \
--set discovery.backend=kubernetes \
--set farp.enabled=true# Rust 1.75+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Tools
cargo install cargo-watch cargo-nextest cargo-audit# Clone repository
git clone https://github.com/xraph/octopus.git
cd octopus
# Build
cargo build --all-features
# Run tests
cargo test --all-features
# Run benchmarks
cargo bench
# Development mode with hot reload
cargo watch -x 'run --bin octopus -- --config config.dev.yaml'cargo fmt --all # Format
cargo clippy --all-features # Lint
cargo audit # Security
cargo deny check # Dependencies- Throughput: 100k+ RPS per instance (8 cores)
- Latency: P50: 2ms, P99: 8ms, P99.9: 15ms
- Memory: < 100MB baseline, scales linearly
- Connection Pool: 10k+ concurrent connections
# Using wrk
wrk -t12 -c400 -d30s http://localhost:8080/test
# Using k6
k6 run --vus 1000 --duration 30s load-test.jsWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for your changes
- Ensure all tests pass (
cargo test) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
feat: add WebSocket support
fix: resolve race condition in router
docs: update FARP guide
perf: optimize route matching
refactor: simplify plugin loading
test: add integration tests
This project is dual-licensed under:
- MIT License - LICENSE-MIT
- Apache License 2.0 - LICENSE-APACHE
Choose the license that best suits your needs.
Built with β€οΈ by the XRaph.
Powered by:
- Tokio - Async runtime
- Hyper - HTTP library
- Tower - Middleware framework
- Tonic - gRPC implementation
- Forge Framework - Go web framework
Inspired by:
- Kong, Traefik, Envoy - Production API gateways
- π Documentation: docs/
- π¬ Discussions: GitHub Discussions
- π Issues: GitHub Issues
- π§ Email: support@octopus.xraph.com
- Website: https://octopus.xraph.com
- GitHub: https://github.com/xraph/octopus
- Docs: https://octopus.xraph.com/docs
- Blog: https://octopus.xraph.com/blog
Ready to build? Let's go! π