Programming Guides

Learn how to use Protocol Buffers in your projects.

Language Guide (proto 2)

Covers how to use the version 2 of Protocol Buffers in your project.

Language Guide (proto 3)

Covers how to use the version 3 of Protocol Buffers in your project.

Proto Limits

Covers the limits to number of supported elements in proto schemas.

Style Guide

Provides direction for how best to structure your proto definitions.

Enum Behavior

Explains how enums currently work in Protocol Buffers vs. how they should work.

Encoding

Explains how Protocol Buffers encodes data to files or to the wire.

Techniques

Describes some commonly-used design patterns for dealing with Protocol Buffers.

Third-Party Add-ons

Links out to many open source projects that seek to add useful functionality on top of Protocol Buffers.

Extension Declarations

Describes in detail what extension declarations are, why we need them, and how we use them.

Application Note: Field Presence

Explains the various presence-tracking disciplines for protobuf fields. It also explains the behavior of explicit presence-tracking for singular proto3 fields with basic types.

Proto Serialization Is Not Canonical

Explains how serialization works and why it is not canonical.

Proto Best Practices

An overview of best practices topics.

Proto Best Practices

Shares vetted best practices for authoring Protocol Buffers.

API Best Practices

A future-proof API is surprisingly hard to get right. The suggestions in this document make trade-offs to favor long-term, bug-free evolution.

1-1-1 Rule

All proto definitions should have one top-level element and build target per file.