{"_id":"@bufbuild/protoc-gen-grpc-es","_rev":"4-026f6ede367dee78604f4ab345fc8c32","name":"@bufbuild/protoc-gen-grpc-es","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bufbuild/protoc-gen-grpc-es","version":"0.0.1","keywords":["protobuf","schema","typescript","ecmascript","grpc","grpc-js","protoc","protoc-plugin"],"license":"Apache-2.0","_id":"@bufbuild/protoc-gen-grpc-es@0.0.1","maintainers":[{"name":"bufdev","email":"pedge@buf.build"},{"name":"tstamm-buf","email":"tstamm@buf.build"},{"name":"bufbot","email":"bot@buf.build"},{"name":"jdailey_buf","email":"jdailey@buf.build"},{"name":"doriakeung","email":"dkeung@buf.build"}],"homepage":"https://github.com/bufbuild/protoc-gen-grpc-es","bugs":{"url":"https://github.com/bufbuild/protoc-gen-grpc-es/issues"},"bin":{"protoc-gen-grpc-es":"bin/protoc-gen-grpc-es"},"dist":{"shasum":"27ff82bbfa4783c95c0edeb59d9d546abaece6f7","tarball":"https://registry.npmjs.org/@bufbuild/protoc-gen-grpc-es/-/protoc-gen-grpc-es-0.0.1.tgz","fileCount":6,"integrity":"sha512-rEp53JeCIf90HcgHlt0wNvH1U4V5CYFTi5NF8tV7S45IF8NarERYgf2D9034E80CslCg6Z+YSj4Ml50Tjy/XXg==","signatures":[{"sig":"MEQCIBV+zT3R6DH+MVG9CnNvafAkgoWY1QhBzp7JcEg1XUh/AiAOMiGOEAZS9fx0bjHCYsm9X/Cw0F/knuhvivbjmQvDIQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40577},"engines":{"node":">=20"},"gitHead":"796f30cfd64b700433707fc2656576c0c7c410aa","scripts":{"all":"npm run build && npm run generate && npm run test && npm run lint && npm run format && npm run license-header","lint":"biome lint --error-on-warnings","test":"tsx --test test/*.test.ts","build":"tsc --project tsconfig.json --outDir ./dist/cjs","format":"biome format --write","pretest":"tsc --project tsconfig.test.json","generate":"buf generate","prebuild":"rm -rf ./dist/cjs/*","pregenerate":"rm -rf src/gen/*","postgenerate":"license-header src/gen","license-header":"license-header"},"_npmUser":{"name":"tstamm-buf","email":"tstamm@buf.build"},"repository":{"url":"git+https://github.com/bufbuild/protoc-gen-grpc-es.git","type":"git"},"_npmVersion":"11.5.1","description":"Protobuf code generator for @grpc/grpc-js","directories":{},"_nodeVersion":"24.5.0","dependencies":{"@bufbuild/protobuf":"2.12.1","@bufbuild/protoplugin":"2.12.1"},"licenseHeader":{"yearRange":"2026","licenseType":"apache","copyrightHolder":"Buf Technologies, Inc."},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","typescript":"^7.0.2","@types/node":"^26.1.2","@bufbuild/buf":"^1.72.0","@grpc/grpc-js":"^1.14.4","@biomejs/biome":"^2.5.6","@bufbuild/protoc-gen-es":"2.12.1","@bufbuild/license-header":"^0.0.4"},"preferUnplugged":true,"peerDependencies":{"@bufbuild/protobuf":"2.12.1"},"peerDependenciesMeta":{"@bufbuild/protobuf":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/protoc-gen-grpc-es_0.0.1_1785759611309_0.763237847749241","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-08-03T12:20:11.033Z","modified":"2026-09-16T06:38:46.793Z","0.0.1":"2026-08-03T12:20:11.484Z"},"bugs":{"url":"https://github.com/bufbuild/protoc-gen-grpc-es/issues"},"license":"Apache-2.0","homepage":"https://github.com/bufbuild/protoc-gen-grpc-es","keywords":["protobuf","schema","typescript","ecmascript","grpc","grpc-js","protoc","protoc-plugin"],"repository":{"url":"git+https://github.com/bufbuild/protoc-gen-grpc-es.git","type":"git"},"description":"Protobuf code generator for @grpc/grpc-js","maintainers":[{"email":"pedge@buf.build","name":"bufdev"},{"email":"tstamm@buf.build","name":"tstamm-buf"},{"email":"bot@buf.build","name":"bufbot"},{"email":"jdailey@buf.build","name":"jdailey_buf"},{"email":"dkeung@buf.build","name":"doriakeung"},{"email":"cmahony@buf.build","name":"cmahony"},{"email":"kmcdonald@buf.build","name":"kmcdonald-buf"}],"readme":"<div align=\"center\">\n\n![The Buf logo](./.github/buf-logo.svg)\n\n# @bufbuild/protoc-gen-grpc-es\n\n[![NPM Version](https://img.shields.io/npm/v/%40bufbuild%2Fprotoc-gen-grpc-es?style=flat-square)](https://www.npmjs.com/package/@bufbuild/protoc-gen-grpc-es)\n[![NPM License](https://img.shields.io/npm/l/%40bufbuild%2Fprotoc-gen-grpc-es?style=flat-square)](https://github.com/bufbuild/protoc-gen-grpc-es/blob/main/LICENSE)\n[![Slack](https://img.shields.io/badge/slack-buf-%23e01e5a?style=flat-square)](https://buf.build/links/slack)\n\n`protoc-gen-grpc-es` generates **well-typed, idiomatic [gRPC](https://grpc.io) stubs** for [Protobuf-ES](https://github.com/bufbuild/protobuf-es) (`@bufbuild/protobuf`), the ergonomic and modern Protobuf library for JavaScript and TypeScript.\n\nPlugs into your existing [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) channels and servers.\n\n</div>\n\nIt's a compatibility layer for projects already built on [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js). The generated clients and servers plug into your existing gRPC channels and servers, but serialize Protobuf-ES messages directly. This lets you upgrade to a better Protobuf package without touching your RPC stack.\n\n> [!TIP]\n> For new projects, use [Connect-ES](https://github.com/connectrpc/connect-es) instead. Connect speaks the gRPC and gRPC-Web protocols in addition to its own, so existing gRPC clients can call a Connect server unchanged. But you also get plain HTTP APIs you can `curl`, first-class streaming, and generated clients for **every major language**, including your frontend. `protoc-gen-grpc-es` only exists so current gRPC codebases already built on `@grpc/grpc-js` can get the improvements of Protobuf-ES today without a full rewrite.\n\n## Getting started\n\n### Installation\n\nTo install the runtime libraries and the `protoc` plugins, run:\n\n```shell\nnpm install @bufbuild/protobuf @grpc/grpc-js\nnpm install --save-dev @bufbuild/protoc-gen-es @bufbuild/protoc-gen-grpc-es @types/node\n```\n\n### Generating code\n\nWe recommend using [`buf`](https://github.com/bufbuild/buf) to generate code. Add a new `buf.gen.yaml` configuration file:\n\n```yaml\n# Learn more: https://buf.build/docs/configuration/v2/buf-gen-yaml\nversion: v2\ninputs:\n  - directory: proto\nplugins:\n  - local: protoc-gen-es\n    out: src/gen\n    opt: target=ts\n  - local: protoc-gen-grpc-es\n    out: src/gen\n    opt: target=ts\n```\n\nPlace your `.proto` files in the `./proto` directory, then run:\n\n```bash\nnpx buf generate\n```\n\n## Usage\n\nFor every Protobuf file that contains services, the plugin generates a `_grpc.ts` file next to the `_pb.ts` file from `protoc-gen-es`. For example, the following service:\n\n```protobuf\nsyntax = \"proto3\";\npackage example;\n\nservice ElizaService {\n  rpc Say(SayRequest) returns (SayResponse);\n}\n\nmessage SayRequest {\n  string sentence = 1;\n}\n\nmessage SayResponse {\n  string sentence = 1;\n}\n```\n\ngenerates the following exports in `eliza_grpc.ts`:\n\n- `ElizaServiceDefinition`: The `@grpc/grpc-js` service definition.\n- `ElizaServiceServer`: An interface for the server implementation.\n- `ElizaServiceClient`: A client with a typed method for every RPC.\n\nTo implement a server:\n\n```ts\nimport * as grpc from \"@grpc/grpc-js\";\nimport { ElizaServiceDefinition, type ElizaServiceServer } from \"./gen/eliza_grpc.js\";\n\nconst implementation: ElizaServiceServer = {\n  say(call, callback) {\n    callback(null, { sentence: `You said: ${call.request.sentence}` });\n  },\n};\n\nconst server = new grpc.Server();\nserver.addService(ElizaServiceDefinition, implementation);\nserver.bindAsync(\"localhost:50051\", grpc.ServerCredentials.createInsecure(), () => {});\n```\n\nTo call it with a client:\n\n```ts\nimport * as grpc from \"@grpc/grpc-js\";\nimport { ElizaServiceClient } from \"./gen/eliza_grpc.js\";\n\nconst client = new ElizaServiceClient(\"localhost:50051\", grpc.credentials.createInsecure());\nclient.say({ sentence: \"Hi\" }, (error, response) => {\n  if (error) {\n    throw error;\n  }\n  console.log(response?.sentence);\n});\n```\n\n## Plugin options\n\n`protoc-gen-grpc-es` supports the same options as `protoc-gen-es`:\n\n| Option                                                                                                                      | Values                               | Default  | Description                                                     |\n| --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | -------- | --------------------------------------------------------------- |\n| [`target`](https://github.com/bufbuild/protobuf-es/tree/main/packages/protoc-gen-es#target)                                 | `js`, `ts`, `dts` (combine with `+`) | `js+dts` | Which files to generate.                                        |\n| [`import_extension`](https://github.com/bufbuild/protobuf-es/tree/main/packages/protoc-gen-es#import_extension)             | `none`, `js`, `ts`                   | `none`   | File extension to use in import paths.                          |\n| [`js_import_style`](https://github.com/bufbuild/protobuf-es/tree/main/packages/protoc-gen-es#js_import_style)               | `module`, `legacy_commonjs`          | `module` | Use ECMAScript `import`/`export` or CommonJS `require`.         |\n| [`keep_empty_files`](https://github.com/bufbuild/protobuf-es/tree/main/packages/protoc-gen-es#keep_empty_filestrue)         | `true`, `false`                      | `false`  | Keep generated files even if they contain no services.          |\n| [`ts_nocheck`](https://github.com/bufbuild/protobuf-es/tree/main/packages/protoc-gen-es#ts_nochecktrue)                     | `true`, `false`                      | `false`  | Generate a `// @ts-nocheck` annotation at the top of each file. |\n| [`elide_plugin_version`](https://github.com/bufbuild/protobuf-es/tree/main/packages/protoc-gen-es#elide_plugin_versiontrue) | `true`, `false`                      | `false`  | Omit the plugin version from generated file headers.            |\n\nMake sure to use the same `target` and `import_extension` values for both plugins, so that the generated `_grpc` files can import from the generated `_pb` files.\n","readmeFilename":"README.md"}