{"id":30891258,"url":"https://github.com/r-unic/serio","last_synced_at":"2026-03-10T00:31:36.295Z","repository":{"id":296926185,"uuid":"994860240","full_name":"R-unic/serio","owner":"R-unic","description":"Roblox buffer serialization library","archived":false,"fork":false,"pushed_at":"2026-03-01T19:33:41.000Z","size":230,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-01T21:53:40.800Z","etag":null,"topics":["deserialization","rbxts","roblox","serde","serdes","serialization"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@rbxts/serio","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/R-unic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-02T15:36:36.000Z","updated_at":"2026-03-01T19:33:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"601459bc-38e6-44a3-b659-8b55625af358","html_url":"https://github.com/R-unic/serio","commit_stats":null,"previous_names":["r-unic/serio"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/R-unic/serio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R-unic%2Fserio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R-unic%2Fserio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R-unic%2Fserio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R-unic%2Fserio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/R-unic","download_url":"https://codeload.github.com/R-unic/serio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R-unic%2Fserio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30318396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["deserialization","rbxts","roblox","serde","serdes","serialization"],"created_at":"2025-09-08T18:07:19.805Z","updated_at":"2026-03-10T00:31:36.279Z","avatar_url":"https://github.com/R-unic.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serio\n\n[![CI Status](https://github.com/R-unic/serio/actions/workflows/test.yml/badge.svg)](https://github.com/R-unic/serio/actions/workflows)\n[![Coverage Status](https://coveralls.io/repos/github/R-unic/serio/badge.svg?branch=master)](https://coveralls.io/github/R-unic/serio)\n\nBinary (buffer) serialization library for Roblox built on Flamework.\n\nHeavily inspired by @rbxts/flamework-binary-serializer. It generates schemas for ser/des from just a type just like FBS.\n\n\u003e [!CAUTION]\n\u003e Depends on `rbxts-transformer-flamework`!\n\n## Getting started\n\n### Schemas\n\nSchemas in Serio are just types. The most basic of schemas is just a singular type, such as `boolean`, `u8`, etc. However schemas can also contain objects, lists, sets, maps, tuples, and several Roblox data types. As an example:\n\n```ts\nimport type { u8 } from \"@rbxts/serio\";\n\ninterface MySchema {\n  readonly epic: boolean;\n  readonly foo: u8;\n}\n```\n\n### Serializers\n\nOnly one (global) function is exposed by Serio, `createSerializer()`. It's a macro you will pass your schema into to create a serializer. Serializers have two methods. `serialize()` and `deserialize()`. Serialized data contains a buffer (`buf`), and a list of blobs (`blobs`) (values which can not, or should not, be serialized. e.x. instances)\n\n```ts\nimport createSerializer from \"@rbxts/serio\";\n\nconst mySerializer = createSerializer\u003cMySchema\u003e();\nconst data = mySerializer.serialize({ epic: true, foo: 69 });\nconst result = mySerializer.deserialize(data);\nprint(data.buf, data.blobs);\nprint(result.epic, result.foo);\n```\n\n## Data Types\n\nSerio can serialize many data types, including numeric types not natively supported by the `buffer` library.\n\n### Safety\n\nSerio automatically asserts that inputs are within the bounds of their respective type. (e.x. `u8` only allows numbers 0 to 255)\n\n### Extended Support\n\nSerio supports data types that are not natively supported by the `buffer` library or Roblox. Currently the only examples of this are `f24`,`f16`, `f8`, `u12`, `u24`, `i12` and `i24`. 12-bit types are not allowed without using packing as they occupy individual bits and require packing.\n\nNote: Floating point values with low bit counts like f8 and f16 can produce pretty inaccurate results. Use with caution.\n\n```ts\nimport type { f8, f16, f24, u12, u24, i12, i24 } from \"@rbxts/serio\";\n\ninterface CoolTypes {\n  readonly a: f8;\n  readonly b: f16;\n  readonly c: f24;\n  readonly d: u12;\n  readonly e: u24;\n  readonly f: i12;\n  readonly g: i24;\n}\n```\n\n### Customization\n\nSerio encourages full customization over the size of serialized values.\n\n```ts\nimport type { List, String, HashSet, HashMap, Tuple, Vector, ScaleOffset, ScaleOffset2, i8, u8, i16, u16 } from \"@rbxts/serio\";\n\ninterface Example {\n  // serialize the length of the array/string/tuple/set/map as a u8, allowing a maximum of 255 elements (which most collections are under anyways)\n  string: String\u003cu8\u003e;\n  list: List\u003cstring, u8\u003e;\n  set: HashSet\u003c\"a\" | \"b\" | \"c\", u8\u003e;\n  map: HashMap\u003cstring, i8, u8\u003e;\n  tuple: Tuple\u003c[boolean, u8, string], u8\u003e;\n\n  // serialize X and Z as i16s but Y as a u16, allowing a range of:\n  // X: -32,768 - 32,767\n  // Y: 0 - 65,535\n  // Z: -32,768 - 32,767\n  positiveYVector: Vector\u003ci16, u16, i16\u003e;\n  velocity: Vector\u003ci8\u003e; // serialize X, Y, and Z as i8s\n\n  // serialize positional X, Y, and Z as i16s\n  cframe: Transform\u003ci16\u003e;\n\n  // serialize Scale as an f32, and Offset as a u8\n  udim: ScaleOffset\u003cf32, u8\u003e;\n  // serialize X.Scale and Y.Scale as f32s, and X.Offset and Y.Offset u8s\n  udim2: ScaleOffset2\u003cf32, u8\u003e;\n  // serialize X.Scale as an f32, Y.Scale as a u8, X.Offset as a u8, and Y.Offset as an i8\n  specificUDim2: ScaleOffset2\u003cf32, u8, u8, i8\u003e;\n}\n\nconst serializer = createSerializer\u003cExample\u003e();\n```\n\n### Packing\n\nSerio can bitpack your data for you using the `Packed\u003cT\u003e` datatype. It bitpacks every type under `T` recursively.\n\nYou may know a boolean can be represented by just one bit, but to insert a boolean into a buffer you need to serialize it as an entire byte (8 bits). This is where bitpacking comes in. We can keep track of a list of bits to later combine together into a single byte (for 8 or less booleans), rather than one byte for each of your booleans.\n\nThis doesn't just affect booleans though, it also affects:\n\n- Optional values\n  - Boolean for whether the value exists\n- UDim2s\n  - Optimization for [UDim2 special cases](https://github.com/R-unic/serio/blob/master/src/constants.ts#L123)\n  - Boolean for whether the UDim2 was optimized\n- Vector3s\n  - Optimization for [vector special cases](https://github.com/R-unic/serio/blob/master/src/constants.ts#L37)\n  - Boolean for whether the vector was optimized\n- CFrames\n  - Optimization for two vector special cases (0,0,0 and 1,1,1) and [axis aligned rotation special cases](https://github.com/R-unic/serio/blob/master/src/constants.ts#L8)\n  - Boolean for whether the position was optimized\n  - Boolean for whether the rotation was optimized\n\n### Supported Types\n\n- All primitives\n- Tuples\n- Objects\n- Array\u003cT\u003e\n- Map\u003cK, V\u003e\n- Set\u003cT\u003e\n- CFrame\n- Vector3\n- UDim\n- UDim2\n- Color3\n- ColorSequence\n- NumberSequence\n- Literal unions\n- Tagged unions\n- Complex mixed unions\n- Enums\n\n## Optimization\n\nCFrames use 6 bytes less than in FBS by default. In FBS CFrames are serialized as six f32s, 24 bytes. The default for Serio is three f32s for position, two u16s for rotation X/Z, and one i16 for rotation Y. And of course you can make this less by not using the default type for position X/Y/Z (`Transform\u003cX, Y, Z\u003e`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-unic%2Fserio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-unic%2Fserio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-unic%2Fserio/lists"}