#actix #tonic #actix-web #concurrent #grpc


actix-web and tonic concurrent runner

1 stable release

1.0.0 May 2, 2022

#640 in HTTP server

25 downloads per month

MIT license

94 lines

Build Status



  • actix-web-tonic is the concurrent runner of actix-web + tonic.
  • You can build a rich and fast server app using Web + gRPC so easily with the crate.


  1. Implement your actix-web server same as basically coding, and get the future:
let actix_future = HttpServer::new(|| { App::new().service(...
                   .workers(8) // <- # of workers setting is here in actix-web.
                   .run(); // <- this type is `Service`, it's an `impl` of `Future`.
  1. Implement your tonic server same as basically coding, and get the future:
let tonic_future = Server::builder().add_service(...
                   ...serve(addr); // <- this type is a simple `Future` of `asyncl`.
  1. Invoke in concurrent both of your actix-web future and your tonic future:
let tonic_worker_threads = 16; // <- # of workers setting is here in tonic.(=# of tokio workers)
let result = actix_web_tonic::invoke(actix_future, tonic_future, tonic_worker_threads);

And then, test your server:

# gRPC:
$ grpcurl -plaintext -import-path ./proto -proto helloworld.proto -d '{"name": "Tonic"}' '[::1]:50001' helloworld.Greeter/SayHello
  "message": "Hello Tonic!"
# Web:
$ curl '[::1]:50000/teapot' -v
*   Trying ::1:50000...
* Connected to ::1 (::1) port 50000 (#0)
> GET /teapot HTTP/1.1
> Host: [::1]:50000
> User-Agent: curl/7.68.0
> Accept: */*
* Mark bundle as not supporting multiuse
< HTTP/1.1 418 I'm a teapot
< content-length: 23
< date: Sun, 01 May 2022 23:29:41 GMT
* Connection #0 to host ::1 left intact
I like a green tea.🍵%

Motivation and Notes

  • I had try implements a single bin process actix-web + tonic service but it was little hard to code for every works. Then, I publish this crate. It will be a good little helps to the future of me, and ofcourse you who looks this crate.💕
  • Of course, this crate is for servers. If your goal is not to provide a server, you want to complete an applications, you will also need crates for the client side to fight WASM, HTML/CSS and UI/UX.💪




~567K SLoC