{"id":15066710,"url":"https://github.com/palform/prefixed-tsid","last_synced_at":"2026-02-16T04:36:11.319Z","repository":{"id":256553822,"uuid":"855722732","full_name":"palform/prefixed-tsid","owner":"palform","description":"Create type-safe Stripe-like prefixed database IDs using TSIDs","archived":false,"fork":false,"pushed_at":"2026-02-05T22:55:13.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-06T05:58:04.617Z","etag":null,"topics":["database","rust","tsid"],"latest_commit_sha":null,"homepage":"https://docs.rs/prefixed-tsid/latest/prefixed_tsid/index.html","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/palform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2024-09-11T11:06:37.000Z","updated_at":"2026-02-05T22:55:18.000Z","dependencies_parsed_at":"2024-09-11T17:12:45.529Z","dependency_job_id":"dca743e7-0864-4e28-8f3a-3f7a37ca5ab3","html_url":"https://github.com/palform/prefixed-tsid","commit_stats":null,"previous_names":["palform/prefixed-tsid"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/palform/prefixed-tsid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palform%2Fprefixed-tsid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palform%2Fprefixed-tsid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palform%2Fprefixed-tsid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palform%2Fprefixed-tsid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palform","download_url":"https://codeload.github.com/palform/prefixed-tsid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palform%2Fprefixed-tsid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29500531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T03:57:51.541Z","status":"ssl_error","status_checked_at":"2026-02-16T03:55:59.854Z","response_time":115,"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":["database","rust","tsid"],"created_at":"2024-09-25T01:11:00.064Z","updated_at":"2026-02-16T04:36:11.311Z","avatar_url":"https://github.com/palform.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prefixed TSIDs\n\n[Documentation](https://docs.rs/prefixed-tsid/latest/prefixed_tsid/index.html)\n\nThis library allows you to easily create and manage resource-specific prefixed IDs for your database, using the [`tsid`](https://github.com/jakudlaty/tsid/) crate. See [this article](https://www.foxhound.systems/blog/time-sorted-unique-identifiers/) for an explanation of why TSIDs are cool. For example:\n\n```ignore\norg_0GTM2MERJJE1T\n```\n\nEach type of resource gets its own unique prefix, and is represented as a type-safe ID in your code. You can declare resources manually or using our handy macro:\n\n```rust,ignore\nid_resource_type!(IDOrganisation, \"org\");\n\n// equals:\n\n#[derive(Eq, PartialEq, Clone, Copy, Debug, Hash)]\npub struct IDOrganisation;\nimpl TSIDResource for IDOrganisation {\n    fn prefix() -\u003e Option\u003cString\u003e {\n        Some(\"org\".to_owned())\n    }\n}\n```\n\nThen, you can easily create a random instance of the ID:\n\n```rust,ignore\nlet org_id = TSIDDatabaseID::\u003cIDOrganisation\u003e::random();\n```\n\nWhen stringified (or serialised using the `serde` feature), it will always include the prefix in the `TSIDResource` type.\n\nWhen stored in your database, it's simply a `u64` without the prefix information, since your database presumably keeps different resources in different tables anyway. The library comes with a built-in `sea-orm` integration.\n\n## Features\n\nBy default, only `serde` is enabled. You can enable additional features to support third-party libraries.\n\n- `serde`: serialize/deserialize integration. Adds the correct prefix when serializing, and returns an error if the prefix is missing or is wrong during deserialization.\n- `rocket`: integration for `FromParam` and `FromFormField` so you can use a `TSIDDatabaseID` in path components, query parameters, form requests, etc.\n- `sea-orm`: allows you to use `TSIDDatabaseID` in your entity structs, so the ID gets turned into a `u64` and vice versa.\n- `schemars`: allows generating JSON Schema containing a RegEx to match your prefixed ID.\n- `ts-rs`: for extra-nice WASM compatibility, allows generating a string type to represent the ID type in Typescript.\n- `diesel`: allows you to use `TSIDDatabaseID` in your models, so you can store the ID in your database.\n\n## Roadmap\n\n- Unit tests for sensitive bits, such as the prefix parsing\n- Better support and documentation for `IDUnknown` to allow working with non-resource-specific IDs in niche cases where it's needed.\n\n## Contributing\n\nContributions are super welcome, especially towards any roadmap items. Please open a PR with a short explanation of your additions, and we'll review them ASAP.\n\n## License\n\nMade by Palform Ltd (registered company 15796859 in the UK) under the **MIT License**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalform%2Fprefixed-tsid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalform%2Fprefixed-tsid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalform%2Fprefixed-tsid/lists"}