1 2 3A rust implementation of [gRPC], a high performance, open source, general 4RPC framework that puts mobile and HTTP/2 first. 5 6[`tonic`] is a gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility. This library was created to have first class support of async/await and to act as a core building block for production systems written in Rust. 7 8[](https://crates.io/crates/tonic) 9[](https://docs.rs/tonic) 10[](LICENSE) 11 12 13[Examples] | [Website] | [Docs] | [Chat][discord] 14 15## Overview 16 17[`tonic`] is composed of three main components: the generic gRPC implementation, the high performance HTTP/2 18implementation and the codegen powered by [`prost`]. The generic implementation can support any HTTP/2 19implementation and any encoding via a set of generic traits. The HTTP/2 implementation is based on [`hyper`], 20a fast HTTP/1.1 and HTTP/2 client and server built on top of the robust [`tokio`] stack. The codegen 21contains the tools to build clients and servers from [`protobuf`] definitions. 22 23## Features 24 25- Bi-directional streaming 26- High performance async io 27- Interoperability 28- TLS backed by [`rustls`] 29- Load balancing 30- Custom metadata 31- Authentication 32- Health Checking 33 34## Getting Started 35 36- The [`helloworld`][helloworld-tutorial] tutorial provides a basic example of using `tonic`, perfect for first time users! 37- The [`routeguide`][routeguide-tutorial] tutorial provides a complete example of using `tonic` and all its features. 38 39Examples can be found in [`examples`] and for more complex scenarios [`interop`] 40may be a good resource as it shows examples of many of the gRPC features. 41 42### Rust Version 43 44`tonic`'s MSRV is `1.75`. 45 46### Dependencies 47 48[`tonic-build`] uses `protoc` [Protocol Buffers compiler] in some APIs which compile Protocol Buffers resource files such as [`tonic_build::compile_protos()`]. 49 50[Protocol Buffers compiler]: https://protobuf.dev/downloads/ 51[`tonic_build::compile_protos()`]: https://docs.rs/tonic-build/latest/tonic_build/fn.compile_protos.html 52 53## Getting Help 54 55First, see if the answer to your question can be found in the API documentation. 56If the answer is not there, there is an active community in 57the [Tonic Discord channel][discord]. We would be happy to try to answer your 58question. If that doesn't work, try opening an [issue] with the question. 59 60[issue]: https://github.com/hyperium/tonic/issues/new/choose 61 62## Project Layout 63 64- [`tonic`]: Generic gRPC and HTTP/2 client/server implementation. 65- [`tonic-build`]: [`prost`] based service codegen. 66- [`tonic-types`]: [`prost`] based grpc utility types including support for gRPC Well Known Types. 67- [`tonic-health`]: Implementation of the standard [gRPC health checking service][healthcheck]. 68 Also serves as an example of both unary and response streaming. 69- [`tonic-reflection`]: A tonic based gRPC reflection implementation. 70- [`examples`]: Example gRPC implementations showing off tls, load balancing and bi-directional streaming. 71- [`interop`]: Interop tests implementation. 72 73## Contributing 74 75:balloon: Thanks for your help improving the project! We are so happy to have 76you! We have a [contributing guide][guide] to help you get involved in the Tonic 77project. 78 79[guide]: CONTRIBUTING.md 80 81## License 82 83This project is licensed under the [MIT license](LICENSE). 84 85### Contribution 86 87Unless you explicitly state otherwise, any contribution intentionally submitted 88for inclusion in Tonic by you, shall be licensed as MIT, without any additional 89terms or conditions. 90 91 92[gRPC]: https://grpc.io 93[`tonic`]: ./tonic 94[`tonic-build`]: ./tonic-build 95[`tonic-types`]: ./tonic-types 96[`tonic-health`]: ./tonic-health 97[`tonic-reflection`]: ./tonic-reflection 98[`examples`]: ./examples 99[`interop`]: ./interop 100[`tokio`]: https://github.com/tokio-rs/tokio 101[`hyper`]: https://github.com/hyperium/hyper 102[`prost`]: https://github.com/tokio-rs/prost 103[`protobuf`]: https://protobuf.dev/ 104[`rustls`]: https://github.com/rustls/rustls 105[`interop`]: https://github.com/hyperium/tonic/tree/master/interop 106[Examples]: https://github.com/hyperium/tonic/tree/master/examples 107[Website]: https://github.com/hyperium/tonic 108[Docs]: https://docs.rs/tonic 109[discord]: https://discord.gg/6yGkFeN 110[routeguide-tutorial]: https://github.com/hyperium/tonic/blob/master/examples/routeguide-tutorial.md 111[helloworld-tutorial]: https://github.com/hyperium/tonic/blob/master/examples/helloworld-tutorial.md 112[healthcheck]: https://grpc.io/docs/guides/health-checking/ 113