| Crates.io | idgen-cli |
| lib.rs | idgen-cli |
| version | 1.4.1 |
| created_at | 2025-11-27 12:23:48.497724+00 |
| updated_at | 2025-11-27 12:44:37.3473+00 |
| description | A lightweight, powerful CLI tool for generating UUIDs (v1-v5), NanoIDs, CUIDs, ULIDs, and MongoDB ObjectIDs. |
| homepage | |
| repository | https://github.com/maniartech/idgen |
| max_upload_size | |
| id | 1953644 |
| size | 174,788 |
A lightweight command-line utility for generating and inspecting various types of unique identifiers:
This tool is designed for developers who need to generate or analyze various types of IDs during development, testing, debugging, or data migration.
cargo install idgen-cli
Download the latest release for your platform from GitHub Releases:
| Platform | Download |
|---|---|
| Linux (x64) | idgen-linux-amd64 |
| macOS (x64) | idgen-macos-amd64 |
| Windows (x64) | idgen-windows-amd64.exe |
# Linux/macOS: Make executable and move to PATH
chmod +x idgen-linux-amd64
sudo mv idgen-linux-amd64 /usr/local/bin/idgen
# Windows: Move to a directory in your PATH
git clone https://github.com/maniartech/idgen.git
cd idgen
cargo build --release
# Linux/macOS
cp target/release/idgen /usr/local/bin/
# Windows (PowerShell, adjust path as needed)
Copy-Item target/release/idgen.exe -Destination "$env:USERPROFILE/AppData/Local/Microsoft/WindowsApps/"
Generate a random UUID (v4):
idgen
Generate with banner:
idgen -b
Generate multiple IDs:
idgen -c 3
Quickly generate IDs for manual SQL INSERT statements or when creating seed data files (CSV/JSON) for development databases.
# Generate 5 UUIDs for a seed file
idgen -c 5
Generate unique IDs on the fly when testing APIs with curl or Postman, especially for endpoints that require a unique request_id or transaction_id.
# Use in a curl request
curl -X POST https://api.example.com/users \
-H "X-Request-ID: $(idgen -f simple)" \
-d '{"name": "John"}'
Use in CI/CD pipelines or shell scripts to generate unique filenames, deployment tags, or temporary resource identifiers.
# Create a unique temporary file
touch $(idgen -t nanoid -l 10 -p temp_ -s .log)
Generate unique strings for configuration files, such as JWT_SECRET, API_KEY, or session secrets during project setup.
# Generate a strong, random secret
idgen -t nanoid -l 64
Verify the output of deterministic IDs (like UUID v5) to ensure your application logic matches the standard.
# Verify UUID v5 generation
idgen -t uuid5 --namespace URL --name "https://example.com"
Generate a unique trace ID to manually tag a request flow across microservices when debugging.
# Generate a trace ID (UUID v4)
idgen -f simple
Generate IDs for JSON mock files used in frontend development.
# Generate 10 NanoIDs for a mock user list
idgen -t nanoid -c 10
# Generate mock email addresses
idgen -t nanoid -l 8 -s @example.com -c 5
Generate unique tags for cloud resources (AWS/Azure/GCP) during manual provisioning or Terraform/Ansible runs.
# Generate a unique suffix for an S3 bucket
idgen -t nanoid -l 8 -p my-bucket- | tr '[:upper:]' '[:lower:]'
Analyze unknown IDs found in logs or databases to determine their type, version, and creation timestamp (if available).
# Inspect an ID to see what it is
idgen inspect 01ARZ3NDEKTSV4RRFFQ69G5FAV
# Check if an ID is valid with JSON output
idgen inspect 550e8400-e29b-44d4-a716-446655440000 --json
Standard 128-bit identifiers with multiple versions for different needs:
550e8400-e29b-11d4-a716-446655440000550e8400-e29b-44d4-a716-446655440000cfbff0d1-9375-5685-968c-48ce8b15ae1712-byte identifier combining timestamp, machine ID, and counter:
507f1f77bcf86cd799439011Compact, URL-safe identifiers:
V1StGXR8_Z5jdHi6B-myTDesigned for horizontal scaling and performance:
Sortable, random, 128-bit identifier:
01ARZ3NDEKTSV4RRFFQ69G5FAVGenerate and inspect unique identifiers
Usage: idgen.exe [OPTIONS] [COMMAND]
Commands:
inspect Inspect an ID to determine its type and extract metadata
completions Generate shell completions
help Print this message or the help of the given subcommand(s)
Options:
-t, --type <ID_TYPE> Type of ID to generate [default: uuid4] [possible values: uuid1, uuid3, uuid4, uuid5, nanoid, cuid1, cuid2, ulid, objectid]
-f, --format <FORMAT> Output format for UUIDs [default: hyphenated] [possible values: hyphenated, simple, urn]
-c, --count <COUNT> Number of IDs to generate [default: 1]
-l, --length <LENGTH> Length for NanoID (default: 21)
-p, --prefix <PREFIX> Prefix to add to generated IDs [default: ]
-s, --suffix <SUFFIX> Suffix to add to generated IDs [default: ]
--namespace <NAMESPACE> Namespace UUID for v3/v5 (use DNS, URL, OID, X500, or a custom UUID)
--name <NAME> Name string for UUID v3/v5
--json Output as JSON
-b, --banner Show banner
-h, --help Print help (see more with '--help')
-V, --version Print version
EXAMPLES:
idgen Generate a random UUID v4 (default)
idgen -t uuid1 Generate a time-based UUID v1
idgen -t uuid3 --namespace DNS --name example.com
idgen -t nanoid -l 10 Generate a NanoID of length 10
idgen -t ulid Generate a ULID
idgen -c 5 Generate 5 UUIDs
idgen -p 'test-' -s '.log' Add prefix and suffix
idgen --json Output as JSON
idgen inspect 550e8400-e29b-44d4-a716-446655440000
idgen completions bash Generate bash completions
Each ID can be formatted in different ways:
550e8400e29b44d4a716446655440000)550e8400-e29b-44d4-a716-446655440000)urn:uuid:550e8400-e29b-44d4-a716-446655440000)# Generate IDs (default: UUID v4)
idgen # Random UUID v4
idgen -t uuid1 # Time-based UUID v1
idgen -t uuid5 --namespace DNS --name example.com # Name-based UUID v5
# ID Types
idgen -t nanoid # NanoID (21 chars)
idgen -t nanoid -l 10 # NanoID with custom length
idgen -t cuid1 # CUID v1
idgen -t cuid2 # CUID v2
idgen -t ulid # ULID
idgen -t objectid # MongoDB ObjectID
# UUID Formats
idgen -f simple # No hyphens: 550e8400e29b44d4a716446655440000
idgen -f urn # URN format: urn:uuid:550e8400-e29b-...
# Multiple IDs
idgen -c 5 # Generate 5 UUIDs
idgen -t ulid -c 3 # Generate 3 ULIDs
# Prefix and Suffix
idgen -p 'test-' # Add prefix
idgen -s '.log' # Add suffix
idgen -p 'user_' -s '_v1' -c 3 # Both prefix and suffix
# JSON Output
idgen --json # Single ID as JSON
idgen --json -c 3 # Multiple IDs as JSON array
# Inspect IDs
idgen inspect 550e8400-e29b-44d4-a716-446655440000
idgen inspect 01ARZ3NDEKTSV4RRFFQ69G5FAV
# Shell Completions
idgen completions bash > ~/.bash_completion.d/idgen
idgen completions zsh > ~/.zsh/completions/_idgen
idgen completions fish > ~/.config/fish/completions/idgen.fish
idgen completions powershell >> $PROFILE
# Man Page
idgen manpage > /usr/local/share/man/man1/idgen.1
For UUID v3/v5, use these standard namespaces:
6ba7b810-9dad-11d1-80b4-00c04fd430c86ba7b811-9dad-11d1-80b4-00c04fd430c86ba7b812-9dad-11d1-80b4-00c04fd430c86ba7b814-9dad-11d1-80b4-00c04fd430c8| Feature | idgen | uuidgen | uuid (npm) | nanoid (npm) |
|---|---|---|---|---|
| UUID v1-v5 | ✅ | ✅ | ✅ | ❌ |
| NanoID | ✅ | ❌ | ❌ | ✅ |
| CUID v1/v2 | ✅ | ❌ | ❌ | ❌ |
| ULID | ✅ | ❌ | ❌ | ❌ |
| ObjectID | ✅ | ❌ | ❌ | ❌ |
| ID Inspection | ✅ | ❌ | ❌ | ❌ |
| Shell Completions | ✅ | ❌ | ❌ | ❌ |
| Zero Runtime Deps | ✅ | ✅ | ❌ | ❌ |
| Single Binary | ✅ | ✅ | ❌ | ❌ |
Key advantages:
We welcome contributions! Please feel free to submit a Pull Request. For major changes, open an issue first.
MIT License - Copyright © 2021-2025 ManiarTech®