explaingit

grpc-ecosystem/grpc-gateway

📈 Trending19,888GoAudience · developerComplexity · 3/5ActiveLicenseSetup · moderate

TLDR

Automatically generates a REST API from your gRPC service definition, letting you offer both gRPC and JSON/HTTP interfaces from the same backend without writing duplicate code.

Mindmap

mindmap
  root((repo))
    What it does
      Generates REST from gRPC
      Creates reverse proxy
      Auto OpenAPI docs
    How it works
      Reads protobuf files
      HTTP annotations
      Translates REST to gRPC
    Use cases
      Web frontend access
      Third-party integrations
      Internal gRPC speed
    Tech stack
      Go
      Protocol Buffers
      Code generation
    Audience
      Backend teams
      API maintainers

Things people build with this

USE CASE 1

Expose your internal gRPC service as a REST API for web browsers and third-party integrations without rewriting your backend.

USE CASE 2

Generate OpenAPI documentation automatically from your gRPC service definition to share with API consumers.

USE CASE 3

Run a single backend that serves both high-performance gRPC clients internally and standard REST clients externally.

USE CASE 4

Add HTTP endpoints to an existing gRPC service by annotating your protobuf definitions and regenerating the proxy.

Tech stack

GoProtocol BuffersgRPCOpenAPI

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Go runtime and protoc compiler; needs to generate code from .proto files before running.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice and license text.

In plain English

gRPC-Gateway is a code generation tool that automatically creates a traditional REST (JSON over HTTP) API from a gRPC service definition, letting you offer both communication styles from the same backend without writing two separate servers. To understand why this matters: gRPC is a high-performance remote procedure call system developed by Google that uses a compact binary format and generated code for tight client-server contracts. It is fast and efficient but requires clients that speak the gRPC protocol. REST APIs using JSON are the far more universal standard, supported by web browsers, curl, and virtually every HTTP library. Many teams want gRPC internally for speed and type safety, but also need a standard REST interface for external consumers, third-party integrations, or web frontends. gRPC-Gateway solves this by reading your service's protobuf definition files (the schema files gRPC uses) and generating a reverse-proxy server in Go. You add special HTTP annotations to your protobuf definitions specifying how each gRPC method should map to HTTP endpoints, paths, and query parameters, and the tool generates the proxy code that translates incoming REST calls into gRPC calls and converts gRPC responses back to JSON. It also generates OpenAPI (Swagger) documentation automatically. The setup involves installing a few code generation plugins and running the protobuf compiler against your service definition. The generated proxy can then run alongside your gRPC server. This is a Go project used by organizations serving millions of API requests per day that want to maintain both a high-performance internal gRPC interface and a broadly compatible REST API without duplicating server logic.

Copy-paste prompts

Prompt 1
How do I set up gRPC-Gateway to expose my existing gRPC service as a REST API?
Prompt 2
Show me an example of adding HTTP annotations to a protobuf file so gRPC-Gateway can generate REST endpoints.
Prompt 3
How does gRPC-Gateway handle converting gRPC responses to JSON for REST clients?
Prompt 4
Can gRPC-Gateway automatically generate OpenAPI/Swagger documentation from my service definition?
Prompt 5
What's the difference between running gRPC-Gateway as a reverse proxy versus embedding it in my service?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.