Skip to content

Remote plugins – Overview

Buf's remote plugins remove a key obstacle to generating code from Protobuf files—protoc plugins are developed across many languages, and manual installation is inconsistent as a result. Managing and maintaining a stable environment on a single machine is hard enough, and the problem is compounded as you scale out code generation across many developers.

Instead of maintaining plugins locally, you can reference protoc plugins hosted in the Buf Schema Registry (BSR) in your buf.gen.yaml files. Buf verifies and maintains these copies of the plugins commonly used across the Protobuf ecosystem.

Finding remote plugins

To discover all publicly available plugins, go to buf.build/plugins:

  1. Choose a collection or language:

    Remote plugin browse screen, showing available collections and languages

    Note

    Plugins without an associated language or collection appear in the Other category at the bottom of the filter panel.

  2. Click through to the group you want, and all available plugins display:

    Remote plugin browse screen, showing plugins available for Go

  3. Choose the plugin you want to use, and it provides the reference to add to buf.gen.yaml and 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 into the plugins key of your buf.gen.yaml file—for example:

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

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

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

Note

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.

Request a public plugin

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