tonic

An async, high-performance gRPC over HTTP/2 framework for Rust built on Tokio and Hyper

Framework
Cargo
v0.14.6
12,483 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
89 /100 Excellent
Development Activity 96
Maintenance 84
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
80 /100 Excellent
Architecture 87
Code Quality 88
Innovation 80
Learning Curve 65

tonic is a Rust implementation of gRPC that layers a fully async client and server on top of Tokio’s async runtime and the hyper HTTP/2 stack. It ships a tonic-build code generator that turns .proto service definitions into strongly-typed Rust client stubs and server traits, so services are called and implemented with ordinary async functions rather than hand-rolled wire encoding.

Beyond the core RPC path, tonic provides first-class TLS (rustls-backed), interceptors/middleware via tower::Service, streaming (unary, client-streaming, server-streaming, bidi-streaming) support, and companion crates for server reflection, health checking, and web/gRPC-Web interop. It is the de-facto standard gRPC library in the Rust ecosystem and underpins production systems at companies including Linkerd’s proxy control plane and many other cloud-native Rust services.

What You Get

  • tonic-build: compiles .proto files into typed Rust client/server code at build time via prost
  • Full HTTP/2 transport with TLS (rustls) client and server support
  • All four gRPC streaming modes: unary, client-streaming, server-streaming, and bidirectional streaming
  • tower::Service-based interceptors and middleware for auth, logging, and request modification
  • Companion crates: tonic-health (health checking protocol), tonic-reflection (server reflection), tonic-web (gRPC-Web browser interop)
  • Load balancing and channel management for gRPC clients

Common Use Cases

  • Building an internal microservice mesh where Rust services call each other over typed gRPC contracts
  • Exposing a Rust backend to gRPC-Web browser clients via the tonic-web companion crate
  • Implementing gRPC health-check and reflection endpoints expected by service meshes and infrastructure tooling (Envoy, Linkerd, grpcurl)
  • Streaming large or long-lived data feeds (telemetry, logs, real-time updates) between async Rust services

Under The Hood

Architecture - tonic’s src/ splits cleanly into client, server, codec, transport, and service modules; codegen.rs provides the glue that generated tonic-build output hooks into at compile time. Requests and responses are wrapped in tonic’s own Request<T>/Response<T> types carrying gRPC metadata (metadata/), and the transport layer builds directly on hyper/h2 for HTTP/2 framing with an optional axum-based router feature for combining gRPC and HTTP routes in one server.

Tech Stack - Rust 2024 edition, built on Tokio for the async runtime, hyper/hyper-util/h2 for HTTP/2, tower/tower-service for the middleware/interceptor model, prost for protobuf encoding (via the tonic-prost/tonic-prost-build split introduced to decouple codec choice from the core crate), and tokio-rustls for TLS with a choice of ring or aws-lc-rs crypto backends.

Code Quality - The workspace has dedicated tests/ at the root plus per-crate test suites (e.g. tonic-web/tests, tonic-reflection/tests), an interop crate implementing the official gRPC interop test suite, and a grpc-benchmark crate for performance regression tracking. Feature-gating is used extensively (gzip, zstd, tls-ring vs tls-aws-lc, router, server) to keep the dependency footprint minimal for consumers who only need a subset of functionality.

API Design - Generated code exposes idiomatic async trait methods for server implementations and typed async client methods, so calling a gRPC method looks like calling any other async Rust function; tower::Service composition means existing tower middleware (retries, timeouts, load balancing) works with tonic clients/servers with minimal glue code, though the sheer number of Cargo features can make initial configuration non-trivial for newcomers.

Used by 11 apps in this directory

Rust
99%
Other

Fluree DB

Databases

469

A temporal, verifiable graph database with git-like branching, integrated vector/text/geo search, and RDF/SPARQL/JSON-LD/openCypher support — benchmarked at 10.4x faster than the next database on the full Wikidata dump.

View details
87
Repo Health
74
Technical
65
Dependency
Built with
Rust 99%
Updated 5 days ago
TypeScript
64%
Apache 2.0

Laminar

AI Development · Monitoring

3,285

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
85
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 64%
Rust 34%
Updated 5 days ago
TypeScript
64%
Apache 2.0

Laminar

AI Development · Monitoring

3,285

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
85
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 64%
Rust 34%
Updated 5 days ago
Rust
71%
Apache 2.0

mesh-llm

AI Agents · AI Development

3,463

Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.

View details
84
Repo Health
91
Technical
69
Dependency
Built with
Rust 71%
TypeScript 13%
Python 10%
Updated 4 days ago
Rust
92%
Apache 2.0

Murr

Databases

111

A RocksDB-based NVMe/S3 cache purpose-built for AI inference workloads — a faster Redis replacement optimized for batch, low-latency, zero-copy reads and writes between data pipelines and inference apps.

View details
63
Repo Health
72
Technical
76
Dependency
Built with
Rust 92%
Updated 2 weeks ago
Rust
85%
Apache 2.0

OpenShell

AI Agents · Developer Tools

8,811

The safe, private runtime that lets autonomous AI agents operate in sandboxed environments governed by declarative YAML policies — blocking data exfiltration, credential leaks, and unauthorized network activity before they happen.

View details
85
Repo Health
81
Technical
68
Dependency
Built with
Rust 85%
Updated 4 days ago
Go
81%
AGPL 3.0

PeerDB

Data Engineering · Databases

3,288

Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
Go 81%
TypeScript 12%
Updated 4 days ago
Go
81%
AGPL 3.0

PeerDB

Data Engineering · Databases

3,288

Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
Go 81%
TypeScript 12%
Updated 4 days ago
Go
81%
AGPL 3.0

PeerDB

Data Engineering · Databases

3,288

Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
Go 81%
TypeScript 12%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers