Skip to content

Generating code with remote plugins – Overview

One of the greatest challenges with Protobuf code generation is the complexity of working with protoc and plugins. We've heard repeatedly that developers want the benefits of code generation, but struggle with the complex web of different compiler and plugin versions, and the varying runtime needs that plugins have across different languages. Managing and maintaining a stable environment locally on a single machine is hard enough, and the problem is compounded as you scale out code generation across many developers.

Every organization and open-source project develops homegrown Protobuf tooling in an effort to simplify the developer experience and maintain consistent output across developers. A handful of organizations might get a workable solution, but these remain brittle and difficult to maintain over time. Furthermore, domain knowledge of these homegrown solutions is lost and upgrade paths become challenging.

At Buf, we believe code generation is a key building block and the Protobuf ecosystem deserves a proper solution. With remote plugins, you no longer have to concern yourself with maintaining, downloading, or running plugins on your local machine. Using a plugin is as simple as referencing it in your buf.gen.yaml:

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

Note

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.

Just invoke buf generate and you're done—no maintaining these plugins, no worrying about how to download or install them, just generate your stubs and get back to solving your real problems.

Publicly available plugins

Buf verifies and maintains the commonly used plugins used across the Protobuf ecosystem.

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

This page provides information on all available plugins on the Buf Schema Registry, including the language types and instructions for use in buf.gen.yaml. The packaging and distribution source code for Buf-managed plugins is available on GitHub.

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

Plugins on private BSR instances

This feature is only available on the Pro and Enterprise plans.

The same plugins that are available on the public BSR are also available for use on private BSR instances. Community plugins aren't included by default, but if you want access to them on your instance, reach out to your Buf support contact.

Buf-managed plugins

The Buf-managed plugins and their manifests are stored in a public repository, and your BSR instance keeps popular plugins up-to-date by polling for new plugin releases every hour.

To view the available plugins on your instance, visit https://buf.build/plugins.