protoc plugin that generates a REST/JSON reverse proxy for your gRPC services
open sourceBSD-3-Clausefree
gRPC-Gateway is a plugin for the protocol buffers compiler that reads your protobuf service definitions and generates a reverse-proxy server in Go, which translates a RESTful HTTP/JSON API into gRPC calls, following the google.api.http annotations. So you can serve the same API over gRPC and REST. It also comes with protoc-gen-openapiv2, which generates OpenAPI (Swagger 2.0) definitions from the same files, and an alpha protoc-gen-openapiv3 for OpenAPI 3.1. It works with protoc or buf generate. The gRPC Ecosystem project maintains it.
Problems it solves
- serve a REST JSON API alongside my gRPC service without writing it twice
- generate an HTTP gateway from my protobuf definitions in Go
- get an OpenAPI spec from my .proto service definitions
Features
- generates a Go reverse proxy that serves a REST/JSON API in front of gRPC
- follows google.api.http annotations for paths, query strings and request bodies
- maps server streaming to newline-delimited JSON
- maps HTTP headers to gRPC metadata and sets gRPC timeouts
- turns PATCH requests into field-mask updates
- generates OpenAPI (Swagger 2.0) definitions with protoc-gen-openapiv2
Limitations
Alternatives
The same job
These do what gRPC-Gateway does.
- Kratos Go microservices framework for the cloud-native era