Getting started
Already using buf?
Keep using buf
The buf CLI works with Stubs, and we test it on every change. Sign in with it as usual:
buf registry login stubs.dev --token-stdinThen buf push, buf dep update, buf generate and the rest work as they do with any registry.
Or switch to stubs
In your project's directory, run:
stubs config migrateIt writes stubs.yaml from your buf.yaml and stubs.gen.yaml from your buf.gen.yaml, and says what it changed.
buf.build's plugins and well-known types become Stubs's, at the same versions (see the table below); everything
else is kept as written, comments included. Dependencies on other buf.build modules stay on buf.build, where they
still resolve. Your buf files are left as they are, and an existing stubs file is never replaced. Older (v1) buf
files are upgraded to v2 on the way.
You don't have to remember: in a project with buf files and no stubs files, stubs offers to do this before a command
that uses them, and remembers if you say no. Without a terminal, as in CI, it prints a one-line reminder instead;
STUBS_MIGRATION_HINT=off turns that off.
Then pin your dependencies. stubs keeps them in stubs.lock and doesn't read buf.lock:
stubs dep updateThis resolves each dependency again, to its latest commit, so it may pick newer versions than your buf.lock
has. Check the new stubs.lock before you commit it. To stay on an older version, name its label or commit in the
dependency, as in stubs.dev/acme/common:v1.
Lint and breaking rules, ignore comments and command options are the same, so nothing else changes. If you'd rather not
migrate, stubs reads buf.yaml as it is, and stubs generate --template buf.gen.yaml uses a buf.gen.yaml.
stubs never writes or changes a buf-named file, so a project can be used with both tools while you switch.
Plugin names
Stubs's plugins are named after their projects, under stubs. stubs config migrate renames
them for you; if you'd rather edit your generation config by hand, change the names as well as the host (versions are
the same):
| On buf.build | On Stubs |
|---|---|
bufbuild/es | stubs/protobuf-es |
connectrpc/es | stubs/connect-es |
protocolbuffers/go | stubs/protobuf-go |
connectrpc/go | stubs/connect-go |
grpc/go | stubs/grpc-go |
protocolbuffers/java | stubs/protobuf-java |
grpc/java | stubs/grpc-java |
protocolbuffers/kotlin | stubs/protobuf-kotlin |
connectrpc/kotlin | stubs/connect-kotlin |
protocolbuffers/python | stubs/protobuf-python |
protocolbuffers/pyi | stubs/protobuf-pyi |
grpc/python | stubs/grpc-python |
The well-known types (google/protobuf/*.proto) need no dependency: stubs and buf both have them built in.
Other registries
stubs signs in and pushes only to Stubs registries. Keep using buf to push to another registry. Dependencies on
modules there, and remote plugins, still resolve with stubs.