~/notes/protobuf

Protocol Buffers

Explains Protocol Buffers

Jul 15, 2025

A language-neutral, platform-independent, and extensible mechanism for serializing structured data.

It encodes data into a compact binary format, making it efficient for communication.

Like XML, Protobuf defines structured data in a more efficient way. A schema is defined and used by both the client and server to serialize and deserialize the data.

Protobuf also provides a way to extend the schema without breaking backward compatibility.

diagram
ReceiverSender

Application Object
e.g., Python, Java

Protobuf
Serialization

Binary Message Buffer

Transport Layer:
gRPC, TCP, File

Binary Message Buffer

Protobuf
Deserialization

Reconstructed Object

ReceiverSender

Application Object
e.g., Python, Java

Protobuf
Serialization

Binary Message Buffer

Transport Layer:
gRPC, TCP, File

Binary Message Buffer

Protobuf
Deserialization

Reconstructed Object

protobuf syntax

code
syntax = "proto3";

message Person {
  string name = 1;
  int32 id = 2;
  string email = 3;
}

Docs