Skip to content

Conversation

srikrsna-buf
Copy link

Add support for @bufbuild/protobuf runtime

This PR adds support for generating service definitions compatible with the @bufbuild/protobuf runtime, a popular and conformant protobuf implementation.

What this PR does:

Adds a new plugin option called runtime to select the protobuf runtime. Supported values are bufbuild-protobuf and defaults to use google-protobuf. When the runtime is set to bufbuild-protobuf, the plugin generates service definitions that use @bufbuild/protobuf's message types and serialization methods instead of the default runtime.

Why this change?

@bufbuild/protobuf supports Editions and passes significantly more conformance tests than currently supported runtimes, ensuring better protocol buffer compatibility.

Usage

Alongside grpc-tools, users will need to install @bufbuild/protoc-gen-es and change the grpc_tools_node_protoc call to use the new runtime and use the protoc-gen-es:

npm install -g grpc-tools @bufbuild/protoc-gen-es
grpc_tools_node_protoc --es_out=target=js,js_import_style=legacy_commonjs:../helloworld/static_codegen_es/ --grpc_out=grpc_js,runtime=bufbuild-protobuf:../helloworld/static_codegen_es/ helloworld.proto

Alternatives

Happy to discuss other options like a separate runtime package or plugin package. Having either of those will also bring TypeScript and ESM support.

Copy link

linux-foundation-easycla bot commented Sep 10, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants