About the Author

Adithya Krishna

An enthusiastic Final Year CSE student at Jyothy Institute of Technology, Bengaluru and trying to explore newer fields and a person who loves to contribute to Open Source Software. I'm also the type of person who says Yes! to everything spontaneously as I believe in utilizing every opportunity I can get and learning/upskilling myself in the mean process 👨‍💻

Meshery

Meshery is the world's only collaborative cloud manager.

At Layer5, we are continuously evaluating new technologies and incorporating them into our open source projects. Buf is one of those projects. This post presents an overview of Buf.

What is Buf?

A tool to make Protobuf reliable and easy to use for service owners and clients, while keeping it the obvious choice on the technical merits. Our organization should not have to reinvent the wheel to create, maintain, and consume Protobuf APIs efficiently and effectively. It will handle our Protobuf management strategy for us, so we can focus on what matters.

Learn more about Buf Protocol, visit Buf Protocol or their documentation at Buf Protocol Docs

Features

  • Automatic file discovery.
  • Selectable configuration - 40 lint checkers and 54 breaking checkers
  • Selectable error output - file:line:col:message
  • Check anything from anywhere - proto files, tar, git, pre-built images or file descriptors.
  • Speed - Its internal compiler is super fast (approx. 4x then Protoc)
  • Can use buf as a protoc plugin instead of using it as a standalone tool.

Buf CLI

Buf attempts to simplify your Protocol Buffers workflow using the Buf CLI and protoc plugins. The Buf CLI currently provides:

  • A linter that enforces good API design choices and structure.
  • A breaking change detector that enforces compatibility at the source code level or wire level.
  • A generator that invokes your protoc plugins based on a configurable template. A protoc replacement that uses Buf's newly-developed high performance Protobuf compiler.
  • A configurable file builder that produces Images, our extension of FileDescriptorSets.

Comparison Between Protobuf and Buf

Layer5 projects currently use protoc as the tool for building their protobuf defintions. The following are some considerations made while determining whether to use Buf.

  • Protobuf is not as widely adopted as JSON.
  • API Structure
    • No standards enforcement
    • Inconsistency can arise across an organization's Protobuf APIs,
    • Design decisions can be made that can affect your API's future iterability.
  • Backward Compatibility
  • Stub distribution
  • Tooling

Buf aims to solve the above problems and it's long-term goal is to enable schema-driven development: A future where APIs are defined consistently, in a way that service owners and us can depend on

Roadmap to Adopting Buf

In consideration of the use of Buf, we would adopt it in phases, starting with the following ares of integration.

  • API Structure Enforcements
    • Linter solves this issue by enforcing standards.
    • Also, we don’t need to use Buf as a standalone tool we can just use linter as plugins.
  • Backward Compatibility
    • It will check for different things that can cause breaking change.
    • For example, type change.

If these topics excite you and you want to explore more cloud native technolgies, come and say "Hi" on the community Slack and you are sure to be warmly welcomed. 😀

Related Blogs

Layer5, the cloud native management company

An empowerer of engineers, Layer5 helps you extract more value from your infrastructure. Creator and maintainer of cloud native standards. Maker of Meshery, the cloud native manager.