tonic implements gRPC over HTTP/2 in Rust with async/await. It includes transport, codegen from protobuf, and optional health and reflection helpers.
Overview
tonic is a Rust library for building gRPC services and clients that speak HTTP/2. It targets production use with first-class async/await support and is positioned as a core building block for networked Rust systems.
The design splits a generic gRPC layer from a concrete HTTP/2 stack built on hyper and tokio, plus codegen driven by prost to generate clients and servers from protobuf definitions. Features called out in the docs include bidirectional streaming, TLS via rustls, load balancing, custom metadata, authentication, and standard health checking.
Companion crates cover build-time service generation, well-known gRPC types, a health-check service implementation, and server reflection. Tutorials and example projects walk through helloworld and richer routeguide-style APIs, with interop samples for advanced gRPC behavior.
Some build APIs rely on the protoc compiler when compiling protobuf sources. The project is licensed under MIT and maintained as part of the broader gRPC ecosystem for Rust.
Key features
- Bidirectional streaming RPCs
- Async HTTP/2 transport on hyper
- Protobuf codegen via prost
- TLS support with rustls
- Load balancing and custom metadata
- Authentication hooks
- gRPC health checking helper
- Server reflection crate
Use cases
- Rust microservices exposing gRPC APIs
- Calling remote gRPC backends from Rust
- Streaming RPC workloads
- Interop with other gRPC implementations
- Production HTTP/2 services in tokio