Installation
Add to Cargo.toml
[dependencies]
grpc_graphql_gateway = "0.2"
tokio = { version = "1", features = ["full"] }
tonic = "0.12"Optional Features
The gateway supports optional features that can be enabled in Cargo.toml:
[dependencies]
grpc_graphql_gateway = { version = "0.2", features = ["otlp"] }| Feature | Description |
|---|---|
otlp |
Enable OpenTelemetry Protocol export for distributed tracing |
Prerequisites
Before using the gateway, ensure you have:
- Rust 1.70+ - The gateway uses modern Rust features
- Protobuf Compiler -
protocfor generating descriptor files - gRPC Services - Backend services to proxy requests to
Installing protoc
macOS
brew install protobufUbuntu/Debian
sudo apt-get install protobuf-compilerWindows
Download from the protobuf releases page.
Proto Annotations
To use the gateway, your .proto files need GraphQL annotations. Copy the graphql.proto file from the repository:
curl -o proto/graphql.proto https://raw.githubusercontent.com/Protocol-Lattice/grpc_graphql_gateway/main/proto/graphql.protoThis file defines the custom options like graphql.schema, graphql.field, and graphql.entity that the gateway uses to generate the GraphQL schema.
Next Steps
Once installed, proceed to the Quick Start guide to create your first gateway.