{"id":36502642,"url":"https://github.com/bare-ts/bare","last_synced_at":"2026-01-27T00:26:09.526Z","repository":{"id":37974862,"uuid":"444208873","full_name":"bare-ts/bare","owner":"bare-ts","description":"A TypeScript code generator for the BARE binary format ","archived":false,"fork":false,"pushed_at":"2025-12-22T11:14:24.000Z","size":1352,"stargazers_count":32,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T04:56:20.157Z","etag":null,"topics":["bare","binary-format","cli","code-generator","compiler","schema","serialization","tools"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bare-ts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-01-03T21:49:14.000Z","updated_at":"2025-12-30T12:20:46.000Z","dependencies_parsed_at":"2023-12-21T13:14:51.595Z","dependency_job_id":"849f15c5-3933-4c53-9923-43b030a6ee72","html_url":"https://github.com/bare-ts/bare","commit_stats":{"total_commits":191,"total_committers":1,"mean_commits":191.0,"dds":0.0,"last_synced_commit":"bc1c039cbf7775ee55d5050ddf193f68472246fa"},"previous_names":["bare-ts/bare","bare-ts/tools"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/bare-ts/bare","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bare-ts%2Fbare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bare-ts%2Fbare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bare-ts%2Fbare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bare-ts%2Fbare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bare-ts","download_url":"https://codeload.github.com/bare-ts/bare/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bare-ts%2Fbare/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28792979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bare","binary-format","cli","code-generator","compiler","schema","serialization","tools"],"created_at":"2026-01-12T02:25:10.169Z","updated_at":"2026-01-27T00:26:09.495Z","avatar_url":"https://github.com/bare-ts.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"#bare-ts\"\u003e\u003cimg alt=\"bare-ts\" height=\"200\" src=\"./logo.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\nA \u003cem\u003eTypeScript\u003c/em\u003e code generator for the \u003cem\u003eBARE\u003c/em\u003e binary format\n\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n\n[![NPM package][npm-img]][npm-bare-ts-tools]\n[![bundle size - minified and gzipped][bundlejs-img]][bundlejs]\n[![Coverage][coveralls-img]][coveralls]\n\u003c/div\u003e\n\n[Binary Application Record Encoding](https://baremessages.org/) (_BARE_) is a schema-based binary\nformat that favors compactness and composability.\n_@bare-ts/tools_ provides a compiler to generate _Typescript_ and _JavaScript_ codes from a _BARE_ schema.\n\nWarning: _BARE_ specification is currently an _IEF_ draft.\nThe specification is now pretty stable.\nHowever, it may still evolve before its final release.\n\n## Getting started\n\n[![@bare-ts/tools NPM version][npm-bare-ts-tools-img]][npm-bare-ts-tools]\n[![@bare-ts/lib NPM version][npm-bare-ts-lib-img]][npm-bare-ts-lib]\n\nFirst, install _@bare-ts/tools_ and _@bare-ts/lib_:\n\n```sh\nnpm install --save-dev @bare-ts/tools\nnpm install @bare-ts/lib\n```\n\n-   _@bare-ts/tools_ enables to generate decoders and encoders from a schema\n\n-   _@bare-ts/lib_ provides basic decoders and encoders\n\nAlternatively, you can download a bundled and executable version of _@bare-ts/tools_ named `bare` in the section _Assets_ of every [release on _GitHub_](https://github.com/bare-ts/tools/releases).\n\nThen, write a schema:\n\n```zig\ntype Gender enum {\n    FEMALE\n    FLUID\n    MALE\n}\n\ntype Person struct {\n    name: str\n    email: str\n    gender: optional\u003cGender\u003e\n}\n\ntype Organization struct {\n    name: str\n    email: str\n}\n\ntype Contact union { Person | Organization }\n\ntype Contacts list\u003cContact\u003e\n```\n\nCompile your schema into code:\n\n```sh\nbare schema.bare --out=code.ts\n```\n\nOnce the code is generated, encode and decode messages:\n\n```ts\nimport { Gender, decodeContacts, encodeContacts } from \"./code.js\"\nimport { strict } from \"node:assert\"\n\nconst contacts = [\n    {\n        tag: \"Person\",\n        val: {\n            name: \"Seldon\",\n            email: \"seldon@foundation.org\",\n            gender: Gender.Male,\n        },\n    },\n]\n\nconst payload = encodeContacts(contacts)\nconst contacts2 = decodeContacts(payload)\n\nstrict.deepEqual(contacts, contacts2)\n```\n\nRefer to our [`types` documentation page](./docs/types.md) to find the correspondence between BARE types and TypeScript types, as well as how some CLI options affect this.\n\n## Why BARE?\n\n**Compact messages**: in contrast to _BSON_, _CBOR_, and _MessagePack_, _BARE_ messages do not embed schema information.\n\n**Bijective encoding when possible**: most of BARE values have a single binary representation.\nThis makes easier the support of use-cases such as message deduplication.\n\n**Focus on modern platforms**: messages are octet-aligned and use little-endian representation.\n\n**Simple**: in contrast to _Protocol Buffer_ and _Flat Buffer_, _BARE_ doesn't constrain its binary format to support schema evolution.\n_Protocol Buffer_ embeds metadata in every message and makes optional every field.\n_BARE_ recommends using a tagged union as message type to support backward compatibility.\n\n## Why bare-ts?\n\n**Pragmatic error reporting**: _bare-ts_ distinguishes recoverable errors from API misuses.\nDecoders may emit recoverable errors (`BareError`) and provide enough information to understand why the message is malformed.\nAn API misuse emits an `AssertionError`.\n`AssertionError` are only emitted when the `development` [exports condition](https://nodejs.org/api/cli.html#-c-condition---conditionscondition) is set or when the `NODE_ENV` environment variable is set to `development`.\nMoreover, _bare-ts_ assumes the use of TypeScript that reduces the number of API misuses to check.\n\n**Optimized bundle size**: _bare-ts_ adopts functional and procedural programming styles.\nThis enables to take advantage of modern _dead-code elimination_ techniques, such as _tree-shaking_.\nUsing bundlers such as _ESbuild_, _Rollup_, or _Webpack_, your bundle contains only the functions which are actually used.\n\n**Generation of efficient code** _bare-ts_ takes care to generate code that modern JavaScript engines may optimize.\n\n[npm-img]: https://flat.badgen.net/npm/v/@bare-ts/tools\n[npm-bare-ts-tools-img]: https://flat.badgen.net/npm/v/@bare-ts/tools?label=npm:@bare-ts/tools\n[npm-bare-ts-tools]: https://www.npmjs.com/package/@bare-ts/tools\n\n[npm-bare-ts-lib-img]: https://flat.badgen.net/npm/v/@bare-ts/lib?label=npm:@bare-ts/lib\n[npm-bare-ts-lib]: https://www.npmjs.com/package/@bare-ts/lib\n\n[coveralls-img]: https://flat.badgen.net/coveralls/c/github/bare-ts/bare\n[coveralls]: https://coveralls.io/github/bare-ts/bare?branch=main\n\n[bundlejs-img]: https://img.shields.io/badge/dynamic/json?style=flat-square\u0026label=minzipped\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=@bare-ts/tools\n[bundlejs]: https://bundlejs.com/?q=%40bare-ts%2Ftools\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbare-ts%2Fbare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbare-ts%2Fbare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbare-ts%2Fbare/lists"}