{"id":31601769,"url":"https://github.com/pitabwire/xid","last_synced_at":"2025-10-06T07:59:35.775Z","repository":{"id":61975055,"uuid":"440572830","full_name":"pitabwire/xid","owner":"pitabwire","description":"Xid is a globally unique id generator. Xids are small, fast to generate, sortable, compact URL-safe string with no configuration or central generator server. ","archived":false,"fork":false,"pushed_at":"2025-06-19T03:45:15.000Z","size":48,"stargazers_count":19,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-19T04:33:53.650Z","etag":null,"topics":["dart","flutter","id-generator","uuid-generator","xid"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/xid","language":"Dart","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/pitabwire.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-12-21T15:59:04.000Z","updated_at":"2025-02-28T14:05:40.000Z","dependencies_parsed_at":"2024-05-14T08:48:56.666Z","dependency_job_id":"916e608e-7bfe-4891-9913-720130729a06","html_url":"https://github.com/pitabwire/xid","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"f07194bf9988edc7f8af361b72d9bcc4b0373a00"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/pitabwire/xid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitabwire%2Fxid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitabwire%2Fxid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitabwire%2Fxid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitabwire%2Fxid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pitabwire","download_url":"https://codeload.github.com/pitabwire/xid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitabwire%2Fxid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278577929,"owners_count":26009701,"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-10-06T02:00:05.630Z","response_time":65,"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":["dart","flutter","id-generator","uuid-generator","xid"],"created_at":"2025-10-06T07:59:34.617Z","updated_at":"2025-10-06T07:59:35.764Z","avatar_url":"https://github.com/pitabwire.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Globally Unique ID Generator\n\n[![Build Status](https://github.com/pitabwire/xid/actions/workflows/run_tests.yaml/badge.svg?branch=main)](https://github.com/pitabwire/xid/actions/workflows/run_tests.yaml)\n\n\u003e This project [https://github.com/pitabwire/xid](https://github.com/pitabwire/xid) is a dart implementation of the Go Lang library found here: [https://github.com/rs/xid](https://github.com/rs/xid)\n\n__ReadMe is from that project (with some modifications for dart).__\n\nPackage xid is a globally unique id generator library, ready to be used safely directly in your server code.\n\nXid is using Mongo Object ID algorithm to generate globally unique ids with a different serialization (base64) to make it shorter when transported as a string:\nhttps://docs.mongodb.org/manual/reference/object-id/\n\n- 4-byte value representing the seconds since the Unix epoch,\n- 3-byte machine identifier,\n- 2-byte process id, and\n- 3-byte counter, starting with a random value.\n\nThe binary representation of the id is compatible with Mongo 12 bytes Object IDs.\nThe string representation is using base32 hex (w/o padding) for better space efficiency\nwhen stored in that form (20 bytes). The hex variant of base32 is used to retain the\nsortable property of the id.\n\nXid doesn't use base64 because case sensitivity and the 2 non alphanum chars may be an\nissue when transported as a string between various systems. Base36 wasn't retained either\nbecause 1/ it's not standard 2/ the resulting size is not predictable (not bit aligned)\nand 3/ it would not remain sortable. To validate a base32 `xid`, expect a 20 chars long,\nall lowercase sequence of `a` to `v` letters and `0` to `9` numbers (`[0-9a-v]{20}`).\n\nUUIDs are 16 bytes (128 bits) and 36 chars as string representation. Twitter Snowflake\nids are 8 bytes (64 bits) but require machine/data-center configuration and/or central\ngenerator servers. xid stands in between with 12 bytes (96 bits) and a more compact\nURL-safe string representation (20 chars). No configuration or central generator server\nis required so it can be used directly in server's code.\n\n| Name        | Binary Size | String Size    | Features\n|-------------|-------------|----------------|----------------\n| [UUID]      | 16 bytes    | 36 chars       | configuration free, not sortable\n| [shortuuid] | 16 bytes    | 22 chars       | configuration free, not sortable\n| [Snowflake] | 8 bytes     | up to 20 chars | needs machin/DC configuration, needs central server, sortable\n| [MongoID]   | 12 bytes    | 24 chars       | configuration free, sortable\n| xid         | 12 bytes    | 20 chars       | configuration free, sortable\n\n[UUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier\n[shortuuid]: https://github.com/stochastic-technologies/shortuuid\n[Snowflake]: https://blog.twitter.com/2010/announcing-snowflake\n[MongoID]: https://docs.mongodb.org/manual/reference/object-id/\n\nFeatures:\n\n- Size: 12 bytes (96 bits), smaller than UUID, larger than snowflake\n- Base32 hex encoded by default (20 chars when transported as printable string, still sortable)\n- Non configured, you don't need set a unique machine and/or data center id\n- K-ordered\n- Embedded time with 1 second precision\n- Unicity guaranteed for 16,777,216 (24 bits) unique ids per second and per host/process\n\nReferences:\n\n- http://www.slideshare.net/davegardnerisme/unique-id-generation-in-distributed-systems\n- https://en.wikipedia.org/wiki/Universally_unique_identifier\n- https://blog.twitter.com/2010/announcing-snowflake\n\n## Usage\n\n```dart\nimport 'dart:developer';\n\nimport 'package:xid/xid.dart';\n\nvoid main() {\n  var xid = Xid();\n  log('generated id: $xid');\n}\n\n// generated id: 9m4e2mr0ui3e8a215n4g\n```\n\n\n## License\nLicensed under the [MIT License](https://raw.github.com/pitabwire/xid/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpitabwire%2Fxid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpitabwire%2Fxid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpitabwire%2Fxid/lists"}