Generate a Go module from Protobuf
Push your .proto files to Stubs and install the generated Go code with go get, versioned with every commit. No protoc, no plugins to install and no generated code to commit.
Try it now
Install one in a minute
This is the Go SDK of stubs/petstore, a public demo module: a small pet store's API. Install it with go get in an empty project. You don't need an account.
Install it
export GOPROXY=https://stubs.dev/gen/go,https://proxy.golang.org,direct
export GONOSUMDB=stubs.dev/gen/go
go get stubs.dev/gen/go/stubs/petstore/protobuf-go@v1.36.12-20261128015706-2ff545c5db11.3
package main
import (
"fmt"
"google.golang.org/protobuf/encoding/protojson"
petstorev1 "stubs.dev/gen/go/stubs/petstore/protobuf-go/petstore/v1"
)
func main() {
pet := &petstorev1.Pet{Name: "Rex", Species: petstorev1.Species_SPECIES_DOG, Tags: []string{"house-trained"}}
fmt.Println(protojson.Format(pet))
}{"name":"Rex","species":"SPECIES_DOG","tags":["house-trained"]}With your own schemas
From stubs push to go get
- 01
Sign in from the CLI
Install the stubs CLI and sign in to stubs.dev. The buf CLI works too, with your buf.yaml as it is.
$ stubs login stubs.dev - 02
Push your module
Each push is an immutable commit of your .proto files, linted and checked for breaking changes.
$ stubs push - 03
Install it with go get
The package is built from that commit the first time it's asked for. The module's SDKs tab has the exact version.
$ go get stubs.dev/gen/go/acme/payments/protobuf-go
The Go SDK docs cover private modules and versions. Already using buf? Your projects work as they are.
What you get
Packages, not generated files
- 01
A version for every commit
Each push is a new package version that records its commit, so you can pin any version of the API.
- 02
Dependencies included
Imported modules and the runtime library come along as ordinary dependencies of the package.
- 03
The plugins you'd pick
protobuf-go for messages, with connect-go or grpc-go for clients and servers.
- 04
Private modules too
A private module's packages are private: Go fetches them with a Stubs token that can only read SDKs.
Try Stubs with your own schemas
Create an account, push a module and install your first generated SDK in a few minutes.