{"id":27268036,"url":"https://github.com/rakheyl/snowflake-uuid","last_synced_at":"2025-08-17T10:38:52.040Z","repository":{"id":41877572,"uuid":"403637189","full_name":"rakheyl/snowflake-uuid","owner":"rakheyl","description":"Twitter's Snowflake Generator with TypeScript / JavaScript - generate unique Id numbers at high scale with some simple guarantees.","archived":false,"fork":false,"pushed_at":"2022-06-07T20:16:25.000Z","size":30,"stargazers_count":47,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-18T05:42:14.084Z","etag":null,"topics":["javascript","javascript-library","node","node-js","nodejs","snowflake","snowflake-id","snowflake-javascript","snowflake-js","snowflake-twitter","snowflake-uuid","typescript","typescript-library","unique-id","unique-id-generator","unique-identifier","unique-identifiers","uniqueid","uuid","uuid-generator"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/snowflake-uuid","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rakheyl.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}},"created_at":"2021-09-06T13:41:40.000Z","updated_at":"2025-05-07T10:49:38.000Z","dependencies_parsed_at":"2022-08-20T08:10:58.887Z","dependency_job_id":null,"html_url":"https://github.com/rakheyl/snowflake-uuid","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rakheyl/snowflake-uuid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheyl%2Fsnowflake-uuid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheyl%2Fsnowflake-uuid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheyl%2Fsnowflake-uuid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheyl%2Fsnowflake-uuid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rakheyl","download_url":"https://codeload.github.com/rakheyl/snowflake-uuid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheyl%2Fsnowflake-uuid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270837407,"owners_count":24654377,"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-08-17T02:00:09.016Z","response_time":129,"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":["javascript","javascript-library","node","node-js","nodejs","snowflake","snowflake-id","snowflake-javascript","snowflake-js","snowflake-twitter","snowflake-uuid","typescript","typescript-library","unique-id","unique-id-generator","unique-identifier","unique-identifiers","uniqueid","uuid","uuid-generator"],"created_at":"2025-04-11T10:34:52.716Z","updated_at":"2025-08-17T10:38:52.027Z","avatar_url":"https://github.com/rakheyl.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cbr /\u003e\n    \u003cp\u003e\n    \u003ca href=\"https://www.npmjs.com/package/snowflake-uuid\"\u003e\n        \u003cimg src=\"https://nodei.co/npm/snowflake-uuid.png\" alt=\"NPM Repository\"\u003e\n    \u003c/p\u003e\n    \u003cp\u003e\n        \u003ca href=\"https://github.com/rakheyl/snowflake-uuid/issues\"\u003e\n            \u003cimg src=\"https://img.shields.io/github/issues/rakheyl/snowflake-uuid?style=flat-square\" alt=\"GitHub issues\" /\u003e\n        \u003c/a\u003e\n        \u003ca href=\"https://github.com/rakheyl/snowflake-uuid/blob/main/LICENSE\"\u003e\n            \u003cimg src=\"https://img.shields.io/github/license/rakheyl/snowflake-uuid?style=flat-square\" alt=\"GitHub license\" /\u003e\n        \u003c/a\u003e\n        \u003ca href=\"https://github.com/rakheyl/snowflake-uuid/blob/main/package.json\"\u003e\n            \u003cimg alt=\"node-current\" src=\"https://img.shields.io/node/v/snowflake-uuid\"\u003e\n        \u003c/a\u003e\n        \u003ca href=\"https://www.npmjs.com/package/snowflake-uuid\"\u003e\n            \u003cimg src=\"https://img.shields.io/npm/v/snowflake-uuid\" alt=\"NPM version\" /\u003e\n        \u003c/a\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\n# Snowflake-UUID\n\n[Twitter's Snowflake](https://github.com/twitter-archive/snowflake/tree/snowflake-2010) generator for NodeJS.\n\n-   Speedy\n-   Lightweight\n-   Zero dependencies\n\nSnowflake-UUID can generate unique Id numbers at high scale with some simple guarantees.\n\n## Installing\n\n```\nnpm install snowflake-uuid\n// or\nyarn add snowflake-uuid\n// or\npnpm add snowflake-uuid\n```\n\n## Example\n\n```js\nimport { Worker } from 'snowflake-uuid';\n// const { Worker } = require('snowflake-uuid');\n\nconst generator = new Worker(0, 1, {\n\tworkerIdBits: 5,\n\tdatacenterIdBits: 5,\n\tsequenceBits: 12,\n});\n\ngenerator.nextId(); // 87559690812260352n\ngenerator.nextId().toString(); // 87559690833231872\n\ngenerator.getCurrentSequence(); // 0n\ngenerator.getDatacenterId(); // 1n\ngenerator.getLastTimestamp(); // 1630335057075n\ngenerator.getWorkerId(); // 0n\n```\n\nGenerated IDs are [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) and can be easily converted into strings.\n\n## Constructor Options\n\n| Property                 | Description                                                                                                                   | Optional? | Type             | Default Value |\n| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- | --------- | ---------------- | ------------- |\n| workerId                 | Id for the worker                                                                                                             | Yes       | Number or BigInt | 0             |\n| datacenterId             | Identifier of the datacenter to which the worker belongs                                                                      | Yes       | Number or BigInt | 0             |\n| options                  | Custom options for the worker                                                                                                 | Yes       | Object           | undefined     |\n| options.epoch            | Custom epoch for timestamp generation. By default, the number of milliseconds since the first second of 2021                  | Yes       | Number or BigInt | 1609459200000 |\n| options.workerIdBits     | Number of usable bits for Worker Id. 5 by default, allows up to 31 Workers                                                    | Yes       | Number or BigInt | 5             |\n| options.datacenterIdBits | Number of usable bits for Datacenter Id. 5 by default, allows up to 31 Datacenters                                            | Yes       | Number or BigInt | 5             |\n| options.sequence         | For every Id that is generated on that process, this number is incremented                                                    | Yes       | Number or BigInt | 0             |\n| options.sequenceBits     | Number of usable bits for Sequence Id. 12 by default, allows up to 4095 generations per millisecond per Worker per Datacenter | Yes       | Number or BigInt | 12            |\n\n## Useful Links\n\n-   [Twitter's Snowflake repository](https://github.com/twitter-archive/snowflake/tree/snowflake-2010)\n-   [Announcing Snowflake](https://blog.twitter.com/engineering/en_us/a/2010/announcing-snowflake.html)\n-   [Twitter Ids](https://developer.twitter.com/en/docs/twitter-ids)\n-   [The GitHub repo](https://github.com/rakheyl/snowflake-uuid)\n-   [The NPM package](https://www.npmjs.com/package/snowflake-uuid)\n\n## License\n\nRefer to the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakheyl%2Fsnowflake-uuid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frakheyl%2Fsnowflake-uuid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakheyl%2Fsnowflake-uuid/lists"}