Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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"] }
FeatureDescription
otlpEnable OpenTelemetry Protocol export for distributed tracing

Prerequisites

Before using the gateway, ensure you have:

  1. Rust 1.70+ - The gateway uses modern Rust features
  2. Protobuf Compiler - protoc for generating descriptor files
  3. gRPC Services - Backend services to proxy requests to

Installing protoc

macOS

brew install protobuf

Ubuntu/Debian

sudo apt-get install protobuf-compiler

Windows

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.proto

This 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.