A tiny (~230B) and fast UUID (v4) generator for Node.js and the browser, available in both non-secure and cryptographically secure modes.
@lukeed/uuid is a lightweight, high-speed library for generating RFC4122 Version 4 UUIDs (random-based unique identifiers). It solves the need for a minimal, fast, and reliable UUID generator in both Node.js and browser environments, offering a significant performance advantage over many other solutions.
Developers building applications in Node.js or the browser that require efficient, low-overhead generation of unique identifiers, particularly those concerned with bundle size and runtime performance.
Developers choose @lukeed/uuid for its exceptional speed and tiny size, which outperforms alternatives like the `uuid` package, while providing the flexibility of both non-secure and cryptographically secure generation modes in a simple, well-optimized package.
A tiny (~230B)and fast UUID (V4) generator for Node and the browser
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The default mode is only ~231 bytes gzipped, minimizing impact on web bundles and making it ideal for frontend performance optimization.
Benchmarks show over 6 million ops/sec in Node.js, significantly outpacing alternatives like the uuid package due to optimized buffer allocation and hexadecimal pair composition.
Offers both a fast non-secure mode using Math.random and a secure mode leveraging the environment's crypto module, catering to different security and performance needs.
Works in Node.js and all browsers with preconfigured ESM, CommonJS, and UMD builds, ensuring seamless integration across diverse project setups.
Only generates UUID v4; developers needing v1, v3, or v5 must use other libraries, limiting its utility for projects with diverse UUID requirements.
The secure mode relies on the environment's crypto module, which may not be available in all contexts, such as legacy browsers or restricted environments, forcing a fallback to non-secure mode.
Version 2.0.0 moved the secure export to a separate path, which could break existing implementations and require code updates during migration, as noted in the README.