Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

First Steps with Buffrs

Let’s create your first Protocol Buffer package with Buffrs.

1. Initialize a New Package

Create a new API package:

mkdir web-server && cd web-server
buffrs init --api

This creates:

.
├── Proto.toml          # Package manifest
└── proto/              # Your .proto files
    └── vendor/         # Dependencies install here

Note

Use --lib for library packages, or omit both flags for consumer-only projects (e.g., server implementations without protobuf definitions to publish).

2. Review the Manifest

The Proto.toml file defines your package:

[package]
name = "web-server"
version = "0.1.0"
type = "api"

[dependencies]

3. Add a Dependency

Add a package from your registry:

buffrs add --registry https://your.registry.com datatypes/user@=0.1.0

This updates Proto.toml:

[dependencies.user]
version = "=0.1.0"
repository = "datatypes"
registry = "https://your.registry.com/"

4. Install Dependencies

Download and set up dependencies:

buffrs install

Dependencies are placed in proto/vendor/ and ready to import.

What’s Next?