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: v1
plugins:
  # Use protoc-gen-go at v1.31.0
  - plugin: buf.build/protocolbuffers/go:v1.31.0
    out: gen/go
    opt: paths=source_relative
  # Use the latest version of protoc-gen-go-grpc
  - plugin: buf.build/grpc/go
    out: gen/go
    opt: paths=source_relative

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. 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.

Screenshot of BSR showing the Protocol Buffers/Go 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.