Stubs
TypeScript SDKs

Generate a TypeScript SDK from Protobuf

Push your .proto files to Stubs and install the generated TypeScript code with npm, 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 TypeScript SDK of stubs/petstore, a public demo module: a small pet store's API. Install it with npm in an empty project. You don't need an account.

Install it

Point the scope at the registry.npmrc
@stubsdev:registry=https://npm.stubs.dev/
Install the packageTerminal
npm install @stubsdev/stubs_petstore.protobuf-es@2.16.0-20261128015706-2ff545c5db11.4
main.ts
import { create, toJsonString } from "@bufbuild/protobuf";
import { PetSchema, Species } from "@stubsdev/stubs_petstore.protobuf-es/petstore/v1/pet_pb.js";

const pet = create(PetSchema, { name: "Rex", species: Species.DOG, tags: ["house-trained"] });
console.log(toJsonString(PetSchema, pet));
Output
{"name":"Rex","species":"SPECIES_DOG","tags":["house-trained"]}

With your own schemas

From stubs push to npm

  1. 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
  2. 02

    Push your module

    Each push is an immutable commit of your .proto files, linted and checked for breaking changes.

    $ stubs push
  3. 03

    Install it with npm

    The package is built from that commit the first time it's asked for. The module's SDKs tab has the exact version.

    $ npm install @stubsdev/acme_payments.protobuf-es

The TypeScript SDK docs cover private modules and versions. Already using buf? Your projects work as they are.

What you get

Packages, not generated files

Try Stubs with your own schemas

Create an account, push a module and install your first generated SDK in a few minutes.