/grpc-web-go-react-example

Example of using Go and React/TypeScript with gRPC-Web

Primary LanguageTypeScriptMIT LicenseMIT

Small Go/React/TypeScript gRPC-Web example

This is a tiny example set up for using gRPC-Web with Go and React, powered by https://github.com/timostamm/protobuf-ts for the client and grpc-go and https://github.com/improbable-eng/grpc-web for the server.

Bundling is handled by esbuild.github.io.

Requirements

  1. Go
  2. Docker (to run npm 🤢)

Install tools

$ make install

Running

$ make serve
go run main.go
Serving on http://0.0.0.0:8080

Regenerate protobuf

$ make generate
buf generate

Bundle JS

$ make bundle
esbuild ./frontend/app.tsx --bundle --minify --sourcemap --outfile=./dist/js/bundle.js

  dist/js/bundle.js      189.0kb
  dist/js/bundle.js.map  559.6kb

⚡ Done in 61ms