seanpmaxwell/jet-id

An extremely fast unique ID generator for JavaScript and TypeScript, with optional sorting/timestamping.

TypeScript

1

13 commits

updated Sep 19, 2026

See the code
collision-resistant
crockford-base32
csprng
id-generator
nanoid
primary-key
random-id
short-id
sortable-id
timestamp
typescript
ulid
unique-id
uuid
uuid-alternative

See what people are saying (1)

SourceMessageScoreDate

I built a unique ID generator that's ~60% faster than nanoid (r/webdev)

**What it looks like:** import jetId from 'jet-id'; jetId() // => '9Q8SWWBTY-7NVXM-FT9S6-XB4R3M' jetId.timed(); // '1KKNTQ2CN-606ZG-8VF48-76B6F3' (sorts by creation time) GitHub: [https://github.com/seanpmaxwell/jet-id](https://github.com/seanpmaxwell/jet-id) npm:…

0

Sep 19, 2026

README

jet-id

npm CI types dependencies license

An extremely fast unique ID generator for JavaScript and TypeScript, with optional sorting/timestamping.

Quick Glance

import jetId from 'jet-id';

jetId(); // '9Q8SWWBTY-7NVXM-FT9S6-XB4R3M'

Every ID is 25 random characters from the Crockford base32 alphabet, split into groups of 9-5-5-6.

Why jet-id?

  • Main features

    • Optionally timestamped and readable: Generated IDs are 28-character strings (25 Crockford characters plus 3 dashes). The first segment is 9 characters; if you want a timestamp, the first segment encodes the current epoch in Crockford form, so the ID length stays the same. There is also a built-in function for parsing timestamped ids and returning the epoch.
    • Fast: Faster than nanoid(). See benchmarks.
  • Other perks

    • Small: Only 6.4 kB packed.
    • Strong randomness: 125 random bits. For perspective, UUID v4 has 122.
    • Zero runtime dependencies.
    • Simple API: Just jetId() and jetId.test/jetId.timed/jetId.parseTimed.
    • Universal: Works in Node.js and modern browsers.

Install

npm install jet-id

API

Basic usage

Just call the default import, there are no options to pass:

import jetId from 'jet-id';

jetId(); // '9Q8SWWBTY-7NVXM-FT9S6-XB4R3M'

Validation

jetId contains a .test function if you need to validate an ID. Note that .test is not case-sensitive.

const someId = 'avz6yg1rb-47j6r-xgns9-tqw29a';

console.log(jetId.test(someId)); // => true

Timestamped/Sortable IDs

jetId.timed(epoch?: number): string encodes the current time in the first nine characters, so IDs created later sort after ones created earlier.

You can pass your own timestamp in milliseconds; otherwise it defaults to Date.now():

// Default, uses Date.now()
jetId.timed(); // '1KKNTQ2CN-606ZG-8VF48-76B6F3'

// Custom timestamp
const date = new Date(2015, 5, 3);
const timedId = jetId.timed(date.getTime());
logger.info(timedId); // "19PW3GCC0..."

If an id has been timestamped, you can extract the epoch with jetId.parseTimed(id: string): number. This will use the validation function above so parsing is not case-sensitive.

// Parse timed id
const parsedId = jetId.parseTimed(timedId);
const dateStr = new Date(parsedId).toLocaleString();
logger.info(dateStr); // "6/3/2015 ..."

Command line

FlagShortWhat it does
--count <n>-cHow many IDs to print. Defaults to 1.
--timed-tEncode the current epoch in the first 9 characters, so the IDs sort by creation time.
--help-hShow usage.
--version-vShow the installed version.

Benchmarks

Node v24.13.0; V8 13.6.233.17-node.37; darwin/arm64; Apple M4 Pro

Median of 7 samples, at least 500 ms each, after a 500 ms warmup per generator.

GeneratorCharactersRandom bitsMedian ops/secns/IDRelative throughput
jetId()2812583,503,28812.01.00x
nanoid()2112652,415,89719.10.63x
Nano ID: Crockford, 25 chars2512547,073,76121.20.56x
Nano ID: Crockford, 9-5-5-62812514,441,12769.20.17x
uuid v4()361228,536,998117.10.10x
crypto.randomUUID()361229,938,321100.60.12x

License

MIT © seanpmaxwell

Contributors

seanpmaxwell

13 commits

seanpmaxwell/jet-id

An extremely fast unique ID generator for JavaScript and TypeScript, with optional sorting/timestamping.

TypeScript

1

13 commits

updated Sep 19, 2026

See the code
collision-resistant
crockford-base32
csprng
id-generator
nanoid
primary-key
random-id
short-id
sortable-id
timestamp
typescript
ulid
unique-id
uuid
uuid-alternative

See what people are saying (1)

SourceMessageScoreDate

I built a unique ID generator that's ~60% faster than nanoid (r/webdev)

**What it looks like:** import jetId from 'jet-id'; jetId() // =&gt; '9Q8SWWBTY-7NVXM-FT9S6-XB4R3M' jetId.timed(); // '1KKNTQ2CN-606ZG-8VF48-76B6F3' (sorts by creation time) GitHub: [https://github.com/seanpmaxwell/jet-id](https://github.com/seanpmaxwell/jet-id) npm:…

0

Sep 19, 2026

README

jet-id

npm CI types dependencies license

An extremely fast unique ID generator for JavaScript and TypeScript, with optional sorting/timestamping.

Quick Glance

import jetId from 'jet-id';

jetId(); // '9Q8SWWBTY-7NVXM-FT9S6-XB4R3M'

Every ID is 25 random characters from the Crockford base32 alphabet, split into groups of 9-5-5-6.

Why jet-id?

  • Main features

    • Optionally timestamped and readable: Generated IDs are 28-character strings (25 Crockford characters plus 3 dashes). The first segment is 9 characters; if you want a timestamp, the first segment encodes the current epoch in Crockford form, so the ID length stays the same. There is also a built-in function for parsing timestamped ids and returning the epoch.
    • Fast: Faster than nanoid(). See benchmarks.
  • Other perks

    • Small: Only 6.4 kB packed.
    • Strong randomness: 125 random bits. For perspective, UUID v4 has 122.
    • Zero runtime dependencies.
    • Simple API: Just jetId() and jetId.test/jetId.timed/jetId.parseTimed.
    • Universal: Works in Node.js and modern browsers.

Install

npm install jet-id

API

Basic usage

Just call the default import, there are no options to pass:

import jetId from 'jet-id';

jetId(); // '9Q8SWWBTY-7NVXM-FT9S6-XB4R3M'

Validation

jetId contains a .test function if you need to validate an ID. Note that .test is not case-sensitive.

const someId = 'avz6yg1rb-47j6r-xgns9-tqw29a';

console.log(jetId.test(someId)); // => true

Timestamped/Sortable IDs

jetId.timed(epoch?: number): string encodes the current time in the first nine characters, so IDs created later sort after ones created earlier.

You can pass your own timestamp in milliseconds; otherwise it defaults to Date.now():

// Default, uses Date.now()
jetId.timed(); // '1KKNTQ2CN-606ZG-8VF48-76B6F3'

// Custom timestamp
const date = new Date(2015, 5, 3);
const timedId = jetId.timed(date.getTime());
logger.info(timedId); // "19PW3GCC0..."

If an id has been timestamped, you can extract the epoch with jetId.parseTimed(id: string): number. This will use the validation function above so parsing is not case-sensitive.

// Parse timed id
const parsedId = jetId.parseTimed(timedId);
const dateStr = new Date(parsedId).toLocaleString();
logger.info(dateStr); // "6/3/2015 ..."

Command line

FlagShortWhat it does
--count <n>-cHow many IDs to print. Defaults to 1.
--timed-tEncode the current epoch in the first 9 characters, so the IDs sort by creation time.
--help-hShow usage.
--version-vShow the installed version.

Benchmarks

Node v24.13.0; V8 13.6.233.17-node.37; darwin/arm64; Apple M4 Pro

Median of 7 samples, at least 500 ms each, after a 500 ms warmup per generator.

GeneratorCharactersRandom bitsMedian ops/secns/IDRelative throughput
jetId()2812583,503,28812.01.00x
nanoid()2112652,415,89719.10.63x
Nano ID: Crockford, 25 chars2512547,073,76121.20.56x
Nano ID: Crockford, 9-5-5-62812514,441,12769.20.17x
uuid v4()361228,536,998117.10.10x
crypto.randomUUID()361229,938,321100.60.12x

License

MIT © seanpmaxwell

Contributors

seanpmaxwell

13 commits

Languages

TypeScript

100.0%