Buf CLI

Using remote plugins

Buf's remote plugins remove a key obstacle to generating code—plugins are developed across many languages, and manual installation is inconsistent as a result. Instead of wasting your time maintaining plugins for yourself or your organization, you can reference commonly-used plugins hosted in the Buf Schema Registry (BSR). For example:

buf.gen.yaml
version: v2
plugins:
  # Use protoc-gen-go at v1.31.0
  - remote: buf.build/protocolbuffers/go:v1.31.0
    out: gen/go
    opt: paths=source_relative
  # Use the latest version of protoc-gen-go-grpc
  - remote: buf.build/grpc/go
    out: gen/go
    opt: paths=source_relative

If you don't specify a plugin version, the latest version will be pulled in. To avoid unexpected updates and possible breaking changes, pin to a specific version.

To browse all publicly-available plugins, go to buf.build/plugins.

Plugin catalog in the BSR

The plugins are organized in the BSR by language. When you click through to a given plugin, the BSR provides a sample of how to invoke the plugin in your buf.gen.yaml file, and the necessary code to add any other plugins that it depends on. Choose the sample that matches the Buf version used in your configuration files.

Choosing a version and revision number will give you code that pins to that version and revision—otherwise, the sample code defaults to an invocation that will give you the latest version.

  • The plugin version is specified by the upstream project.
  • The revision is a sequence number that Buf increments when rebuilding or repackaging the plugin.

If you'd like a Protobuf plugin to be added to the Buf Schema Registry, open an issue and our team will follow up.