Releases: Persian-Caesar/snowflake-id
Releases · Persian-Caesar/snowflake-id
v1.4.0
Release v1.4.0
Date: May 30, 2026
Full Changelog: v1.3.0...v1.4.0
🚀 Major Improvements & New Features
- Complete Rewrite in Modern TypeScript — Fully refactored with clean architecture, better performance, and excellent type safety.
- Highly Customizable Bit Structure — Now supports configurable
timeBits,workerBits, andseqBits(total up to 64 bits). - Multiple Output Formats — Added support for Base62 (recommended for short IDs), Base36, and custom alphabet encoding.
- Short ID Support — Easily generate Discord-like (12-13 chars), Telegram-style, or even shorter IDs (8-10 chars).
- Full ID Parsing — New
.parse()method to extracttimestamp,workerId,sequence, and more from any generated ID. - Batch Generation — Added
generateBatch(count)for high-throughput scenarios. - Utility Methods — Added
timeFromId(),isValid(id), and improved error handling. - Professional JSDoc — Comprehensive documentation for all classes, interfaces, and methods.
- Better Collision Safety — Improved sequence management and time drift handling.
- Custom Epoch & Worker ID — Full support for distributed systems and consistent ID generation across instances.
🔄 Breaking Changes
- The original simple class structure has been replaced with a more powerful and flexible
Snowflakeclass. generate()now returnsstringby default (still supports BigInt internally).- Old
hexToDecutility has been removed in favor of nativeBigIntfor better performance and simplicity.
✨ New API
// New way (v1.4.0+)
const sf = new Snowflake({
timeBits: 38,
workerBits: 8,
seqBits: 10,
base62: true,
epoch: 1288834974657,
workerId: 5
});
sf.generate();
sf.generateBatch(10);
sf.parse(id);
sf.timeFromId(id);
sf.isValid(id);📈 Performance & Quality
- Significantly improved performance using native
BigInt - Better memory efficiency
- Full TypeScript support with strict mode
- Comprehensive README with multiple examples (English + Persian)
🛠 Internal Improvements
- Clean separation of encoding/decoding logic
- More robust validation and error messages
- Better private method organization
- Professional code comments and JSDoc
📚 Documentation
- Complete English README with examples
- Full Persian documentation (
README.fa.md) - Detailed configuration table and bit allocation guide
Special Thanks to everyone who contributed feedback during development.
Recommended for production use — This version is now production-ready and suitable for large-scale distributed systems.
v1.3.0
Full Changelog: https://github.com/Persian-Caesar/snowflake-id/commits/v1.3.0