A Rust gRPC server with built-in gRPC-Web support and a TypeScript browser client. This repo demonstrates an end-to-end setup where the browser calls a Rust backend over gRPC-Web without needing Envoy, thanks to tonic-web.
protos/grpc-web.proto— shared Protocol Buffers definitionsrust/grpc-web-server/— gRPC server in Rust usingtonic+tonic-webweb/grpc-web-client/— Vite + TypeScript browser client using Connect
Services (from the proto):
- Echo — send a message and receive it back
- DoMath — add, subtract, multiply, or divide two numbers
- Rust 1.70+
- Node.js 18+ and npm
No protoc or other system proto tools required — the client uses buf (installed via npm).
1. Start the Rust server (listens on http://0.0.0.0:10000)
cd rust/grpc-web-server
cargo run2. Start the web client (served on http://localhost:8080)
cd web/grpc-web-client
npm install
npm run devOpen http://localhost:8080 and try Echo and Calculator.
- Edit shared proto definitions in
protos/grpc-web.proto. - The Rust server regenerates its types automatically via
build.rsoncargo build. - Regenerate the TypeScript client stubs with
npm run proto-regeninweb/grpc-web-client/.
Server:
cd rust/grpc-web-server
cargo build --releaseClient:
cd web/grpc-web-client
npm run buildServe the dist/ folder from any static file server or CDN, pointed at the deployed server URL.
- Rust server:
rust/grpc-web-server/README.md - Web client:
web/grpc-web-client/README.md
- CORS errors in the browser — verify the server is running on
:10000with CORS enabled forhttp://localhost:8080. - Proto not found — confirm
protos/grpc-web.protoexists andbuf.gen.yamlpaths are correct.
Licensed under the terms of the LICENSE file in the repository root.