{"id":31622853,"url":"https://github.com/youyuanwu/flatbuffers-tonic","last_synced_at":"2026-01-20T17:03:52.037Z","repository":{"id":314051150,"uuid":"1052371852","full_name":"youyuanwu/flatbuffers-tonic","owner":"youyuanwu","description":"flatbuffers with gRPC for Rust","archived":false,"fork":false,"pushed_at":"2025-11-08T05:10:04.000Z","size":85,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-12T14:06:19.001Z","etag":null,"topics":["flatbuffers","grpc","tonic"],"latest_commit_sha":null,"homepage":"","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/youyuanwu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-08T00:26:31.000Z","updated_at":"2025-12-04T03:07:06.000Z","dependencies_parsed_at":"2025-09-10T10:00:32.580Z","dependency_job_id":"19ad4b3f-4220-43dd-9534-05bf04360eb2","html_url":"https://github.com/youyuanwu/flatbuffers-tonic","commit_stats":null,"previous_names":["youyuanwu/tonic-fbs","youyuanwu/flatbuffers-tonic"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/youyuanwu/flatbuffers-tonic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youyuanwu%2Fflatbuffers-tonic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youyuanwu%2Fflatbuffers-tonic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youyuanwu%2Fflatbuffers-tonic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youyuanwu%2Fflatbuffers-tonic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youyuanwu","download_url":"https://codeload.github.com/youyuanwu/flatbuffers-tonic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youyuanwu%2Fflatbuffers-tonic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["flatbuffers","grpc","tonic"],"created_at":"2025-10-06T17:36:10.403Z","updated_at":"2026-01-20T17:03:52.028Z","avatar_url":"https://github.com/youyuanwu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flatbuffers-tonic\n[![build](https://github.com/youyuanwu/flatbuffers-tonic/actions/workflows/CI.yml/badge.svg)](https://github.com/youyuanwu/flatbuffers-tonic/actions/workflows/CI.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/youyuanwu/flatbuffers-tonic/main/LICENSE)\n[![Crates.io](https://img.shields.io/crates/v/flatbuffers-tonic)](https://crates.io/crates/flatbuffers-tonic)\n[![Documentation](https://docs.rs/flatbuffers-tonic/badge.svg)](https://docs.rs/flatbuffers-tonic)\n[![codecov](https://codecov.io/github/youyuanwu/flatbuffers-tonic/graph/badge.svg?token=PFCKMRK6P2)](https://codecov.io/github/youyuanwu/flatbuffers-tonic)\n\nExperimental implementation of using [flatbuffers](https://github.com/google/flatbuffers/tree/master/rust/flatbuffers) with [tonic](https://github.com/hyperium/tonic) gRPC for Rust.\n\n## Get started\nThe usage is almost the same as tonic with prost.\n\nAdd deps to your cargo.toml\n```toml\n[dependencies]\nflatbuffers-tonic = { version = \"*\" }\nflatbuffers = { version = \"*\" }\n\n[build-dependencies]\nflatbuffers-tonic-build = { version = \"*\" }\n```\nAdd to your build.rs\n```rs\nfn main() {\n    flatbuffers_tonic_build::compile_flatbuffers_tonic(\u0026[\n        \"../fbs/fbs.helloworld.fbs\",\n        \"../fbs/sample.fbs\",\n    ])\n    .expect(\"flatbuffers tonic compilation failed\");\n}\n```\nInclude the generated code the same way as using tonic directly:\n```rs\n// flatbuffers code has warnings.\n#![allow(warnings)]\ntonic::include_proto!(\"flatbuffers_tonic.fbs.helloworld\");\ntonic::include_proto!(\"flatbuffers_tonic.sample\");\n```\nWrite tonic server:\n```rs\nuse crate::generated::{self, OwnedHelloReply, OwnedHelloRequest};\nuse flatbuffers_tonic::FBBuilder;\n\npub struct Greeter {}\n\n#[tonic::async_trait]\nimpl generated::greeter_server::Greeter for Greeter {\n    async fn say_hello(\n        \u0026self,\n        request: tonic::Request\u003cOwnedHelloRequest\u003e,\n    ) -\u003e Result\u003ctonic::Response\u003cOwnedHelloReply\u003e, tonic::Status\u003e {\n        let request = request.into_inner();\n        let name = request.get_ref().name();\n        println!(\"Got a name: {name:?}\");\n        let mut builder = FBBuilder::new();\n        let hello_str = builder\n            .get_mut()\n            .create_string(\u0026format!(\"hello {}\", name.unwrap_or(\"\")));\n        let reply = generated::fbs::helloworld::HelloReply::create(\n            builder.get_mut(),\n            \u0026generated::fbs::helloworld::HelloReplyArgs {\n                message: Some(hello_str),\n            },\n        );\n        let resp = builder.finish_owned(reply).into();\n        Ok(tonic::Response::new(resp))\n    }\n}\n\nasync fn run_server(listener: tokio::net::TcpListener) {\n  let svc = generated::greeter_server::GreeterServer::new(Greeter {});\n  tonic::transport::Server::builder()\n      .add_service(svc)\n      .serve_with_incoming_shutdown(\n          tonic::transport::server::TcpIncoming::from(listener),\n          token.cancelled(),\n      )\n      .await\n      .unwrap();\n}\n```\nUse tonic client:\n```rs\n    // run client to send a msg\n    let mut client = generated::greeter_client::GreeterClient::connect(format!(\"http://{}\", addr))\n        .await\n        .unwrap();\n    let mut builder = FBBuilder::new();\n    let name_str = builder.get_mut().create_string(\"tonic fbs\");\n    let req = generated::fbs::helloworld::HelloRequest::create(\n        builder.get_mut(),\n        \u0026generated::fbs::helloworld::HelloRequestArgs {\n            name: Some(name_str),\n        },\n    );\n    let req = builder.finish_owned(req).into();\n    let response = client.say_hello(tonic::Request::new(req)).await.unwrap();\n    let reply = response.into_inner();\n    let reply_ref = reply.get_ref();\n    assert_eq!(reply_ref.message(), Some(\"hello tonic fbs\"));\n```\n\n## License\n\nMIT license. See [LICENSE](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouyuanwu%2Fflatbuffers-tonic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyouyuanwu%2Fflatbuffers-tonic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouyuanwu%2Fflatbuffers-tonic/lists"}