| Crates.io | wasi-grpc |
| lib.rs | wasi-grpc |
| version | 0.1.0 |
| created_at | 2025-08-11 20:08:58.834633+00 |
| updated_at | 2025-08-11 20:08:58.834633+00 |
| description | gRPC clients on Spin / WASI Hyperium |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1790801 |
| size | 39,718 |
Enables gRPC clients to work inside Spin components using wasi-hyperium and the spin-rust-sdk.
Spin is a fast, secure WebAssembly framework for serverless apps. This project extends Spin's capabilities by enabling components to make outbound gRPC requests, bridging the gap between Wasm sandboxing and modern microservice communication.
wasi-hyperium and tonic[dependencies]
anyhow = "1"
futures = "0.3.28"
prost = "0.13.5"
wasi-grpc = "0.1.0"
spin-sdk = "4.0.0"
tonic = { version = "0.13.1", features = ["codegen", "prost", "router"], default-features = false}
tonic-buildIn build.rs:
fn main() {
tonic_build::configure()
.type_attribute("routeguide.Point", "#[derive(Hash)]")
.build_transport(false)
.compile_protos(&["route_guide.proto"], &[""])
.unwrap();
}
And in Cargo.toml:
[build-dependencies]
tonic-build = { version = "0.13.1", features = ["prost"] }
let endpoint = WasiGrpcEndpoint::new(endpoint_uri);
let mut client = RouteGuideClient::new(endpoint);
let response = client.get_feature(Request::new(Point {
latitude: 409_146_138,
longitude: -746_188_906,
})).await?;
This project assumes execution in a Spin-compliant runtime that allows outbound networking via Spin's capability-based model. Ensure your spin.toml includes the appropriate allowed_outbound_hosts granting outbound access to your gRPC service's endpoint.