Connect RPC
To ship your generated code for the repositorybuf.build/simpleemailapi/public, you don’t need to manually publish anything to NPM. You use the Buf Schema Registry (BSR) to generate and serve these packages for you.
Setup
1. Configure your environment
Tell NPM to look at the Buf Registry for any package starting with@buf. Run this command once:
2. Install generated SDKs
Install the Protobuf messages and Connect service definitions:3. Usage
Since the file is located atv1/email.proto, the BSR generates the service definition in a file named email_connect.
Key Mapping
| Source | Package Name | Import Path |
|---|---|---|
| Messages | @buf/simpleemailapi_public.bufbuild_es | .../v1/email_pb |
| Services | @buf/simpleemailapi_public.connectrpc_es | .../v1/email_connect |
File Extensions: If you are using ES Modules (modern Node.js or Vite), you may need to add the
.js extension to your imports even in TypeScript:
import { EmailService } from "@buf/.../v1/email_connect.js";