Getting started
Quickstart
In a few minutes you'll sign in to Stubs, push a module, and depend on it from another. You need an account and the
stubs CLI:
curl -fsSL https://stubs.dev/install.sh | sh(Homebrew, Windows and CI are on Install the CLI. Already using buf? See Already using buf?.)
1. Create a token and sign in
On Stubs, open Settings → API tokens and create a token with the registry:write scope. Then sign in with it:
stubs login stubs.dev --token-stdinPaste the token and press Enter (or pipe it in). Check who you are:
stubs whoami stubs.dev2. Create a module and push it
Make a directory with a stubs.yaml naming the module (your username, or an organisation you belong to, then the
module's name):
version: v2
modules:
- path: .
name: stubs.dev/your-name/commonAdd a .proto file, for example acme/common/v1/money.proto:
syntax = "proto3";
package acme.common.v1;
message Money {
string currency_code = 1;
int64 units = 2;
}Create the module and push it:
stubs registry module create stubs.dev/your-name/common --visibility public
stubs pushstubs push prints the commit it made. The module's page on Stubs shows its files, documentation and history.
3. Depend on it
In another directory, name a second module and list the first as a dependency:
version: v2
modules:
- path: .
name: stubs.dev/your-name/payments
deps:
- stubs.dev/your-name/commonImport acme/common/v1/money.proto from a file of your own, then pin the dependency and push, creating the module as
you go:
stubs dep update
stubs push --create --create-visibility publicNext
- Authentication: tokens and their scopes.
- Pushing modules and Labels & commits.
- Generated SDKs: install your module with npm, Go, Gradle or pip.