{"id":13496351,"url":"https://github.com/timostamm/protobuf-ts","last_synced_at":"2025-05-13T16:07:08.815Z","repository":{"id":37005567,"uuid":"292853702","full_name":"timostamm/protobuf-ts","owner":"timostamm","description":"Protobuf and RPC for TypeScript","archived":false,"fork":false,"pushed_at":"2025-04-18T22:47:57.000Z","size":19470,"stargazers_count":1201,"open_issues_count":71,"forks_count":136,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-18T23:17:39.060Z","etag":null,"topics":["bigint","code-size","custom-options","grpc-client","grpc-server","grpc-web","protobuf","protocol-buffers","reflection","strict-conformance","twirp","typescript","well-known-types"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timostamm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-09-04T13:21:36.000Z","updated_at":"2025-04-18T22:47:59.000Z","dependencies_parsed_at":"2024-06-18T12:19:17.453Z","dependency_job_id":"255781b5-5af3-468f-87b5-17280b7beb8a","html_url":"https://github.com/timostamm/protobuf-ts","commit_stats":{"total_commits":709,"total_committers":40,"mean_commits":17.725,"dds":"0.26234132581100145","last_synced_commit":"91917f699db63253449d892672027bbe717b50b3"},"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timostamm%2Fprotobuf-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timostamm%2Fprotobuf-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timostamm%2Fprotobuf-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timostamm%2Fprotobuf-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timostamm","download_url":"https://codeload.github.com/timostamm/protobuf-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250460837,"owners_count":21434303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bigint","code-size","custom-options","grpc-client","grpc-server","grpc-web","protobuf","protocol-buffers","reflection","strict-conformance","twirp","typescript","well-known-types"],"created_at":"2024-07-31T19:01:46.591Z","updated_at":"2025-05-13T16:07:08.808Z","avatar_url":"https://github.com/timostamm.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/timostamm"],"categories":["TypeScript","Language-Specific"],"sub_categories":["TypeScript"],"readme":"protobuf-ts [![npm](https://img.shields.io/npm/v/@protobuf-ts/plugin?x)](https://www.npmjs.com/package/@protobuf-ts/plugin)\n===========\n\n\n[Protocol buffers](https://developers.google.com/protocol-buffers) \nand [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call) \nfor Node.js and the Web Browser. \nPure TypeScript.\n\nFor the following `.proto` file:\n```proto\nsyntax = \"proto3\";\n\nmessage Person {\n    string name = 1;\n    uint64 id = 2;\n    int32 years = 3;\n    optional bytes data = 5;\n}\n```\n\n`protobuf-ts` generates code that can be used like this:\n\n```typescript\nlet pete: Person = {\n    name: \"pete\", \n    id: 123n, // it's a bigint\n    years: 30\n    // data: new Uint8Array([0xDE, 0xAD, 0xBE, 0xEF]);\n};\n\nlet bytes = Person.toBinary(pete);\npete = Person.fromBinary(bytes);\n\npete = Person.fromJsonString('{\"name\":\"pete\", \"id\":\"123\", \"years\": 30}')\n```\n\n### What are protocol buffers?\n\nProtocol buffers is an [interface definition language](https://en.wikipedia.org/wiki/Interface_description_language) \nand binary serialization format.  \nData structures defined in `.proto` files are platform-independent and can \nbe used in many languages.  \nTo learn more about the capabilities, please check the\nofficial [language guide](https://developers.google.com/protocol-buffers/docs/overview).\n\n\n### Quickstart\n\n- `npm install @protobuf-ts/plugin`\n  \u003e installs the plugin and the compiler \"protoc\"  \n\n- download the example file [msg-readme.proto](https://raw.githubusercontent.com/timostamm/protobuf-ts/main/packages/proto/msg-readme.proto) and place it into a `protos/` directory\n\n- `npx protoc --ts_out . --proto_path protos protos/msg-readme.proto`\n  \u003e generates msg-readme.ts  \n  \u003e if your protoc version asks for it, add the flag \"--experimental_allow_proto3_optional\"\n\n\n### Features\n\n- [x] implements the [canonical proto3 JSON format](MANUAL.md#json-format)\n- [x] implements the [binary format](MANUAL.md#binary-format) and respects [unknown fields](MANUAL.md#unknown-field-handling)\n- [x] strictly [conforms to the protobuf spec](MANUAL.md#conformance)\n- [x] generates clients that can be used with the [gRPC web](MANUAL.md#grpc-web-transport), \n      [Twirp](MANUAL.md#twirp-transport) or [gRPC](MANUAL.md#grpc-transport) protocol\n- [x] generates [native gRPC servers](MANUAL.md#native-grpc-server) and \n      [clients](MANUAL.md#native-grpc-client) for usage with `@grpc/grpc-js`\n- [x] supported by [Twirp-TS](https://github.com/hopin-team/twirp-ts) for Twirp servers running on Node.js\n- [x] automatically [installs protoc](./packages/protoc/README.md) (with Yarn berry, please use [node-protoc](https://www.npmjs.com/package/node-protoc))\n- [x] can optimize for [speed or code size](MANUAL.md#code-size-vs-speed)  \n- [x] supports [proto3 optionals](MANUAL.md#proto3-optionals)\n- [x] [supports bigint](MANUAL.md#bigint-support) for 64 bit integers\n- [x] every [message type](MANUAL.md#imessagetype) has methods to compare, clone, merge and type guard messages\n- [x] provides [reflection information](MANUAL.md#reflection), \n  including [custom options](MANUAL.md#custom-options)\n- [x] supports all [well-known-types](MANUAL.md#well-known-types) with custom JSON representation and helper methods\n- [x] uses standard [TypeScript enums](MANUAL.md#enum-representation)\n- [x] runs [in the Web Browser](MANUAL.md#running-in-the-web-browser) and in [Node.js](MANUAL.md#running-in-nodejs)\n- [x] uses an [algebraic data type for oneof](MANUAL.md#oneof-representation) groups\n- [x] can generate TypeScript [or JavaScript](MANUAL.md#outputting-javascript)\n- [x] available as a [plugin on the BSR](https://github.com/timostamm/protobuf-ts/tree/master/packages/bsr-plugin)\n- [x] can be [used with buf](https://github.com/timostamm/protobuf-ts/issues/93)\n\n\nRead the [MANUAL](MANUAL.md) to learn more.\n\n\n\n\n### Copyright\n\n- The [code to decode UTF8](./packages/runtime/src/protobufjs-utf8.ts) is Copyright 2016 by Daniel Wirtz, licensed under BSD-3-Clause.\n- The [code to encode and decode varint](./packages/runtime/src/goog-varint.ts) is Copyright 2008 Google Inc., licensed under BSD-3-Clause.\n- The [gRPC status codes](./packages/grpcweb-transport/src/goog-grpc-status-code.ts) are Copyright 2016 gRPC authors, licensed under Apache-2.0.\n- The [Twirp error codes](./packages/twirp-transport/src/twitch-twirp-error-code.ts) are Copyright 2018 Twitch Interactive, Inc., licensed under Apache-2.0.\n- The proto files in [proto/google](./packages/proto/google) and [test-conformance/proto](./packages/test-conformance/proto) are Copyright Google Inc. / Google LLC, licensed under Apache-2.0 / BSD-3-Clause.\n- All other files are licensed under Apache-2.0, see [LICENSE](./LICENSE). \n\n\n### Support\n\n\u003ca href=\"https://www.buymeacoffee.com/timostamm\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" width=\"109\" height=\"30\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimostamm%2Fprotobuf-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimostamm%2Fprotobuf-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimostamm%2Fprotobuf-ts/lists"}