Generated SDKs quickstart#
The Buf Schema Registry (BSR) generates SDKs that contain code generated from Protobuf schemas (stored as Buf modules) and plugins. They can be installed as dependencies using popular package managers like Cargo, Go, Gradle, Maven, NPM, pip, and Swift Package Manager, enabling you to easily consume Protobuf APIs without manually generating code or interacting with the schemas directly. For example, mobile or web teams who don't directly own Protobuf schemas can use generated SDKs to consume Protobuf APIs from other teams.
This quickstart shows how to depend on the generated SDK for the connectrpc/eliza
module using NPM.
The process is similar for other SDKs.
Prerequisites#
- Create a Buf account, if you haven't already
- Sign in to the BSR
Select generated SDKs#
Usually, you'll have a direct URL for the module you want to use, either from the schema owner or your internal documentation. You can also search for its repository if you know the name.
-
In the search bar at the top of the BSR, enter
connectrpc/eliza
. A dropdown of results appears—click connectrpc/eliza to go to the repository. -
Click the SDKs tab to see the categories of generated SDKs:
-
Click on the JavaScript icon—a gallery of JavaScript-compatible plugins appears. Then click bufbuild/es to choose the
bufbuild/es
plugin. The install instructions for the plugin display.
Recommended SDKs
If you're on a private BSR instance, you may see a "Recommended" category in addition to the ecosystem collections and languages. The SDKs in this category have been recommended by the instance, organization, or module admins as the preferred ones to use.
If a recommended SDK has a build issue, it displays an error message and provides a share link so you can copy the SDK URL and notify the module admin.
Each SDK has a different set of instructions depending on the language and the ecosystem. Some plugins provide multiple package manager options, each in a separate tab. For plugins where generated SDKs aren't available, the installation instructions provide an archive download link—see the Download an archive section for more details about archives.
Some SDKs also have the option to create an authorization token.
If you choose to create one from this screen, it appends it to the command for you to copy.
Otherwise, add a token you already have in place of {token}
.
If the plugin has dependencies installed as part of the SDK, they're listed in a Dependencies section below the installation instructions.
Follow the provided installation instructions to install the SDK. Some SDKs also provide a "Getting started" guide to help you integrate further.
Change the module version or label#
The BSR defaults to providing SDKs at the latest module and plugin versions unless otherwise specified. To pin SDKs to a specific module version, click the dropdown in the top right of the SDKs tab and choose a commit or label:
Notice that when you make these changes, the installation command updates to reflect the new version:
This syntax identifies the plugin version first, then the exact commit in the repository that the demo
label represents.
Change the plugin version#
You can pin the SDK to a specific plugin version by going to the Version dropdown at the top of the Installation instructions section: