typescript task definition with type-safe scheduling
Enables developers to define long-running background tasks as TypeScript functions with built-in type safety, automatic serialization, and declarative scheduling (cron, delays, intervals). Uses a decorator-based or function-wrapper pattern that captures task metadata at definition time and integrates with the SDK's task registry, allowing IDE autocomplete and compile-time validation of task parameters and return types.
Unique: Combines TypeScript's type system with task definition via a decorator/wrapper pattern that captures metadata at definition time, enabling compile-time validation of task parameters and return types — unlike Bull or RabbitMQ which require runtime schema validation or manual type guards.
vs alternatives: Provides full end-to-end type safety from task definition through invocation, whereas Celery (Python) and Bull (Node.js) require separate schema definitions or runtime validation.
distributed task execution with automatic retry and exponential backoff
Executes tasks across distributed workers with built-in retry logic, exponential backoff, and configurable failure policies. The Run Engine (internal-packages/run-engine) implements a state machine that tracks task execution attempts, persists retry state to the database, and coordinates dequeue/execution flow across multiple worker instances using distributed locking and queue management systems to prevent duplicate execution.
Unique: Implements a state machine-based retry system (via Run Engine's runAttemptSystem and dequeueSystem) that persists retry state to the database and uses distributed locking to prevent duplicate execution across workers, rather than in-memory retry queues like Bull which lose state on process restart.
vs alternatives: Provides database-backed retry durability and distributed coordination, making it more reliable than Bull for multi-worker setups, while offering simpler configuration than Temporal or Cadence.
ttl-based automatic run expiration and cleanup
Automatically expires and cleans up old task execution records based on configurable TTL (time-to-live) policies. Implemented via the ttlSystem in the Run Engine, which periodically scans for expired runs and deletes their associated records (logs, snapshots, attempts) from the database. Prevents unbounded database growth while maintaining configurable retention periods for compliance or debugging.
Unique: Implements automatic TTL-based cleanup via the ttlSystem with configurable retention policies per environment, preventing unbounded database growth — unlike traditional job queues that require manual log rotation or external cleanup jobs.
vs alternatives: Provides built-in automatic cleanup comparable to managed services like AWS SQS, without requiring external log management tools.
sdk-based task invocation with type-safe parameters
Provides a type-safe SDK for invoking tasks from application code, with automatic parameter serialization and validation. The SDK generates type definitions from task definitions, enabling IDE autocomplete and compile-time type checking when invoking tasks. Supports both immediate invocation and scheduled invocation with delay/cron parameters.
Unique: Generates type-safe SDK methods from task definitions, enabling compile-time validation of task invocation parameters and IDE autocomplete — unlike REST API approaches that require manual type guards or schema validation.
vs alternatives: Provides better developer experience than REST APIs with full type safety, comparable to Temporal's TypeScript SDK but simpler to set up.
lifecycle hooks for task initialization and cleanup
Supports lifecycle hooks (onStart, onSuccess, onFailure, onCompletion) that execute at specific points in a task's execution lifecycle. Hooks are defined at task definition time and executed by the Run Engine with access to task context and execution results. Enables common patterns like resource cleanup, notification sending, and metrics recording without cluttering task code.
Unique: Implements task lifecycle hooks (onStart, onSuccess, onFailure, onCompletion) that execute at specific points in the Run Engine's state machine, enabling cross-cutting concerns without task code modification — unlike traditional job queues that require manual event handling.
vs alternatives: Provides simpler lifecycle management than Temporal's activity lifecycle, with hooks executed directly by the engine rather than requiring separate activity implementations.
build extensions for custom task bundling and compilation
Supports build extensions that customize how tasks are bundled and compiled before deployment. Extensions can modify the build process (e.g., add custom webpack loaders, tree-shake dependencies, inline assets) and are executed during the build phase before workers are deployed. Enables optimization for specific use cases (e.g., minimizing bundle size for Lambda, including native modules for GPU tasks).
Unique: Implements a pluggable build extension system that customizes task bundling and compilation, allowing environment-specific optimizations (e.g., GPU support, bundle size reduction) without modifying core task code — unlike traditional job queues that use fixed bundling strategies.
vs alternatives: Provides more flexibility than Temporal's build system, allowing arbitrary build customization for specialized deployment scenarios.
clickhouse-based analytics and query performance monitoring
Trigger.dev uses ClickHouse as an analytics database to store and query task execution metrics, enabling high-performance analytics on large volumes of task data. The system exports task execution events (duration, status, retry count, etc.) to ClickHouse, allowing users to query execution patterns, identify performance bottlenecks, and generate reports. ClickHouse's columnar storage and compression enable efficient queries over billions of task runs.
Unique: Exports task execution events to ClickHouse for high-performance analytics, enabling efficient queries over billions of task runs without impacting operational database performance. ClickHouse's columnar storage and compression enable sub-second queries on large datasets.
vs alternatives: More scalable than querying PostgreSQL directly because ClickHouse is optimized for analytical queries, and more flexible than pre-aggregated metrics because raw events are stored and can be queried ad-hoc
checkpoint and resume execution for long-running tasks
Allows tasks to pause execution at checkpoints, persist their state to the database, and resume from that exact point without re-executing prior steps. Implemented via the checkpointSystem in the Run Engine, which serializes task execution context (variables, call stack state) into execution snapshots stored in the database, enabling tasks to survive worker crashes or be paused indefinitely and resumed later.
Unique: Implements a checkpoint/resume system via execution snapshots that serialize the entire task execution context (not just input/output) to the database, enabling true mid-execution pause and resume — unlike traditional job queues that only support task-level retries.
vs alternatives: Provides finer-grained execution control than Temporal (which checkpoints at activity boundaries) by allowing checkpoints at arbitrary code points, while being simpler to implement than Durable Functions.
+7 more capabilities