Buf CLI#
The Buf CLI is the ultimate tool for modern, fast, and efficient Protobuf API management. It makes crucial tasks like code generation, breaking change detection, and linting easy to configure, and integrates seamlessly with your existing workflows, so you can focus on what matters most: writing great APIs.
Commands#
The links below go to detailed usage guides. See the Buf CLI reference for complete options and flags for each command.
generate
: Generate code stubs from Protobuf files usingprotoc
pluginsbreaking
: Verify no breaking changes have been made, to guard against compatibility issueslint
: Lint your Protobuf files according to best practicesformat
: Format your Protobuf files for consistencycurl
: Test your APIs by invoking an RPC endpoint, similar to usingcurl
convert
: Convert a message from binary to JSON or vice versa—useful when debugging or testingconfig
,registry
,push
, andexport
: Manage your repositories in the Buf Schema Registry
Configuration files#
The Buf CLI interacts with several configuration files, depending on the operation.
buf.yaml
#
buf.yaml
defines a workspace and the configurations for each module within it.
It's the primary configuration file, and defines each module's directory, name, lint
and breaking
configurations, and any files to exclude, along with the workspace's shared dependencies.
buf.lock
#
buf.lock
contains the workspace's dependency manifest, and represents a single, reproducible build of its dependencies.
buf.gen.yaml
#
buf.gen.yaml
defines the set of code generation plugins, their options, and the inputs used by the buf generate
command to generate code from your Protobuf files.
It also allows you to enable and configure managed mode.