Poetic API Key Generation for Modern Developers
generateKeyFleur({ mode: "celestial", theme: "sigil" })
// โ "Nebula-847-Galaxy" โจ
๐ Documentation โข ๐ฎ Try Online โข ๐ GitHub Issues
Stop generating API keys that look like someone smashed their keyboard. Create beautiful, human-readable identifiers that your team will actually remember.
๐ด Traditional Keys
|
โจ KeyFleur Keys
|
๐จ Beautiful | ๐ง Functional | ๐ Developer Experience |
---|---|---|
9 Generation Modes | Zero Dependencies | Full TypeScript Support |
13 Themed Collections | URL-Safe Output | Comprehensive JSDoc |
Human-Readable Keys | Pattern Validation | Modern ESM/CJS Support |
Choose from 9 different key generation patterns, each with its own aesthetic and use case.
From celestial
space themes to steampunk
mechanical vibes - 13 curated word collections.
Zero dependencies, fully typed, tested, and ready for production use.
๐ฆ Installation
# npm
npm install @usex/key-fleur
# yarn
yarn add @usex/key-fleur
# pnpm
pnpm add @usex/key-fleur
# bun
bun add @usex/key-fleur
import { generateKeyFleur } from '@usex/key-fleur';
// One-liner for a beautiful key
const key = generateKeyFleur();
console.log(key); // "Nyrae-Soliv-Ethae"
// Customize your keys
const apiKey = generateKeyFleur({
mode: 'sigil', // Key pattern
theme: 'celestial' // Word theme
});
// โ "Nebula-742-Comet"
// Generate multiple keys
const sessionKeys = generateKeyFleur({
count: 5,
theme: 'oceanic'
});
// โ ["Wave-Coral-Deep", "Tide-Gull-Salt", ...]
import { isValidKeyFleur } from '@usex/key-fleur';
const result = isValidKeyFleur("Crystal-459-Gem");
// โ { valid: true, mode: "sigil", parts: ["Crystal", "459", "Gem"] }
๐ธ haiku - Traditional 5-7-5 syllable poetry
generateKeyFleur({ mode: 'haiku', theme: 'nocturnal' })
// โ "Luna-Eclipse-Void"
Perfect for: API keys, memorable identifiers
๐ธ sigil - Word-number-word format
generateKeyFleur({ mode: 'sigil', theme: 'crystalline' })
// โ "Crystal-459-Gem"
Perfect for: Session tokens, transaction IDs
๐ฑ seed - Compact word + hex
generateKeyFleur({ mode: 'seed', theme: 'forest' })
// โ "Moss-4f2a"
Perfect for: Short codes, references
๐ช lace - Palindromic patterns
generateKeyFleur({ mode: 'lace', theme: 'oceanic' })
// โ "wavefa-afevaw"
Perfect for: Artistic applications, unique IDs
๐ญ All 9 Modes
Mode | Example | Best For |
---|---|---|
haiku |
Luna-Eclipse-Void |
API keys, memorable IDs |
sigil |
Crystal-459-Gem |
Session tokens, transaction IDs |
seed |
Moss-4f2a |
Short codes, references |
lace |
wavefa-afevaw |
Artistic apps, unique IDs |
sonnet |
Rosefa-Lilyli |
User handles, project names |
rune |
Oracle-Blade_dawn |
Timestamped keys |
mantra |
Sand-Sand-Dune |
Meditation apps, repeated actions |
mirrora |
af-fa |
Minimal IDs, simple tokens |
quartz |
Gear45.45raeG |
Complex keys, high entropy |
13 carefully curated word collections to match your application's aesthetic
๐ celestial
๐ oceanic
๐ฒ forest
๐ฎ crystalline
|
๐ฆ nocturnal
โ๏ธ sunny
๐ธ floreal
โ๏ธ steampunk
|
๐ mythic
๐๏ธ desert
๐ library
๐ณ๏ธ decay
|
// Mix and match themes with any mode
generateKeyFleur({ theme: 'celestial', mode: 'haiku' })
// โ "Nova-Galaxy-Nebula"
generateKeyFleur({ theme: 'steampunk', mode: 'sigil' })
// โ "Gear-847-Steam"
Primary interface for generating KeyFleur keys.
generateKeyFleur(options?: {
mode?: ModeKey; // Generation mode (default: "haiku")
theme?: ThemeKey; // Theme collection (default: "haiku")
count?: number; // Number of keys (default: 1, max: 100)
}): string | string[]
Examples:
generateKeyFleur(); // Single haiku key
generateKeyFleur({ mode: 'sigil' }); // Single sigil key
generateKeyFleur({ theme: 'oceanic' }); // Ocean-themed haiku
generateKeyFleur({ count: 10 }); // Array of 10 keys
generateKeyFleur({
mode: 'quartz',
theme: 'crystalline',
count: 3
}); // 3 crystal quartz keys
Validates KeyFleur key patterns.
isValidKeyFleur(
key: string,
mode?: ModeKey
): {
valid: boolean;
mode?: ModeKey;
reason?: string;
parts?: string[];
}
Examples:
isValidKeyFleur("Luna-Eclipse-Void");
// { valid: true, mode: "haiku", parts: ["Luna", "Eclipse", "Void"] }
isValidKeyFleur("Crystal-459-Gem", "sigil");
// { valid: true, mode: "sigil", parts: ["Crystal", "459", "Gem"] }
isValidKeyFleur("invalid-key");
// { valid: false, reason: "Key does not match any known KeyFleur pattern" }
import { poeticKey } from '@usex/key-fleur';
// Original simple interface (still supported)
poeticKey(mode?: ModeKey, theme?: ThemeKey): string
- API keys that humans can actually read and remember
- Session tokens with aesthetic appeal
- Temporary access codes and passphrases
- OAuth state parameters
- CSRF tokens
- Game save IDs and world seeds
- Character names and guild identifiers
- Creative project codenames
- Art piece references
- Document and content identifiers
- Database record references
- Test data generation
- Demo and placeholder content
- Customer reference numbers
Traditional Random Keys:
kJ8#mP2qR9$vX7nL4wB6
aNm9Kp2QrX5vB8wL4jR7
KeyFleur Keys:
Luna-Eclipse-Nocturnal
Crystal-459-Amethyst
โ
Human-readable - Easy to communicate verbally
โ
Memorable - Natural language patterns stick in memory
โ
Beautiful - Aesthetically pleasing in UIs and logs
โ
Unique - Collision-resistant across themes and modes
โ
Functional - URL-safe, database-friendly, proper entropy
import { generateKeyFleur, type ThemeKey, type ModeKey } from '@usex/key-fleur';
// Generate API keys for different environments
const keys = {
development: generateKeyFleur({ theme: 'forest', count: 3 }),
staging: generateKeyFleur({ theme: 'crystalline', count: 3 }),
production: generateKeyFleur({ theme: 'celestial', count: 3 })
};
// Generate user session tokens
const sessionTokens = generateKeyFleur({
mode: 'seed',
theme: 'nocturnal',
count: 50
}) as string[];
import { isValidKeyFleur } from '@usex/key-fleur';
function validateApiKey(key: string, expectedFormat: 'sigil' | 'seed') {
const result = isValidKeyFleur(key, expectedFormat);
if (!result.valid) {
throw new Error(`Invalid API key format: ${result.reason}`);
}
return result;
}
// Use in your application
try {
const validation = validateApiKey("Crystal-459-Gem", "sigil");
console.log(`Valid ${validation.mode} key with parts:`, validation.parts);
} catch (error) {
console.error(error.message);
}
import { THEMES, MODES, type ThemeKey } from '@usex/key-fleur';
// Add custom themes
const customThemes = {
...THEMES,
cyberpunk: ['neon', 'grid', 'cyber', 'matrix', 'pulse', 'neural']
} as const;
// Create custom generator
function customKeyFleur(theme: keyof typeof customThemes = 'haiku') {
const words = customThemes[theme];
const selected = words[Math.floor(Math.random() * words.length)];
return `${selected}-${Date.now().toString(36)}`;
}
KeyFleur is built with a modular architecture:
key-types.ts
- TypeScript type definitionstheme-data.ts
- Curated word collections (13 themes ร ~30 words each)string-utils.ts
- Core utilities (syllable counting, random selection)generation-modes.ts
- 9 different key generation algorithmsindex.ts
- Main API with validation and error handling
- Syllable Estimation - Vowel-counting heuristics for haiku mode
- Pattern Generation - Deterministic transformations (reversals, mirroring)
- Random Selection - Cryptographically adequate randomness via
Math.random()
- Validation - Regex-based pattern matching for all modes
โ ๏ธ Not cryptographically secure - UsesMath.random()
for generation- โ Adequate entropy - Large combination space across themes/modes
- โ URL-safe - No special characters that break URLs or JSON
- โ Collision-resistant - Very low probability of duplicates in practice
For cryptographic security, combine with additional entropy sources or use KeyFleur for non-security-critical identifiers.
We welcome contributions! Here's how to get started:
git clone https://github.com/ali-master/key-fleur.git
cd key-fleur
npm install
npm run build
npm test
- Add your theme to
src/theme-data.ts
- Update the
ThemeKey
type insrc/key-types.ts
- Add tests and documentation
- Create your mode function in
src/generation-modes.ts
- Add it to the
MODES
export - Update the
ModeKey
type insrc/key-types.ts
- Add validation pattern to
isValidKeyFleur
MIT ยฉ Ali Torki
Built with โค๏ธ by Ali Torki, developers who believe code can be beautiful