{"id":27113236,"url":"https://github.com/keift/uuniq","last_synced_at":"2026-02-05T00:16:36.586Z","repository":{"id":280066317,"uuid":"940891960","full_name":"keift/uuniq","owner":"keift","description":"Unique Snowflake IDs and Symbolic IDs that can be generated for thousands of years.","archived":false,"fork":false,"pushed_at":"2025-04-01T01:13:55.000Z","size":170,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-01T01:15:13.342Z","etag":null,"topics":["id","snowflake","snowflake-id","symbolic","symbolic-id","unique","unique-id"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/keift.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-03-01T02:07:04.000Z","updated_at":"2025-04-01T01:10:40.000Z","dependencies_parsed_at":"2025-03-01T02:29:39.772Z","dependency_job_id":"89c93894-2a01-417d-b42b-84e5215f809c","html_url":"https://github.com/keift/uuniq","commit_stats":null,"previous_names":["keift/uuniq"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Fuuniq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Fuuniq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Fuuniq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Fuuniq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keift","download_url":"https://codeload.github.com/keift/uuniq/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247584054,"owners_count":20962071,"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","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":["id","snowflake","snowflake-id","symbolic","symbolic-id","unique","unique-id"],"created_at":"2025-04-07T02:50:12.999Z","updated_at":"2026-02-05T00:16:36.563Z","avatar_url":"https://github.com/keift.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[String]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String\n[Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number\n[Boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean\n[Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date\n[Buffer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer\n[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\n[Void]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined\n[Null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null\n[Undefined]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined\n\n\u003c!----\u003e\n\n[SnowflakeOptionsDefault]: ./src/defaults/SnowflakeOptions.default.ts\n[IncrementOptionsDefault]: ./src/defaults/IncrementOptions.default.ts\n\n\u003c!----\u003e\n\n[SnowflakeOptions]: ./src/types/SnowflakeOptions.type.ts\n[SnowflakeResolve]: ./src/types/SnowflakeResolve.type.ts\n[IncrementOptions]: ./src/types/IncrementOptions.type.ts\n\n\u003cdiv align=\"center\"\u003e\n  \u003cbr/\u003e\n  \u003cimg src=\"./assets/logo.png\" width=\"350px\"/\u003e\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/uuniq?label=version\u0026color=%23633BFF\"/\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/uuniq?label=license\u0026color=%23633BFF\"/\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dt/uuniq?label=downloads\u0026color=%2300927F\"/\u003e\n  \u003cimg src=\"https://img.shields.io/npm/unpacked-size/uuniq?label=size\u0026color=%2300927F\"/\u003e\n\u003c/div\u003e\n\n## Contents\n\n- [About](#about)\n- [Features](#features)\n- [Installation](#installation)\n- [Documentation](#documentation)\n  - [Tree](#tree)\n  - [Import](#import)\n  - [Constructors](#constructors)\n  - [Methods](#methods)\n  - [Types](#types)\n- [Links](#links)\n  - [Discord](https://discord.gg/keift)\n  - [Telegram](https://t.me/keiftco)\n  - [Twitter](https://x.com/keiftco)\n  - [GitHub](https://github.com/keift)\n- [License](#license)\n\n## About\n\nShort yet unique IDs.\n\n## Features\n\n- Short yet unique IDs\n- The possibility of collision is impossible\n- Suitable for distributed systems\n- Suitable for sorting and database indexes\n- Snowflake IDs can be generated, each one is timestamp based\n- Increment IDs can be generated, increasing each time they are generated\n- Symbolic IDs can be generated, similar to YouTube's video identities\n\n## Installation\n\nYou can install it as follows.\n\n```shell\n# NPM\nnpm add uuniq\n\n# PNPM\npnpm add uuniq\n\n# Yarn\nyarn add uuniq\n\n# Bun\nbun add uuniq\n\n# Deno\ndeno add uuniq\n```\n\n## Documentation\n\n### Tree\n\nBriefly as follows.\n\n```typescript\nuuniq\n│\n├── new Snowflake(options?)\n│   │\n│   ├── generate()\n│   └── resolve(id)\n│\n├── new Increment(options)\n│   │\n│   └── generate()\n│\n├── type SnowflakeOptions\n├── type SnowflakeResolve\n└── type IncrementOptions\n```\n\n### Import\n\nBriefly as follows.\n\n```typescript\nimport { Snowflake, Increment } from 'uuniq';\n```\n\n### Constructors\n\n`new Snowflake(options?)`\n\nSnowflake IDs are timestamp based identifiers. Each ID consists of numbers that are quite unique from the previous ones. Unique IDs can be generated in distributed systems by specifying Place IDs.\n\n\u003e | Parameter  | Type               | Default                   | Description            |\n\u003e | ---------- | ------------------ | ------------------------- | ---------------------- |\n\u003e | `options?` | [SnowflakeOptions] | [SnowflakeOptionsDefault] | Constructor's options. |\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e const SnowflakeIDs = new Snowflake();\n\u003e ```\n\n\u003cbr/\u003e\n\n`new Increment(options)`\n\nIncrement IDs that increase each time they are generated. Sequences are kept in the database. You can create a free database from [MongoDB Cloud](https://cloud.mongodb.com). Storing sequences requires tools that include `set(key, value)` and `get(key)`. We recommend [Keyv](https://npmjs.com/package/keyv). Sequences can be parsed by specifying Place IDs.\n\n\u003e | Parameter | Type               | Default                   | Description            |\n\u003e | --------- | ------------------ | ------------------------- | ---------------------- |\n\u003e | `options` | [IncrementOptions] | [IncrementOptionsDefault] | Constructor's options. |\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e import Keyv from 'keyv';\n\u003e import KeyvMongo from '@keyv/mongo';\n\u003e\n\u003e const UuniqStore = new Keyv(new KeyvMongo('mongodb+srv://...@...mongodb.net/app', { collection: 'uuniq' }));\n\u003e\n\u003e const IncrementIDs = new Increment({ store: UuniqStore });\n\u003e ```\n\n### Methods\n\n`Snowflake.generate()`\n\nGenerate Snowflake IDs.\n\n\u003e | Parameter | Type | Default | Description |\n\u003e | --------- | ---- | ------- | ----------- |\n\u003e |           |      |         |             |\n\u003e\n\u003e returns [String]\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e const NumericSnowflakeIDs = new Snowflake({ format: 'numeric', place_id: 0 });\n\u003e const SymbolicSnowflakeIDs = new Snowflake({ format: 'symbolic', place_id: 1 });\n\u003e\n\u003e NumericSnowflakeIDs.generate(); // \"102604921389056\"\n\u003e NumericSnowflakeIDs.generate(); // \"102604921389057\"\n\u003e\n\u003e SymbolicSnowflakeIDs.generate(); // \"T8Qu56ki\"\n\u003e SymbolicSnowflakeIDs.generate(); // \"T8Qu56kj\"\n\u003e ```\n\n\u003cbr/\u003e\n\n`Snowflake.resolve(id)`\n\nResolve the previously generated Snowflake ID. For this, the `format`, `epoch` and `place_id` values ​​in the Constructor must be correct.\n\n\u003e | Parameter | Type     | Default | Description        |\n\u003e | --------- | -------- | ------- | ------------------ |\n\u003e | `id`      | [String] |         | ID to be resolved. |\n\u003e\n\u003e returns [SnowflakeResolve]\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e const NumericSnowflakeIDs = new Snowflake({ format: 'numeric', place_id: 0 });\n\u003e const SymbolicSnowflakeIDs = new Snowflake({ format: 'symbolic', place_id: 1 });\n\u003e\n\u003e NumericSnowflakeIDs.resolve('102604921389056');\n\u003e /*\n\u003e   {\n\u003e     created_at: \"2025-03-14T11:35:07.409Z\",\n\u003e     place_id: 0,\n\u003e     sequence: 0\n\u003e   }\n\u003e */\n\u003e\n\u003e SymbolicSnowflakeIDs.resolve('T8Qu56ki');\n\u003e /*\n\u003e   {\n\u003e     created_at: \"2025-03-14T11:36:05.528Z\",\n\u003e     place_id: 0,\n\u003e     sequence: 0\n\u003e   }\n\u003e */\n\u003e ```\n\n\u003cbr/\u003e\n\n`Increment.generate()`\n\nGenerate Increment IDs that increase each time they are generated.\n\n\u003e | Parameter | Type | Default | Description |\n\u003e | --------- | ---- | ------- | ----------- |\n\u003e |           |      |         |             |\n\u003e\n\u003e returns [Promise]\u003c[String]\u003e\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e const NumericIncrementIDs = new Increment({ format: 'numeric', place_id: 0, store: UuniqStore });\n\u003e const SymbolicIncrementIDs = new Increment({ format: 'symbolic', place_id: 1, store: UuniqStore });\n\u003e\n\u003e await NumericIncrementIDs.generate(); // \"10000001\"\n\u003e await NumericIncrementIDs.generate(); // \"10000002\"\n\u003e\n\u003e await SymbolicIncrementIDs.generate(); // \"fxSL\"\n\u003e await SymbolicIncrementIDs.generate(); // \"fxSM\"\n\u003e ```\n\n### Types\n\n| Type               |\n| ------------------ |\n| [SnowflakeOptions] |\n| [SnowflakeResolve] |\n| [IncrementOptions] |\n\n## Links\n\n- [Discord](https://discord.gg/keift)\n- [Telegram](https://t.me/keiftco)\n- [Twitter](https://x.com/keiftco)\n- [GitHub](https://github.com/keift)\n\n## License\n\nMIT License\n\nCopyright (c) 2025 Keift\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeift%2Fuuniq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeift%2Fuuniq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeift%2Fuuniq/lists"}