https://github.com/cau777/rust-grpc-web-react-template
Minimal template for a Rust backend and React fronted communicating directly with grpc-web
https://github.com/cau777/rust-grpc-web-react-template
grpc grpcweb react rust tonic
Last synced: about 1 year ago
JSON representation
Minimal template for a Rust backend and React fronted communicating directly with grpc-web
- Host: GitHub
- URL: https://github.com/cau777/rust-grpc-web-react-template
- Owner: cau777
- License: mit
- Created: 2024-02-25T02:11:55.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-25T15:32:43.000Z (about 2 years ago)
- Last Synced: 2025-01-29T22:16:13.857Z (about 1 year ago)
- Topics: grpc, grpcweb, react, rust, tonic
- Language: Rust
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-grpc-web-react-template
This project is a minimal starter template to quickly get grpc-web working with a Rust backend and React frontend.
It takes care of proxying (Envoy not necessary), CORS, and generating types in TS and Rust.
If you prefer to use a framework other than React, it should be easy enough to change (just keep the scripts in `package.json`)
### Adding a new service
This project comes with an `EchoService` as a template. To create new services:
1. Add a new proto file in `grpc-backend/proto`
2. Add this file to `grpc-backend/build.rs`
3. Implement the service in `grpc-backend/src/services`
4. Add the service to the server in `grpc-backend/main.rs`
5. Run `npm proto:generate` on the client
6. Call the service on the client! (see `client/src/App.tsx`)