{"id":20145861,"url":"https://github.com/usagi/actix-web-tonic","last_synced_at":"2025-04-09T19:20:36.297Z","repository":{"id":62444441,"uuid":"487705227","full_name":"usagi/actix-web-tonic","owner":"usagi","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-16T16:15:26.000Z","size":21,"stargazers_count":12,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T21:11:25.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usagi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-02T03:28:12.000Z","updated_at":"2025-02-08T07:43:11.000Z","dependencies_parsed_at":"2022-11-01T22:16:13.158Z","dependency_job_id":null,"html_url":"https://github.com/usagi/actix-web-tonic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Factix-web-tonic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Factix-web-tonic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Factix-web-tonic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Factix-web-tonic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usagi","download_url":"https://codeload.github.com/usagi/actix-web-tonic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248094991,"owners_count":21046770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T22:18:27.753Z","updated_at":"2025-04-09T19:20:36.258Z","avatar_url":"https://github.com/usagi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![github]](https://github.com/usagi/actix-web-tonic)\u0026ensp;[![crates-io]](https://crates.io/crates/actix-web-tonic)\u0026ensp;[![docs-rs]](https://docs.rs/actix-web-tonic)\u003cbr\u003e\n[![Build Status](https://travis-ci.org/usagi/actix-web-tonic.svg?branch=master)](https://travis-ci.org/usagi/actix-web-tonic)\n\n[github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\n[crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge\u0026labelColor=555555\u0026logo=rust\n[docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logoColor=white\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K\n\n!(image1)[https://imgur.com/5qaPfr3.png]\n\n# actix-web-tonic\n\n- `actix-web-tonic` is the concurrent runner of `actix-web` + `tonic`.\n- You can build a rich and fast server app using Web + gRPC so easily with the crate.\n\n## Usage\n\n1. Implement your `actix-web` server same as basically coding, and get the future:\n\n```rust\nlet actix_future = HttpServer::new(|| { App::new().service(...\n                   ...brabrabra...\n                   .bind(\"[::1]:50000\").unwrap()\n                   .workers(8) // \u003c- # of workers setting is here in actix-web.\n                   .run(); // \u003c- this type is `Service`, it's an `impl` of `Future`.\n```\n\n2. Implement your `tonic` server same as basically coding, and get the future:\n\n\n```rust\nlet tonic_future = Server::builder().add_service(...\n                   ...brabrabra...\n                   ...serve(addr); // \u003c- this type is a simple `Future` of `asyncl`.\n```\n\n3. Invoke in concurrent both of your actix-web future and your tonic future:\n\n```rust\nlet tonic_worker_threads = 16; // \u003c- # of workers setting is here in tonic.(=# of tokio workers)\nlet result = actix_web_tonic::invoke(actix_future, tonic_future, tonic_worker_threads);\n```\n\nAnd then, test your server:\n\n```zsh\n# gRPC:\n$ grpcurl -plaintext -import-path ./proto -proto helloworld.proto -d '{\"name\": \"Tonic\"}' '[::1]:50001' helloworld.Greeter/SayHello\n{\n  \"message\": \"Hello Tonic!\"\n}\n```\n\n```zsh\n# Web:\n$ curl '[::1]:50000/teapot' -v\n*   Trying ::1:50000...\n* TCP_NODELAY set\n* Connected to ::1 (::1) port 50000 (#0)\n\u003e GET /teapot HTTP/1.1\n\u003e Host: [::1]:50000\n\u003e User-Agent: curl/7.68.0\n\u003e Accept: */*\n\u003e\n* Mark bundle as not supporting multiuse\n\u003c HTTP/1.1 418 I'm a teapot\n\u003c content-length: 23\n\u003c date: Sun, 01 May 2022 23:29:41 GMT\n\u003c\n* Connection #0 to host ::1 left intact\nI like a green tea.🍵%\n```\n\n- Want you all of the example?\n  - =\u003e The full example is here: [examples/simple/](examples/simple/)\n\n## Motivation and Notes\n\n- 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.💕\n- 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.💪\n\n## LICENSE\n\n- [MIT](LICENSE.md)\n\n## Author\n\n- USAGI.NETWORK / Usagi Ito \u003chttps://github.com/usagi/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusagi%2Factix-web-tonic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusagi%2Factix-web-tonic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusagi%2Factix-web-tonic/lists"}