crypto.randomUUID() to generate a UUID v4. This API works in Bun, Node.js, and browsers. It requires no dependencies.
In Bun, you can also use
Bun.randomUUIDv7() to generate a UUID v7.
See Docs > API > Utils for more useful utilities.
crypto.randomUUID() to generate a UUID v4. This API works in Bun, Node.js, and browsers. It requires no dependencies.
Bun.randomUUIDv7() to generate a UUID v7.