Skip to content
StackDecode
System Design
10. API Design and ManagementAnimated

gRPC API Design

Typed RPC contracts in Protocol Buffers.

The idea

Define services and messages in .proto, generate code, and use streaming for large flows.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

Client stubgRPC serverHTTP/2 + protobuf: GetUser(id=7)
  • current message
  • earlier
  • failure or attack

A generated stub serialises the call to compact binary.

step:
1/4
from:
Client stub
to:
gRPC server
1/4

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Write the .proto
  2. 2Generate stubs
  3. 3Implement the server
  4. 4Clients call methods

Where it is used

Internal microservices.

Watch out for

Evolve fields carefully: never reuse field numbers.

Related