Aesthetic ID Generator - UUID-strength IDs with lowercase letters and numbers, perfect for variable names and localStorage keys
npm install aestusAesthetic ID Generator - Generate beautiful, UUID-strength unique identifiers that actually look good.
``javascript
import Aestus from 'aestus';
Aestus.pro() // "mxy49w2n3p8q1r5t" - professional & clean
Aestus.easy() // "bakeru42" - pronounceable & memorable
Aestus.long() // "k7x4m9w2n3p8q1r5t6y8z9c2" - maximum strength
`
All IDs use only lowercase letters and numbers, always start with a letter, and work perfectly as JavaScript variable names or localStorage keys.
crypto.randomUUID() has limitations:
- ❌ Requires HTTPS or localhost (fails in many Electron apps)
- ❌ Not available in older browsers
- ❌ Generates IDs with uppercase and hyphens (550e8400-e29b-41d4-a716-446655440000)
- ❌ Cannot be used as variable names (starts with numbers)
Aestus solves these problems:
- ✅ Works everywhere (uses crypto.getRandomValues)
- ✅ Clean, lowercase-only format
- ✅ Always starts with a letter (valid variable names)
- ✅ Aesthetically pleasing and configurable
- ✅ Cryptographically secure randomness
`bash`
npm install aestus
`javascript
import Aestus from 'aestus';
// Professional segmented IDs (with or without separators)
const id1 = Aestus.pro(); // "mxy49w2n3p8q1r5t"
const id2 = Aestus.pro(4, true); // "mxy4-9w2n-3p8q-1r5t"
// Easy-to-read pronounceable IDs
const id3 = Aestus.easy(); // "bakeru42"
const id4 = Aestus.easy(4, true); // "ba-ke-ru-mo-73"
// Long high-entropy IDs
const id5 = Aestus.long(); // "k7x4m9w2n3p8q1r5t6y8z9c2"
const id6 = Aestus.long(32); // "k7x4m9w2n3p8q1r5t6y8z9c2d4f7g8"
`
When generating unique IDs, entropy is the measure of randomness that determines how unlikely a collision (duplicate ID) is. Higher entropy means more possible combinations and lower collision probability.
Entropy is calculated as: log₂(possible_combinations)
For Aestus IDs using 36 characters (a-z, 0-9):
- Each character adds ~5.17 bits of entropy (log₂(36) ≈ 5.17)
- A 10-character ID has ~51.7 bits of entropy (36^10 combinations)
- A 22-character ID has ~113.7 bits of entropy (36^22 combinations)
| Entropy | Possible IDs | Use Case |
|---------|--------------|----------|
| ~30 bits | 1 billion | Single app instance, temporary session IDs |
| ~40 bits | 1 trillion | localStorage keys, client-side caching |
| ~50 bits | 1 quadrillion | Small to medium databases (thousands of records) |
| ~60 bits | 1 quintillion | Large databases (millions of records) |
| ~80+ bits | Astronomical | Global uniqueness, distributed systems |
| ~114 bits | UUID-level | Never worry about collisions |
The birthday paradox means collisions become likely much sooner than you'd expect. Here's when you hit 50% collision probability:
| Entropy | 50% Collision After |
|---------|---------------------|
| 30 bits | ~37,000 IDs |
| 40 bits | ~1.2 million IDs |
| 50 bits | ~37 million IDs |
| 60 bits | ~1.2 billion IDs |
| 80 bits | ~1.2 × 10^12 IDs |
| 114 bits | ~5 × 10^17 IDs |
Need: IDs that are unique within one browser session or app instance.
`javascript
// ~40 bits entropy - perfect for session IDs
Aestus.easy(3) // "bakeru42" (8 chars)
Aestus.pro(2) // "mxy49w2n" (8 chars)
// Generate 1 million IDs with virtually zero collision risk
`
Need: IDs for client-side storage that won't conflict across multiple sessions.
`javascript
// ~52-84 bits entropy - excellent for localStorage
Aestus.pro(3) // "mxy49w2n3p8q" (12 chars, ~62 bits)
Aestus.pro(4) // "mxy49w2n3p8q1r5t" (16 chars, ~83 bits)
// Can safely store millions of items without collisions
localStorage.setItem(Aestus.pro(3), data);
`
Need: Primary keys for database tables with thousands to millions of records.
`javascript
// ~83-114 bits entropy - database-safe
Aestus.pro(4) // "mxy49w2n3p8q1r5t" (16 chars, ~83 bits)
Aestus.long(22) // "k7x4m9w2n3p8q1r5t6y8z9c2" (22 chars, ~114 bits)
// Safe for databases with billions of records
const userId = Aestus.pro(4);
await db.users.insert({ id: userId, name: 'Alice' });
`
Need: IDs that will never collide across multiple servers, databases, or systems.
`javascript
// ~114+ bits entropy - UUID-strength
Aestus.long(22) // 22 chars, ~114 bits (default)
Aestus.long(32) // 32 chars, ~165 bits (overkill but guaranteed)
// Safe for distributed systems generating billions of IDs per second
const globalId = Aestus.long();
`
Need: Valid JavaScript identifiers that look clean in code.
`javascript
// All Aestus IDs start with letters - perfect for variable names
const config = {};
config[Aestus.pro(3)] = { theme: 'dark' };
// Dynamic object keys
const cache = {};
const key = Aestus.easy(2); // "buke15"
cache[key] = expensiveComputation();
// Even works in template strings
const className = item-${Aestus.easy(2)}; // "item-buke15"`
Generates professional segmented IDs with balanced entropy and readability.
Parameters:
- segmentCount (number): Number of 4-character segments (default: 4)sep
- (boolean): Include hyphens as separators (default: false)
Entropy: ~5.17 bits per character, ~20.7 bits per segment
Examples:
`javascript`
Aestus.pro() // "mxy49w2n3p8q1r5t" (~83 bits, 16 chars)
Aestus.pro(2) // "mxy49w2n" (~41 bits, 8 chars)
Aestus.pro(3) // "mxy49w2n3p8q" (~62 bits, 12 chars)
Aestus.pro(5) // "mxy49w2n3p8q1r5t6y8z" (~104 bits, 20 chars)
Aestus.pro(4, true) // "mxy4-9w2n-3p8q-1r5t" (with separators)
Best for: Database keys, user IDs, order numbers
Generates pronounceable IDs using consonant-vowel patterns, ending with two digits.
Parameters:
- consonantVowelPairCount (number): Number of consonant-vowel pairs (default: 3)sep
- (boolean): Include hyphens as separators (default: false)
Entropy: ~4.2 bits per CV pair + ~6.6 bits for digits
Examples:
`javascript`
Aestus.easy() // "bakeru42" (~19 bits, 8 chars)
Aestus.easy(2) // "buke15" (~15 bits, 6 chars)
Aestus.easy(4) // "bakerumu73" (~24 bits, 10 chars)
Aestus.easy(5) // "bakerumopi86" (~27 bits, 12 chars)
Aestus.easy(3, true) // "ba-ke-ru-42" (with separators)
Best for: Session IDs, temporary tokens, human-readable codes
Generates maximum-strength IDs without formatting.
Parameters:
- chars (number): Total character count (default: 22)
Entropy: ~5.17 bits per character
Examples:
`javascript`
Aestus.long() // "k7x4m9w2n3p8q1r5t6y8z9c2" (~114 bits, 22 chars)
Aestus.long(16) // "k7x4m9w2n3p8q1r5" (~83 bits)
Aestus.long(32) // "k7x4m9w2n3p8q1r5t6y8z9c2d4f7g8j9k2" (~165 bits)
Aestus.long(10) // "k7x4m9w2n3" (~52 bits)
Best for: Cryptographic tokens, distributed system IDs, high-security applications
| Feature | Aestus | crypto.randomUUID() | nanoid |
|---------|--------|---------------------|--------|
| Works without HTTPS | ✅ | ❌ | ✅ |
| Lowercase only | ✅ | ❌ | ❌ |
| Starts with letter | ✅ | ❌ | ❌ |
| Aesthetically pleasing | ✅ | ❌ | ❌ |
| No special characters | ✅ | ❌ | ❌ |
| Valid variable name | ✅ | ❌ | ❌ |
| Configurable length | ✅ | ❌ | ✅ |
| Pronounceable option | ✅ | ❌ | ❌ |
| Browser compatibility | Excellent | Good | Excellent |
Aestus uses crypto.getRandomValues() which is supported in:
- Chrome 11+
- Firefox 21+
- Safari 6.1+
- Edge (all versions)
- Node.js 14+
- Electron (all versions)
- React Native (with crypto polyfill)
Unlike crypto.randomUUID(), it works in all contexts including HTTP, file://, and Electron apps.
Aestus uses cryptographically secure random number generation via crypto.getRandomValues(). This means IDs are unpredictable and suitable for security-sensitive applications like:
- Session tokens
- API keys
- Password reset tokens
- Authentication codes
The quality of randomness is equivalent to crypto.randomUUID() and other cryptographic primitives.
Generating IDs is extremely fast:
- Aestus.pro(): ~0.01ms per IDAestus.easy()
- : ~0.008ms per IDAestus.long()`: ~0.012ms per ID
-
You can generate hundreds of thousands of IDs per second without performance concerns.
MIT © @catpea
Issues and pull requests welcome at github.com/catpea/aestus