Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jkomyno/uniku/llms.txt

Use this file to discover all available pages before exploring further.

The CLI provides commands to generate IDs using all supported generators. Each generator has specific options for customization.

Basic Usage

Generate a single ID using shorthand syntax:
uniku uuid    # UUID v4 (default)
uniku ulid    # ULID
uniku nanoid  # Nanoid
uniku cuid    # CUID2
uniku ksuid   # KSUID
Or use the explicit generate command:
uniku generate uuid
uniku generate ulid

UUID Generation

Generate UUIDs (version 4 or 7):
# UUID v4 (random, default)
uniku uuid
# => 550e8400-e29b-41d4-a716-446655440000

# UUID v7 (time-ordered)
uniku uuid --version 7
# => 018e5e5c-7c8a-7000-8000-000000000000

UUID Options

--version
4 | 7
default:"4"
UUID version to generate. Alias: -v
  • 4 — Random UUID (RFC 4122)
  • 7 — Time-ordered UUID with millisecond precision (RFC 9562)
uniku uuid --version 7
--lowercase
boolean
default:"false"
Output in lowercase instead of uppercase. Alias: -l
uniku uuid --lowercase
# => 550e8400-e29b-41d4-a716-446655440000
--count
number
default:"1"
Number of UUIDs to generate. Alias: -n
uniku uuid --count 5
uniku uuid --count 3
550e8400-e29b-41d4-a716-446655440000
6ba7b810-9dad-11d1-80b4-00c04fd430c8
7c9e6679-7425-40de-944b-e07fc1f90ae7
UUID v7 embeds a timestamp and is sortable, making it ideal for database primary keys and distributed systems.

ULID Generation

Generate Universally Unique Lexicographically Sortable Identifiers:
# Standard ULID
uniku ulid
# => 01HW9T2W9W9YJ3JZ1H4P4M2T8Q

# Monotonically increasing ULIDs
uniku ulid --monotonic --count 3

ULID Options

--monotonic
boolean
default:"false"
Generate monotonically increasing ULIDs with the same timestamp
uniku ulid --monotonic --count 5
Guarantees that each successive ULID is lexicographically greater, even if generated within the same millisecond.
--timestamp
string
Unix timestamp in milliseconds or "now"
uniku ulid --timestamp 1704067200000
uniku ulid --timestamp now
--lowercase
boolean
default:"false"
Output in lowercase. Alias: -l
uniku ulid --lowercase
# => 01hw9t2w9w9yj3jz1h4p4m2t8q
uniku ulid --count 3
01HW9T2W9W9YJ3JZ1H4P4M2T8Q
01HW9T2W9XABCDEFGHIJKLMNOP
01HW9T2W9YZYXWVUTSRQPONMLK
Use --monotonic when generating multiple ULIDs in rapid succession to guarantee sort order.

Nanoid Generation

Generate compact, URL-safe unique identifiers:
# Default 21-character Nanoid
uniku nanoid
# => V1StGXR8_Z5jdHi6B-myT

# Custom size
uniku nanoid --size 12
# => V1StGXR8_Z5j

Nanoid Options

--size
number
default:"21"
Length of the generated ID (1-256). Alias: -s
uniku nanoid --size 32
--alphabet
string
Custom alphabet or preset name. Alias: -aPresets:
  • hex — Hexadecimal (0-9, a-f)
  • numeric — Numbers only (0-9)
  • alpha — Letters only (a-z, A-Z)
Custom alphabet:
uniku nanoid --alphabet "0123456789ABCDEF"
uniku nanoid --count 3
V1StGXR8_Z5jdHi6B-myT
K3fG9mN2pQwE7rY8sX6cH
L9jT4vR2xD8aW5nB3kM6p
Shorter IDs have higher collision probability. Use at least 21 characters for production systems.

CUID2 Generation

Generate collision-resistant, secure identifiers:
# Default 24-character CUID2
uniku cuid
# => clhw9t2w9w9yj3jz1h4p4m2t

# Custom length
uniku cuid --length 16

CUID2 Options

--length
number
default:"24"
Length of the generated ID (2-32). Alias: -l
uniku cuid --length 32
uniku cuid --count 3
clhw9t2w9w9yj3jz1h4p4m2t
clhw9t2w9xabcdefghijklmn
clhw9t2w9yzyxwvutsrqponm
CUID2 is designed to be collision-resistant even without coordination. It’s ideal for distributed systems where UUIDs feel too long.

KSUID Generation

Generate K-Sortable Unique Identifiers:
# Standard KSUID
uniku ksuid
# => 2HbcvN9VFGzP8jR5mK3QxW4d

# Custom timestamp
uniku ksuid --timestamp 1704067200

KSUID Options

--timestamp
string
Unix timestamp in seconds or "now"
uniku ksuid --timestamp 1704067200
uniku ksuid --timestamp now
uniku ksuid --count 3
2HbcvN9VFGzP8jR5mK3QxW4d
2HbcvN9VFH1Q9kS6nL4RyX5e
2HbcvN9VFH2R0lT7oM5SzY6f
KSUIDs encode timestamps with second precision (vs. millisecond for ULIDs), making them slightly more compact.

JSON Output

All generation commands support --json for structured output:
uniku uuid --count 3 --json
[
  {"id":"550e8400-e29b-41d4-a716-446655440000"},
  {"id":"6ba7b810-9dad-11d1-80b4-00c04fd430c8"},
  {"id":"7c9e6679-7425-40de-944b-e07fc1f90ae7"}
]
This is useful for scripting and programmatic consumption:
# Extract IDs using jq
uniku uuid --count 5 --json | jq -r '.[].id'

# Store in a variable
ID=$(uniku uuid --json | jq -r '.id')
echo "Generated ID: $ID"

Comparison Table

GeneratorDefault LengthTime-OrderedMonotonicURL-Safe
UUID v436 charsNoNoNo
UUID v736 charsYes (ms)YesNo
ULID26 charsYes (ms)OptionalYes
Nanoid21 charsNoNoYes
CUID224 charsNoNoYes
KSUID27 charsYes (sec)YesYes

Next Steps

Validate IDs

Validate generated IDs with auto-detection

Inspect IDs

Extract timestamps from time-ordered IDs