← All open source projects

Protocol Buffers

protocolbuffers/protobuf

Protocol Buffers is a data serialization format and protoc compiler for strongly typed schemas between services.

Forks 16,151
Language C++
License NOASSERTION
Synced 2026-06-11

What it is

Protocol Buffers is Google’s data serialization format. It describes messages with strict schemas, generates code for several languages, and moves data between services compactly and predictably.

The protocolbuffers/protobuf repository contains the protoc compiler, runtime libraries, and multi-language support. The project has been on GitHub since 2014.

What is inside

Inside are compiler sources, runtimes, documentation, Bazel build instructions, and versioning material. The central idea is that a `.proto` schema becomes a contract between systems.

A .proto schema example

This fragment shows a message contract: fields have numbers and types, so services can exchange data without hand-parsing JSON.

Language: Plain text
syntax = "proto3";

message User {
  int64 id = 1;
  string name = 2;
  repeated string roles = 3;
}

Where it helps

Protobuf is used in RPC, microservices, mobile apps, logs, queues, and systems where compact format, strict contracts, and code generation matter.

Protobuf is especially useful when the same contract is needed across languages. The schema is written once, then generated types can be used by clients and servers. That reduces the chance that one side sends data in a shape the other side did not expect.

Unlike loose JSON, Protobuf makes compatibility a design concern. Fields have numbers, types, and evolution rules. You cannot casually delete a field or reuse a number without consequences, but careful schemas can survive years of change.

The project also matters as a foundation for other technology. gRPC and many internal data protocols build on Protobuf, so the repository is useful for people who need to understand code generation and serialization behavior.

Project details

Protocol Buffers solves a practical problem: different services need to understand data in the same way. If a contract lives only in documentation or JSON examples, it drifts from reality. A `.proto` schema makes the contract an executable artifact.

The protoc compiler turns a schema into code for different languages. That is especially useful in distributed systems: the server may be Go, the client Java, background jobs Python, while the message structure stays shared.

Field numbers are central to the model. They keep the format compact and help compatibility, but they require care. A removed field cannot be casually reused, or old and new clients may interpret the same message differently.

Protobuf is often used with gRPC, but the format is useful on its own: files, queues, logs, service-to-service exchange, and mobile clients. Its value grows where the same data structures are sent many times and contract versions matter.

The limitation is an extra development layer. Teams have to store schemas, generate code, preserve compatibility, and teach people the evolution rules. For a tiny internal JSON endpoint it may be too much, but for long-lived contracts it often pays off.

Strengths and tradeoffs

The strength is stable contracts and language support. The tradeoff is that schemas need careful design: field numbers, version compatibility, and migrations become part of architecture.