advanced

RPC, gRPC, and tRPC

Compare procedure-oriented APIs, protobuf contracts, service methods, streaming, code generation, and TypeScript-first tRPC boundaries.

RPC-style interviews compare procedure-oriented APIs, protobuf contracts, gRPC streaming and deadlines, and TypeScript-first tRPC boundaries for internal vs public consumers.

Subtopics: RPC and gRPC contracts, and tRPC API boundaries.

On interviews: say when gRPC beats REST for service-to-service calls, and when tRPC is appropriate vs a versioned public HTTP contract.

Common pitfalls: exposing tRPC as a public API without runtime validation, gRPC without deadline and retry policy, and RPC names that encode server storage shape.

The trade-off is balancing simplicity, performance, safety, and operability — name which axis you optimized and what cost you accepted.

Checklist:

  • Use typed contracts and code generation where teams align.
  • Set deadlines, metadata, and idempotent retries on RPC.
  • Keep tRPC inside trusted monorepo boundaries.
  • Document breaking changes for any cross-team RPC surface.