{"id":29714964,"url":"https://github.com/bradbot1/gleam_bespoke","last_synced_at":"2026-04-20T03:38:35.978Z","repository":{"id":304067834,"uuid":"1017058081","full_name":"BradBot1/gleam_bespoke","owner":"BradBot1","description":"A UID library for gleam","archived":false,"fork":false,"pushed_at":"2025-07-16T22:49:55.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-18T05:26:30.869Z","etag":null,"topics":["erlang","gleam","gleam-lang","gleam-language","hexdocs","javascript","library"],"latest_commit_sha":null,"homepage":"","language":"Gleam","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/BradBot1.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-07-10T00:56:17.000Z","updated_at":"2025-07-16T22:49:58.000Z","dependencies_parsed_at":"2025-07-11T05:04:11.415Z","dependency_job_id":"4f32d549-913d-4e6c-9b6d-571716e47703","html_url":"https://github.com/BradBot1/gleam_bespoke","commit_stats":null,"previous_names":["bradbot1/gleam_bespoke"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/BradBot1/gleam_bespoke","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BradBot1%2Fgleam_bespoke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BradBot1%2Fgleam_bespoke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BradBot1%2Fgleam_bespoke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BradBot1%2Fgleam_bespoke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BradBot1","download_url":"https://codeload.github.com/BradBot1/gleam_bespoke/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BradBot1%2Fgleam_bespoke/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266796304,"owners_count":23985471,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["erlang","gleam","gleam-lang","gleam-language","hexdocs","javascript","library"],"created_at":"2025-07-24T05:00:56.240Z","updated_at":"2026-04-20T03:38:35.941Z","avatar_url":"https://github.com/BradBot1.png","language":"Gleam","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bespoke\n\n[![Package Version](https://img.shields.io/hexpm/v/bespoke)](https://hex.pm/packages/bespoke)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/bespoke/)\n\n```sh\ngleam add bespoke@1\n```\n\n## Types\n\n### Bespoke\n\n- A `Bespoke` instance *cannot* be serialized and transmitted over the network.\n- It's guarentees do *not* apply across machines, but *do* apply across erlang processes within the same cluster.\n- In erlang this is implemented via a `reference`.\n- In javascript this is implemented via a `Symbol`.\n\n### SerializableBespoke\n\n- A `SerializableBespoke` instance *can* be serialized and transmitted over the network.\n- It's guarentees apply everywhere, but could theoretically be broken.\n- Larger memory overhead than a `Bespoke` instance.\n- It is represented as a BitArray of 2048 bits split into the time of creation and random number generation.\n- Can be shared accross erlang *and* javascript processes.\n- On javascript this is implemented via a `Uint32Array`. (This is mutable so avoid editing it!)\n- On erlang this is implemented via a `bin`.\n\n## Usage\n\n### Local / Internal guaranteed uniqueness\n\n```gleam\nimport bespoke\n\npub fn main() -\u003e Nil {\n  let id = bespoke.new()\n  let id2 = bespoke.new()\n  // id and id2 are guaranteed to be unique\n}\n```\n\n### Shared / External guaranteed* uniqueness\n\n\u003e **Note**: *Guaranteed uniqueness is not guaranteed as psudo-randomness is utilised\n\n```gleam\nimport bespoke/serializable as bespoke\n\npub fn main() -\u003e Nil {\n  let key = bespoke.new()\n  let stringified = bespoke.serialize(key)\n\n  let assert Ok(parsed) = bespoke.deserialize(stringified)\n  assert parsed == key // Will be parsed to be equal to the original key\n}\n```\n\n## Supported runtimes\n\n|Runtime|Supported|\n|-------|---------|\n|Erlang|✅|\n|Node|✅|\n|Deno|✅|\n|Bun|✅|\n\n## Contributing\n\nPRs are welcome with or without prior discussion.\n\n## License\n\nThis project is licensed under the Apache License, Version 2.0.\n\nSee [LICENSE](LICENSE) for more information.\n\n## Additional information\n\nIf you're unsure about anything, contact me directly via BradBot_1#2042\n\nFurther documentation can be found at \u003chttps://hexdocs.pm/bespoke\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradbot1%2Fgleam_bespoke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradbot1%2Fgleam_bespoke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradbot1%2Fgleam_bespoke/lists"}