gRPC is a language-agnostic, cross-platform, open-source remote procedure call architecture designed for high-speed communication among microservices. It transports messages with HTTP/2 and uses protocol buffers instead of JSON. section 10.3
Compared with REST and GraphQL, gRPC emphasizes efficient service-to-service communication through HTTP/2, binary serialization, multiplexing, and bidirectional streaming. section 10.0 section 10.3.1
gRPC is attractive when communication efficiency matters:
- Runs on almost any hardware that supports HTTP/2. section 10.3.1
- Reduces latency through HTTP/2 handshake optimizations. section 10.3.1
- Reduces network use through compact protobuf serialization. section 10.3.1
- Supports bidirectional streaming and multiplexed communication rather than only request-response exchanges. section 10.3.1
Account for important trade-offs before choosing it:
- Implementation is more complex and slower than an equivalent REST API. section 10.3.2
- Browsers and many client frameworks lack direct gRPC support; gRPC-Web improves compatibility but remains limited. section 10.3.2
- Binary payloads require dedicated tools for inspection, debugging, logging, and manual requests. section 10.3.2
- Responses are difficult to cache through intermediaries, and predefined typed responses can cause overfetching or underfetching. section 10.3.2
Extending a board-game gRPC API
Define protobuf methods for GetDomain, UpdateDomain, GetMechanic, and UpdateMechanic, specifying input and output types alongside existing request and response messages. Restrict the two update methods to users with the Moderator role by applying authorization. section 10.5.3









