Skip to content

Remote plugins#

Code generation is a key building block of a Protobuf toolchain, but it's also one of the most frustrating: managing and maintaining a stable environment on even a single machine is hard.

Remote plugins solve this problem by letting you reference plugins hosted and maintained by Buf in the BSR. Code generation becomes as simple as adding a plugin to your buf.gen.yaml and running buf generate:

version: v1
plugins:
  # Use protoc-gen-go at v1.28.1
  - plugin: buf.build/protocolbuffers/go:v1.28.1
    out: gen/go
  # Use the latest version of protoc-gen-go-grpc
  - plugin: buf.build/grpc/go
    out: gen/go

Finding remote plugins#

To discover all publicly available plugins, go to buf.build/plugins, where you can view the entire library and filter by ecosystem or language:

Remote plugin browse screen

Choose the plugin you want to use to see copy-and-paste code for your buf.gen.yaml as well as installation instructions for any dependencies:

Remote plugin browse screen, showing plugins available for Go

Use the dropdown to change the version if needed. To use the latest version, remove the version number from the reference.

Using remote plugins#

Using a plugin is as simple as referencing it in your buf.gen.yaml config file. Copy the YAML reference provided by the BSR and add it to the plugins list in your buf.gen.yaml file:

buf.gen.yaml
version: v2
plugins:
  # Use protoc-gen-go at v1.35.2
  - remote: buf.build/protocolbuffers/go:v1.35.2
    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

Invoke buf generate and you're done—no maintaining these plugins, no worrying about how to download or install them. You've generated your stubs and can get back to solving real problems.

If you don't specify a plugin version, the latest version is used to generate. To avoid unexpected updates and possible breaking changes, pin to a specific version.

See the buf.gen.yaml reference for more information about the other keys under plugin.

Request a public plugin#

If you'd like a Protobuf plugin to be added to the Buf Schema Registry, open an issue.