{"id":24836736,"url":"https://github.com/CorentinTh/friendly-ids","last_synced_at":"2025-10-14T10:31:08.892Z","repository":{"id":273899649,"uuid":"921198982","full_name":"CorentinTh/friendly-ids","owner":"CorentinTh","description":"Generate human readable unique identifiers.","archived":false,"fork":false,"pushed_at":"2025-01-23T14:27:39.000Z","size":68,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-30T12:43:24.324Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/CorentinTh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["CorentinTh"],"buy_me_a_coffee":"cthmsst"}},"created_at":"2025-01-23T14:27:27.000Z","updated_at":"2025-09-09T02:26:41.000Z","dependencies_parsed_at":"2025-01-31T05:04:43.301Z","dependency_job_id":null,"html_url":"https://github.com/CorentinTh/friendly-ids","commit_stats":null,"previous_names":["corentinth/friendly-ids"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CorentinTh/friendly-ids","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Ffriendly-ids","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Ffriendly-ids/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Ffriendly-ids/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Ffriendly-ids/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CorentinTh","download_url":"https://codeload.github.com/CorentinTh/friendly-ids/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Ffriendly-ids/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018781,"owners_count":26086452,"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-14T02:00:06.444Z","response_time":60,"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":[],"created_at":"2025-01-31T05:04:38.831Z","updated_at":"2025-10-14T10:31:08.887Z","avatar_url":"https://github.com/CorentinTh.png","language":"TypeScript","funding_links":["https://github.com/sponsors/CorentinTh","https://buymeacoffee.com/cthmsst"],"categories":["TypeScript"],"sub_categories":[],"readme":"# @corentinth/friendly-ids\n\n`@corentinth/friendly-ids` is a lib that generates human-readable IDs for your projects. It is designed to be simple, fast, and easy to use.\n\n```javascript\nimport { generateId } from '@corentinth/friendly-ids';\n\nconst id = generateId();\n\nconsole.log(id);\n// fierce-zebra-456\n```\n\n## Features\n\n- **78,648,000 combinations**: The default generator can generate up to 78,648,000 unique IDs (348 nouns x 226 adjectives x 1000 numbers).\n- **Customizable**: You can create your own generator with a custom separator and random int generator.\n- **No dependencies**: The lib has no dependencies and is lightweight.\n- **TypeScript support**: The lib is written in TypeScript and comes with type definitions.\n- **Tree-shakable**: The lib is tree-shakable and only includes the code you use.\n- **Datasets**: Each words is strictly letters, no special characters.\n\n## Installation\n\nTo install the package, use npm or yarn:\n\n```bash\npnpm install @corentinth/friendly-ids\n\nnpm install @corentinth/friendly-ids\n\nyarn add @corentinth/friendly-ids\n```\n\n## Usage\n\n### Generate a friendly ID\n\n```javascript\nimport { generateId } from '@corentinth/friendly-ids';\n\nconst id = generateId();\n\nconsole.log(id);\n// fierce-zebra-456\n```\n\n### Create a custom generator\n\n```javascript\nimport { createIdGenerator } from '@corentinth/friendly-ids';\n\nconst generateId = createIdGenerator();\nconst id = generateId();\n\nconsole.log(id);\n// fierce-zebra-456\n```\n\nWith a custom separator:\n\n```javascript\nimport { createIdGenerator } from '@corentinth/friendly-ids';\n\nconst generateId = createIdGenerator({ separator: '_' });\nconst id = generateId();\n\nconsole.log(id);\n// brave_horse_537\n```\n\nAll options:\n\n```javascript\nimport { createIdGenerator, adjectives } from '@corentinth/friendly-ids';\n\nconst generateId = createIdGenerator({\n  separator: '~',\n  // A list of chunks generators, each generator is a function that provides random helpers and expects a string or number as a return value\n  chunks: [\n    ({ getRandomItem }) =\u003e getRandomItem(adjectives),\n    ({ getRandomItem }) =\u003e getRandomItem(['foo', 'bar', 'baz']),\n    ({ getRandomInt }) =\u003e getRandomInt({ min: 50, max: 100 }),\n    ({ getRandomItem }) =\u003e getRandomItem(['a', 'b', 'c']),\n  ],\n  // A custom implementation of the random int generator, by default based on Math.random\n  getRandomInt: ({ min, max }) =\u003e /* your implementation */,\n});\n\nconst id = generateId();\n\nconsole.log(id);\n// fierce~foo~78~b\n```\n\n### Datasets\n\nThe lib comes with two datasets: [`adjectives`](./src/data/adjectives.ts) and [`animals`](./src/data/animals.ts).\nYou can use them to customize your generator:\n\n```javascript\nimport { animals, adjectives } from '@corentinth/friendly-ids';\n\nconsole.log(adjectives);\n// [ 'adaptable', 'adventurous', 'affable', 'affectionate', 'afraid', ... ]\n\nconsole.log(animals);\n// [ 'albatross', 'alligator', 'alpaca', 'ant', 'anteater', ... ]\n```\n\n## Contributing\n\nContributions are welcome! Feel free to open issues or submit pull requests.\n\n## Testing\n\nYou can run the tests with the following command:\n\n```bash\n# one shot\npnpm run test\n\n# watch mode\npnpm run test:watch\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more information.\n\n## Credits and Acknowledgements\n\nThis project is crafted with ❤️ by [Corentin Thomasset](https://corentin.tech).\nIf you find this project helpful, please consider [supporting my work](https://buymeacoffee.com/cthmsst).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCorentinTh%2Ffriendly-ids","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCorentinTh%2Ffriendly-ids","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCorentinTh%2Ffriendly-ids/lists"}