Generating unique ids — a time-sortable UUID v7 makes an excellent, index-friendly database key.
Overview
Every ID kind in one package — classic UUID v4, the time-sortable UUID v7 (a superb index-friendly database key), Nano-ID-style and short URL-safe codes, plus prefixed ids like user_9f8c…. Cryptographically random (Web Crypto), monotonic within a millisecond.
Install
$ npm install @lacspace/id
Quick example
@lacspace/idts
uuidv7()
Returns "0192e7a1-…-7abc-…" (sortable)
Tips
Prefer `uuidv7()` for primary keys (sortable by creation time); use short ids for public URLs.
Cryptographically random via Web Crypto, monotonic within a millisecond.
Zero-dependency and isomorphic — safe to import on the server, in the browser, on the edge and in React Native. It tree-shakes, so you only ship what you import.
Looking for the complete API and more examples? The npm page and GitHub README carry the full reference — or grab the PDF.