Gathering detailed insights and metrics for @code_with_sachin/uusid
Gathering detailed insights and metrics for @code_with_sachin/uusid
Gathering detailed insights and metrics for @code_with_sachin/uusid
Gathering detailed insights and metrics for @code_with_sachin/uusid
Ultra Unique Secure ID generator combining UUID4 randomness with UUID1 time-based components for maximum collision resistance.
npm install @code_with_sachin/uusid
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
31 Commits
3 Branches
2 Contributors
Updated on Jul 08, 2025
Latest Version
3.0.1
Package Id
@code_with_sachin/uusid@3.0.1
Unpacked Size
65.59 kB
Size
16.49 kB
File Count
7
NPM Version
10.8.2
Node Version
20.19.3
Published on
Jul 08, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
6
A next-generation ID generator for Node.js applications with advanced features, multiple formats, encryption support, and enterprise-grade performance. Generate unique, secure, and customizable identifiers with zero dependencies.
1npm install @code_with_sachin/uusid
1const { uusid } = require('@code_with_sachin/uusid'); 2 3// Generate a standard UUSID 4const id = uusid(); 5console.log(id); // "550e8400-e29b-41d4-a716-446655440000"
1const { 2 uusid, // Generate single ID 3 uusidBatch, // Generate multiple IDs 4 validate, // Validate ID format 5 createGenerator // Create custom generator 6} = require('@code_with_sachin/uusid'); 7 8// Generate single ID 9const id = uusid(); 10 11// Generate batch of IDs 12const batch = uusidBatch(100); 13 14// Validate ID 15const isValid = validate(id); 16console.log(isValid); // { valid: true }
1const { 2 createGenerator, 3 createPrefixedGenerator, 4 createEncryptedGenerator, 5 createWorkerPool 6} = require('@code_with_sachin/uusid'); 7 8// Custom generator with options 9const generator = createGenerator({ 10 prefix: 'USER', 11 separator: '_', 12 validAfter: '2024-01-01', 13 validBefore: '2025-12-31' 14}); 15 16// Prefixed IDs 17const prefixedGen = createPrefixedGenerator('API'); 18const apiId = prefixedGen.generate(); // "API-550e8400-e29b-41d4..." 19 20// Encrypted IDs 21const encryptedGen = createEncryptedGenerator({ 22 secretKey: 'your-secret-key' 23}); 24const secureId = encryptedGen.generate(); // Encrypted UUID 25 26// Worker pool for high-volume generation 27const pool = createWorkerPool({ workers: 4 }); 28const manyIds = await pool.generateBatch(50000);
1const { 2 base32, // Base32 encoded 3 urlSafe, // URL-safe format 4 compact, // Compact 22-character format 5 hierarchical, // Hierarchical with dots 6 fromContent // Content-based deterministic 7} = require('@code_with_sachin/uusid'); 8 9console.log(base32()); // "KRSXG5CTMZRW6Z3JN5XGK4TL" 10console.log(urlSafe()); // "550e8400e29b41d4a716446655440000" 11console.log(compact()); // "550e8400e29b41d4a71644" 12console.log(hierarchical({ levels: 3 })); // "550e8400.e29b41d4.a716446655440000" 13 14// Deterministic IDs from content 15const contentId1 = fromContent('user@example.com'); 16const contentId2 = fromContent('user@example.com'); 17console.log(contentId1 === contentId2); // true - same content = same ID
1const { 2 getMetrics, 3 healthCheck, 4 analyze 5} = require('@code_with_sachin/uusid'); 6 7// Performance metrics 8const metrics = getMetrics(); 9console.log(metrics); 10/* 11{ 12 totalGenerated: 1500, 13 uptime: "2m", 14 averageRate: 750, 15 currentRate: 1200, 16 peakRate: 1500, 17 collisions: 0, 18 memoryUsage: "15MB" 19} 20*/ 21 22// Health check 23const health = await healthCheck(); 24console.log(health.healthy); // true 25 26// Batch analysis 27const ids = [uusid(), uusid(), 'invalid-id']; 28const analysis = analyze(ids); 29console.log(analysis); 30/* 31{ 32 total: 3, 33 valid: 2, 34 invalid: 1, 35 duplicates: 0, 36 timeRange: { earliest: Date, latest: Date }, 37 formats: { standard: 2, prefixed: 0, custom: 0 } 38} 39*/
1const userGen = createPrefixedGenerator('USER'); 2const userId = userGen.generate(); // "USER-550e8400-e29b-41d4..."
1const apiKeyGen = createGenerator({ 2 prefix: 'sk', 3 separator: '_' 4}); 5const apiKey = apiKeyGen.urlSafe(); // "sk_550e8400e29b41d4a716..."
1const sessionGen = createEncryptedGenerator({ 2 secretKey: process.env.SESSION_SECRET 3}); 4const sessionId = sessionGen.generate(); // Encrypted session ID
1// Content-based IDs for deterministic generation 2const recordId = fromContent(JSON.stringify(record));
1const pool = createWorkerPool({ workers: 8 }); 2const transactionIds = await pool.generateBatch(10000);
Install globally for CLI access:
1npm install -g @code_with_sachin/uusid
1# Generate IDs 2uusid generate --count 10 --format base32 3uusid gen -c 5 -f url-safe --prefix API 4 5# Validate IDs 6uusid validate 550e8400-e29b-41d4-a716-446655440000 7 8# Performance testing 9uusid benchmark --iterations 100000 10uusid health 11uusid metrics 12 13# Analysis 14uusid analyze ids.txt
Based on benchmarks on modern hardware:
Operation | Rate | Use Case |
---|---|---|
Basic Generation | 6,000+ ops/sec | Standard applications |
Worker Pool | 66,000+ ops/sec | High-volume scenarios |
Validation | 10M+ ops/sec | Real-time validation |
Content-Based | 750k+ ops/sec | Deterministic IDs |
Encrypted | 57k+ ops/sec | Secure applications |
1const secureGen = createEncryptedGenerator({ 2 secretKey: 'your-256-bit-secret-key' 3}); 4const encryptedId = secureGen.generate();
1const timeGen = createGenerator({ 2 validAfter: '2024-01-01', 3 validBefore: '2025-12-31' 4});
1// Same content always generates same ID 2const userId = fromContent('user@example.com', { 3 namespace: 'users', 4 algorithm: 'sha256' 5});
1// Before 2const { v4: uuidv4 } = require('uuid'); 3const id = uuidv4(); 4 5// After 6const { uusid } = require('@code_with_sachin/uusid'); 7const id = uusid();
1// Before 2const crypto = require('crypto'); 3const id = crypto.randomBytes(16).toString('hex'); 4 5// After 6const { compact } = require('@code_with_sachin/uusid'); 7const id = compact();
Check out the example.js
file for comprehensive usage examples:
1npm run example
Run the comprehensive test suite:
1npm test # Run all tests 2npm run benchmark # Performance benchmarks 3npm run health # Health check 4npm run metrics # Show metrics
Full TypeScript definitions included:
1import { uusid, UUSIDGenerator, createGenerator } from '@code_with_sachin/uusid'; 2 3const generator: UUSIDGenerator = createGenerator({ 4 prefix: 'USER', 5 separator: '-' 6}); 7 8const id: string = uusid();
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
ISC License - see LICENSE file for details.
Made with ❤️ by Sachin Singh
⭐ Star this project if you find it useful!
No vulnerabilities found.
No security vulnerabilities found.