Redis-serial is a lightweight Node.js library (v1.0.0) for generating unique serial numbers using Redis atomic operations. It leverages Redis INCR to produce sequential, unique, and persistent serial numbers across distributed systems. Key differentiator: simple API, no external dependencies beyond Redis, and built-in retry logic. Released as a stable package, though with low maintenance activity.
npm install redis-serialNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This code creates a Redis client, initializes a Serial instance, and generates a new serial number, demonstrating basic usage.
Ensure client.connect() resolves before new Serial({ client }).Initialize the key if needed, e.g., client.set('mykey', '0').Use 'type': 'module' in package.json or use dynamic import().
Check Redis version compatibility and ensure only INCR is used.
Use import Serial from 'redis-serial' (default import).