Lesson 14 · Architecture & production
gRPC vs REST
The trade-offs — and the interview question you'll definitely be asked.
Your win: lay out the real differences and pick the right tool for a scenario — the full version of Lesson 1's 10-second rule.
The comparison
| gRPC | REST | |
|---|---|---|
| Contract | .proto, enforced by codegen | OpenAPI (optional, not enforced) |
| Payload | Protobuf — binary, compact, typed | JSON — text, human-readable |
| Transport | HTTP/2 (multiplexed) | usually HTTP/1.1 |
| Streaming | native (4 types) | awkward (SSE, websockets) |
| Browser | needs grpc-web / a gateway | native |
| Caching | not built-in | HTTP caching works |
| Debuggability | needs tools (binary) | curl-able by hand |
Our repo does both — deliberately
Every internal call between conversationmgmt, notification, spike,
mastermgmt, bob, … is gRPC (Lesson 1). But external clients need REST — so the repo
exposes some gRPC methods as REST/JSON through a gateway (Lesson 17), fronted by
gandalf. Same .proto, two faces: gRPC for the mesh, REST for the edge.
SendEmail is internal-only gRPC; its ExternalSendEmail
carries an option (google.api.http) annotation so the gateway also serves
it at POST /spike/api/v1/proxy/email/send_email
(proto/spike/v1/email.proto:144). One proto, both worlds.
gRPC — Introduction/FAQ + "gRPC on HTTP/2"
The official framing of what gRPC is good at, and the engineering blog on why HTTP/2 gives it its edge.
Check yourself (from memory)
Q1. gRPC's biggest advantage over REST is…
Q2. For a public, browser-facing API you'd usually pick…
Q3. In our repo, internal service-to-service calls use…