Skip to content

Tonic

A Rust library for building gRPC clients and servers with async/await support.grpc/grpc-rust

Stars
12.5k
Forks
1.3k
Licence
MIT
Language
Rust
Last update
6 days ago
Type
Library

What it is

Tonic is a Rust library for gRPC, a framework for remote procedure calls where a program calls functions on another program over the network. It runs over HTTP/2 and supports async/await, so developers can write both the client and server side in Rust. The README describes it as a core building block for production systems.

  • Define a service in a .proto file and generate Rust client and server code with tonic-build
  • Build a server that streams responses back to clients
  • Add TLS to a gRPC service using rustls
  • Add a standard gRPC health checking endpoint with tonic-health

Great for

  • Rust developers building services that talk over gRPC
  • Teams that want async/await support in their network services
  • Projects that need streaming, TLS, or health checks in a gRPC service
  • Developers who want generated client and server code from Protocol Buffers definitions

Not ideal for

  • People who do not write Rust, since this is a Rust library and needs a Rust toolchain
  • Projects that do not use gRPC or Protocol Buffers, since the library is specific to that stack
  • Beginners with no grounding in async Rust, since the README does not offer a gentle introduction to async concepts
Step-by-step guide: how to use TonicInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Rust toolchain (MSRV 1.88) · protoc (Protocol Buffers compiler) for some code generation APIs

    Clone the repository

    git clone https://github.com/grpc/grpc-rust
  2. 2

    Run it

    • Install the Rust toolchain at version 1.88 or newer
    • Install protoc if you plan to use tonic_build::compile_protos()
    • Work through the helloworld tutorial in examples/helloworld-tutorial.md
    • Try the routeguide tutorial for a fuller example
  3. 3

    Get the most out of it

    • Read the helloworld and routeguide tutorials in order, since they cover basic and advanced usage
    • Use tonic-health for a standard health checking service
    • Use tonic-reflection to add a gRPC reflection service
    • Check the examples directory for TLS, load balancing, and bi-directional streaming samples
    • Browse the API docs on docs.rs for details on each crate

Downloads

Strengths

  • Built for async/await from the start, on top of the tokio and hyper ecosystem
  • Covers common needs such as bi-directional streaming, TLS, load balancing, and authentication
  • Includes helloworld and routeguide tutorials for first-time users

Trade-offs

  • Requires a Rust toolchain at MSRV 1.88 or newer, and the protoc compiler for some code generation APIs
  • The master branch is preparing breaking changes, so users wanting stable code should use the 0.14.x branch
  • Some features listed (such as load balancing) are described only briefly in the README, so details need the examples or docs

How it compares

ProjectStarsTypeLevelUpdatedBest for
grpc-rust (this)12.5kLibraryintermediate6 days agoRust developers building services that talk over gRPC
go-zero33.4kLibraryintermediate5 days agoGo developers building REST APIs or microservices
kratos26kLibraryintermediate4 days agoGo developers building a set of backend services that talk over HTTP or gRPC
fastapi105kLibrarybeginner4 days agoPython developers building JSON APIs or back-end services
query50.5kLibraryintermediate4 days agoFrontend developers building apps that load data from a server
async28.1kLibraryintermediate5 days agoJavaScript developers who need to run many asynchronous operations over a collection of items

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.