{"id":30273344,"url":"https://github.com/zfedoran/brine-kiwi","last_synced_at":"2026-03-11T03:02:53.776Z","repository":{"id":296754484,"uuid":"994385860","full_name":"zfedoran/brine-kiwi","owner":"zfedoran","description":"Kiwi is a schema-based binary format for efficiently encoding trees of data.","archived":false,"fork":false,"pushed_at":"2025-06-01T21:00:35.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-08T02:20:45.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/zfedoran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2025-06-01T20:30:51.000Z","updated_at":"2025-06-01T21:00:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"99aba7b6-9ed2-4480-b501-d5e33d73a5d2","html_url":"https://github.com/zfedoran/brine-kiwi","commit_stats":null,"previous_names":["zfedoran/brine-kiwi"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zfedoran/brine-kiwi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfedoran%2Fbrine-kiwi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfedoran%2Fbrine-kiwi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfedoran%2Fbrine-kiwi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfedoran%2Fbrine-kiwi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zfedoran","download_url":"https://codeload.github.com/zfedoran/brine-kiwi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfedoran%2Fbrine-kiwi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30368580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-16T07:01:27.599Z","updated_at":"2026-03-11T03:02:53.764Z","avatar_url":"https://github.com/zfedoran.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# brine-kiwi\n[![crates.io](https://img.shields.io/crates/v/brine-kiwi.svg?style=flat)](https://crates.io/crates/brine-kiwi)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/license/mit/)\n\nThis is a Rust-native implementation of the Kiwi schema, decoder, encoder, compiler and rust code generator. \n\nKiwi is a schema-based binary format for efficiently encoding trees of data.\nIt's inspired by Google's [Protocol Buffer](https://developers.google.com/protocol-buffers/) format but is simpler, has a more compact encoding, and has better support for optional fields.\n\n\u003e [!NOTE]\n\u003e Kiwi was originally designed by [Evan Wallace](https://madebyevan.com/figma/) for [Figma](https://www.figma.com/). \n\u003e\n\u003e This Rust re-implementation (brine‐kiwi) is a fully‐native Rust compiler and SDK. This crate provides a runtime SDK, a schema compiler (including Rust code generation), and a CLI.\n\n## Key Features\n\n- **Efficient encoding of common values:** Numeric types use variable-length encoding so small values take fewer bytes.  \n- **Efficient encoding of compound objects:** Structs allow nested objects with zero overhead for absent data.  \n- **Detectable optional fields:** Messages can tell when a field is missing—unlike Protocol Buffers for repeated fields.  \n- **Linearly serializable:** Read/write in a single pass for cache efficiency and guaranteed time complexity.  \n- **Backwards compatibility:** New schema versions can read old data.  \n- **Forwards compatibility:** Old schema versions can skip unknown fields when a copy of the new schema is present.  \n- **Simple implementation:** Minimal API; the generated C++ code depends on a single file.\n\n\n## Example Schema\n\n```proto\nenum Type {\n  FLAT = 0;\n  ROUND = 1;\n  POINTED = 2;\n}\n\nstruct Color {\n  byte red;\n  byte green;\n  byte blue;\n  byte alpha;\n}\n\nmessage Example {\n  uint clientID = 1;\n  Type type = 2;\n  Color[] colors = 3;\n}\n```\n\nYou can compile this schema to binary or generate Rust code using the `bkiwi` CLI tool.\n\nSee the generated rust code [here](https://github.com/zfedoran/brine-kiwi/blob/main/example/src/generated.rs).\n\n\n\n## Quickstart\n\n1. **Build everything**  \n   Change into the workspace root and run:\n   ```\n   cargo build\n   cargo install --path cli\n   ```\n\n2. **Compile a schema to binary**  \n   ```\n   bkiwi compile -i path/to/schema.kiwi -o path/to/schema.kiwi.bin\n   ```\n\n3. **Decode a binary to JSON**  \n   ```\n   bkiwi decode -i path/to/schema.kiwi.bin\n   ```\n\n4. **Generate Rust code**  \n   ```\n   bkiwi gen-rust -i path/to/schema.kiwi -o path/to/generated.rs\n   ```\n\n## Native Types\n\n- **bool** (1 byte)  \n- **byte** (u8, 1 byte)  \n- **int** (i32 varint, ≤5 bytes)  \n- **uint** (u32 varint, ≤5 bytes)  \n- **float** (f32, 4 bytes; zero encodes as 1 byte)  \n- **string** (UTF-8, null-terminated)  \n- **int64** (i64 varint, ≤9 bytes)  \n- **uint64** (u64 varint, ≤9 bytes)  \n- **T[]** (array of any type)\n\n## User Types\n\n- **enum**: Named variants backed by a uint.  \n- **struct**: Fixed, required fields in order (no additions once in use).  \n- **message**: Optional fields; new fields can be added without breaking older readers.\n\n## Examples\n\n- **Compile schema.kiwi**  \n  ```\n  bkiwi compile -i example/simple.kiwi -o example/simple.kiwi.bin\n  ```\n\n- **Decode to JSON**  \n  ```\n  bkiwi decode -i example/simple.kiwi.bin\n  ```\n\n- **Generate Rust bindings**  \n  ```\n  bkiwi gen-rust -i example/simple.kiwi -o example/src/generated.rs\n  ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfedoran%2Fbrine-kiwi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzfedoran%2Fbrine-kiwi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfedoran%2Fbrine-kiwi/lists"}