$ show sidequestjs/sidequest
Sidequest.js is a Redis-free background job processing system for Node.js/TypeScript that provides distributed, durable job processing using existing databases (PostgreSQL, MySQL, SQLite, MongoDB). The system features a modular monorepo architecture with separate packages for core logic, engine, database backends, web dashboard, and CLI tools. It implements job lifecycle management, scheduling via cron expressions, uniqueness constraints, retry mechanisms with backoff strategies, and provides a web interface for monitoring and management. The architecture follows clean separation of concerns with dependency injection, worker thread isolation via Piscina, and process isolation through forked child processes. Key entry points include the main Sidequest facade, engine configuration, dashboard interface, and CLI administration tools.
The LLM identified 5 files worth highlighting for reuse:
Abstract SQLBackend base class implementing template method pattern for database operations. Provides common functionality for SQL backends while allowing driver-specific implementations. Demonstrates strong separation of concerns and could be extracted for any SQL-based data access layer.
Job transition system with individual transition classes (RunTransition, RetryTransition, etc.) that encapsulate specific state change logic. Each transition handles validation, execution, and cleanup for job state changes. Demonstrates clean state machine implementation that could be reused in other workflow systems.
Uniqueness strategies implementation using strategy pattern with FixedWindowUniqueness and AliveJobUniqueness classes. Provides clean interface for job deduplication with factory for instantiation. Shows excellent encapsulation of deduplication logic that could be extracted for any deduplication needs.
Job builder pattern providing fluent interface for job configuration with methods like .queue(), .timeout(), .retry(), etc. Separates job construction from representation and allows complex job configuration in readable chain. Demonstrates excellent builder pattern implementation reusable for any complex object creation.
Worker runtime abstraction with SharedRunner interface and implementations (InlineRunner, RunnerPool). Provides clean abstraction for different execution strategies (inline vs pooled workers). Shows strong encapsulation of execution concerns that could be extracted for worker pool needs.