~/proyectos
lightq-node
Tiny in-memory job queue for Node.js: zero runtime dependencies, full TypeScript support, concurrency control, priority scheduling, retries with exponential backoff, and cancellation by ID.
problem
Needed a lightweight queue system for Node.js projects without pulling in Redis, BullMQ, or any runtime dependency. Existing options were either too heavy or lacked fine-grained retry backoff and per-job cancellation.
architecture
ESM/CJS module with zero runtime deps. FIFO priority via internal queue, concurrent workers with a semaphore, per-job AbortController for timeouts and cancellation. Configurable exponential backoff with jitter. Distributed as a dual-format npm package.
decisions
- ›Zero runtime dependencies: the queue is just compiled TypeScript, embeddable in any project without extra lockfile bloat.
- ›Dual ESM/CJS via tsup: compatible with modern and legacy projects without friction.
- ›AbortSignal per job: cancellation and timeout without external boilerplate.
- ›Dead letter via controlled rejection: jobs that exhaust retries throw to the caller, who decides what to do.
diagrams
// job lifecycle
// internal structure
// backoff & retries