gRPC-Gateway is a protoc plugin that reads your protobuf service definitions and generates a reverse-proxy server translating a RESTful HTTP+JSON API into gRPC calls. It's aimed at Go developers who already have (or are building) a gRPC service and need to expose it over HTTP without hand-writing a separate REST layer.
The project targets teams that want to keep gRPC as the source of truth for their API contract while still serving clients that expect JSON over HTTP, such as browsers, mobile apps, or third-party integrations that don't support gRPC well.
google.api.http annotations in .proto files and generates Go server code that translates HTTP+JSON requests into gRPC calls.generate_unbound_methods lets you generate a working proxy without modifying .proto files at all, using default HTTP semantics.google.api.http options to RPC methods to control paths, HTTP verbs, and body mapping.standalone=true.protoc-gen-openapiv2 produces Swagger 2.0 definitions from the same proto annotations, kept in sync with the gRPC contract.protoc-gen-openapiv3 emits OpenAPI 3.1 output (marked alpha, output shape may change) as an alternative to the stable v2 plugin.buf toolchain and raw protoc invocations.slsa-verifier.It's not a good fit if you don't already use protobuf/gRPC for your service definitions, since it doesn't help you author a REST API from scratch. It also isn't useful if your clients can consume gRPC directly (e.g., internal service-to-service calls), where a gateway just adds overhead. And if you need fine-grained REST semantics that diverge significantly from your gRPC method structure, hand-writing the HTTP layer may be simpler than fighting the annotation model.
gRPC-Gateway is a Go project distributed as protoc plugins. Install the required tools with Go modules:
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
Make sure $GOBIN is on your $PATH. On Go 1.24+, you can track these as tool dependencies directly in go.mod:
tool (
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
google.golang.org/grpc/cmd/protoc-gen-go-grpc
google.golang.org/protobuf/cmd/protoc-gen-go
)
Then install them with:
go install tool
After installing the plugins, the general workflow is:
.proto file.protoc-gen-go and protoc-gen-go-grpc (via buf generate or protoc).protoc-gen-grpc-gateway (with generate_unbound_methods, google.api.http annotations, or an external config file) to generate the reverse-proxy code.runtime.NewServeMux() and serves it with http.ListenAndServe.protoc-gen-openapiv2 (or the alpha protoc-gen-openapiv3) to generate OpenAPI documentation from the same proto definitions.Pre-built release binaries are also available on the GitHub releases page, with SLSA3 provenance files for verification via slsa-verifier.