Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
High-performance Rust gateway bridging gRPC to GraphQL with Apollo Federation v2.
Transform gRPC microservices into a unified GraphQL API. Zero GraphQL code required.
🚀 Performance at a Glance
Performance Rankings (Rust):
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. grpc_graphql_gateway ████████████████████ 112,000 req/s 🚀
2. async-graphql (Actix) █████████░░░░░░░░░░░ 45,000 req/s
3. Juniper (Actix) ████████░░░░░░░░░░░░ 39,000 req/s
Data Efficiency Mode (GBP Ultra + Parallel):
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
JSON Payload (1GB) ████████████████████ 100%
GBP Ultra (9MB) ▏ 0.9% ⚡ (1,749 MB/s)
Compression by Data Pattern:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Highly Repetitive (orgs/perms) ▏ 1% (99% reduction)
Moderately Repetitive (enums) █████ 25% (75% reduction)
Unique/Varied (logs) ██████████ 50% (50% reduction)
✨ Features
| Category | Capabilities |
|---|---|
| Core | Schema generation, Queries/Mutations/Subscriptions, WebSocket, File uploads |
| Live Queries | @live directive, Real-time updates, Invalidation triggers, WebSocket push |
| Federation | Apollo Federation v2, Entity resolution, DataLoader batching, No N+1 |
| Production | Health checks, Prometheus, OpenTelemetry, Rate limiting, Circuit breaker |
| Security | Query depth/complexity limits, Introspection control, Query whitelisting |
| Performance | SIMD JSON, Sharded Cache, Response caching (Redis), APQ, Request collapsing |
| Connectors | REST APIs, OpenAPI integration, Multi-descriptor stitching |
📦 Quick Start
[]
= "0.5.5"
= { = "1", = ["full"] }
use ;
const DESCRIPTORS: & = include_bytes!;
async
Endpoints: http://localhost:8888/graphql | ws://localhost:8888/graphql/ws | ws://localhost:8888/graphql/live
🌐 Federation
builder
.enable_federation
.with_entity_resolver
.build?;
🎯 Apollo Router + Live Queries
The GBP Router provides a high-performance federation router with built-in live query support:
# router.yaml
server:
listen: "0.0.0.0:4000"
workers: 16
subgraphs:
- name: users
url: "http://localhost:4002/graphql"
- name: products
url: "http://localhost:4003/graphql"
rate_limit:
global_rps: 100000
per_ip_rps: 1000
# Circuit Breaker Configuration
circuit_breaker:
failure_threshold: 10 # Open after 10 failures
recovery_timeout: 30000 # Wait 30s (in ms) before retry
half_open_max_requests: 5 # Allow 5 test requests
Features:
- ✅ Live Queries via WebSocket -
ws://localhost:4000/graphql/live - ✅ 99% Bandwidth Reduction - GBP compression for subgraph communication
- ✅ 150K+ RPS - Sharded cache + SIMD JSON parsing
- ✅ DDoS Protection - Two-tier rate limiting (global + per-IP)
- ✅ Real-time Updates -
@livedirective support - ✅ APQ Support - Automatic Persisted Queries
- ✅ Request Collapsing - Deduplicate identical in-flight requests
Live Query Example:
const ws = ;
ws.;
✅ Configuration Validation
You can validate your router.yaml without starting the server, useful for CI/CD pipelines:
# Output:
# 🔍 Validating configuration: router.yaml
# ✅ Configuration is valid!
# - Subgraphs: 3
# - Listen: 0.0.0.0:4000
🔧 Production Config
builder
.enable_health_checks // /health, /ready
.enable_metrics // /metrics (Prometheus)
.enable_tracing // OpenTelemetry
.with_query_depth_limit // DoS protection
.with_query_complexity_limit
.with_response_cache
.with_circuit_breaker
.build?;
⚡ Live Queries
Real-time updates with the @live directive + 4 advanced optimization features:
# Connect to ws://localhost:8888/graphql/live
# Basic live query
query @live {
users {
id name status
}
}
# Advanced: Filtered live query (50-90% bandwidth reduction)
query @live {
users(status: ONLINE) {
users { id name }
}
}
Advanced Features
- Filtered Queries - Server-side filtering:
users(status: ONLINE) @live - Field-Level Invalidation - Track exactly which fields changed
- Batch Invalidation - Merge rapid updates (70-95% fewer requests)
- Client Caching Hints - Smart cache directives based on data volatility
Result: Up to 99% bandwidth reduction in optimal scenarios!
Configure in your proto:
rpc GetUser(GetUserRequest) returns (User) {
option (graphql.schema) = { type: QUERY, name: "user" };
option (graphql.live_query) = {
enabled: true
strategy: INVALIDATION
triggers: ["User.update", "User.delete"]
throttle_ms: 100 // Enables batching
};
}
Trigger updates from mutations:
// After mutation, invalidate affected queries
LIVE_QUERY_STORE.invalidate;
📚 Examples
📦 Client SDKs
Official high-performance decoders for GBP:
- TypeScript/JavaScript:
@protocol-lattice/graphql-binary-protocol
import { GbpDecoder } from '@protocol-lattice/graphql-binary-protocol';
const decoder = new GbpDecoder();
const decompressed = decoder.decodeLz4(new Uint8Array(data));
🔗 Links
📖 Full Documentation • 📦 Crates.io • 💻 GitHub
Made with ❤️ by Protocol Lattice