Skip to content

Protocol Buffers

Everything in gRPC starts from a .proto file, and that file is written in Protocol Buffers. Before you can design services and RPC methods, you need fluency in the building block they carry: the message.

This module is about protobuf the schema language — how to model your data precisely, and how to shape it so it can grow for years without breaking the clients you already shipped.

LessonWhat you’ll learn
Messages & FieldsMessage syntax and why every field carries a number, not just a name
Scalar Types & DefaultsThe built-in types, proto3 default values, and the optional presence trap
Enums, Nested & oneofEnumerations (with the zero-value rule), nesting, and mutually-exclusive fields
Repeated, Maps & Well-KnownLists, key/value maps, and the standard library of google.protobuf types
Evolving SchemasThe rules that let a schema change safely — and the ones that break clients

A protobuf message is deceptively simple — a few typed fields with numbers. But those numbers, defaults, and evolution rules are exactly where real systems get into trouble:

flowchart TB
  msg["message design
(fields + numbers)"] --> types["type & default choices"]
  types --> evolve["schema evolution
(add / reserve / never reuse)"]
  evolve --> safe["clients keep working
across versions"]
The schema decisions this module makes safe

Get the field numbers and evolution rules right early, and your API can add features for years without a breaking change. Get them wrong, and you’re stuck with a versioning headache the first time a message needs to grow.

What is the fundamental building block this module focuses on?
Why does schema evolution deserve careful attention?
How should you treat a .proto message?