{"id":28766272,"url":"https://github.com/tomdev5/afit-tonic-build","last_synced_at":"2026-04-18T11:32:42.154Z","repository":{"id":297620745,"uuid":"997354634","full_name":"tomDev5/afit-tonic-build","owner":"tomDev5","description":"A fork of tonic-build that replaces async-trait with AFIT","archived":false,"fork":false,"pushed_at":"2025-06-06T12:24:33.000Z","size":238,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-06T13:27:09.802Z","etag":null,"topics":["async","grpc","proto","rpc","rust","tonic"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomDev5.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}},"created_at":"2025-06-06T11:40:38.000Z","updated_at":"2025-06-06T12:24:35.000Z","dependencies_parsed_at":"2025-06-06T13:37:21.684Z","dependency_job_id":null,"html_url":"https://github.com/tomDev5/afit-tonic-build","commit_stats":null,"previous_names":["tomdev5/afit-tonic-build"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomDev5/afit-tonic-build","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomDev5%2Fafit-tonic-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomDev5%2Fafit-tonic-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomDev5%2Fafit-tonic-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomDev5%2Fafit-tonic-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomDev5","download_url":"https://codeload.github.com/tomDev5/afit-tonic-build/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomDev5%2Fafit-tonic-build/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260355369,"owners_count":22996463,"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":["async","grpc","proto","rpc","rust","tonic"],"created_at":"2025-06-17T12:00:35.647Z","updated_at":"2026-04-18T11:32:42.146Z","avatar_url":"https://github.com/tomDev5.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tonic-build\n\nCompiles proto files via prost and generates service stubs and proto definitions for use with tonic.\n\n## Features\n\nRequired dependencies\n\n```toml\n[dependencies]\ntonic = \"\u003ctonic-version\u003e\"\nprost = \"\u003cprost-version\u003e\"\n\n[build-dependencies]\ntonic-build = \"\u003ctonic-version\u003e\"\n```\n\n## Examples\n\n### Simple\n\nIn `build.rs`:\n```rust\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    tonic_build::compile_protos(\"proto/service.proto\")?;\n    Ok(())\n}\n```\n\n### Configuration\n\n```rust\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n   tonic_build::configure()\n        .build_server(false)\n        .compile_protos(\n            \u0026[\"proto/helloworld/helloworld.proto\"],\n            \u0026[\"proto/helloworld\"],\n        )?;\n   Ok(())\n}\n```\nSee [more examples here](https://github.com/hyperium/tonic/tree/master/examples)\n\n### Google APIs example\nA good way to use Google API is probably using git submodules.\n\nSo suppose in our `proto` folder we do:\n```\ngit submodule add https://github.com/googleapis/googleapis\n\ngit submodule update --remote\n```\n\nAnd a bunch of Google proto files in structure will be like this:\n```\n├── googleapis\n│   └── google\n│       ├── api\n│       │   ├── annotations.proto\n│       │   ├── client.proto\n│       │   ├── field_behavior.proto\n│       │   ├── http.proto\n│       │   └── resource.proto\n│       └── pubsub\n│           └── v1\n│               ├── pubsub.proto\n│               └── schema.proto\n```\n\nThen we can generate Rust code via this setup in our `build.rs`\n```rust\nfn main() {\n    tonic_build::configure()\n        .build_server(false)\n        //.out_dir(\"src/google\")  // you can change the generated code's location\n        .compile_protos(\n            \u0026[\"proto/googleapis/google/pubsub/v1/pubsub.proto\"],\n            \u0026[\"proto/googleapis\"], // specify the root location to search proto dependencies\n        ).unwrap();\n}\n```\n\nThen you can reference the generated Rust like this this in your code:\n```rust\npub mod api {\n    tonic::include_proto!(\"google.pubsub.v1\");\n}\nuse api::{publisher_client::PublisherClient, ListTopicsRequest};\n```\n\nOr if you want to save the generated code in your own code base,\nyou can uncomment the line `.out_dir(...)` above, and in your lib file\nconfig a mod like this:\n```rust\npub mod google {\n    #[path = \"\"]\n    pub mod pubsub {\n        #[path = \"google.pubsub.v1.rs\"]\n        pub mod v1;\n    }\n}\n```\nSee [the example here](https://github.com/hyperium/tonic/tree/master/examples/src/gcp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomdev5%2Fafit-tonic-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomdev5%2Fafit-tonic-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomdev5%2Fafit-tonic-build/lists"}