Skip to content

API Reference

Conveyor exposes a small set of classes and types that cover the full job queue lifecycle. All classes are generic, defaulting to unknown for the job payload type.

Core Classes

ClassImportDescription
Queue@conveyor/coreCreate, schedule, and manage jobs in a named queue
Worker@conveyor/coreProcess jobs from a queue with concurrency, rate limiting, and retry
Job@conveyor/coreRepresents a single unit of work with state, progress, and lifecycle methods
FlowProducer@conveyor/coreCreate parent-child job dependency trees across queues
JobObservable@conveyor/coreObserve a job's lifecycle events and optionally cancel it
EventBus@conveyor/coreTyped event emitter used by Queue and Worker for local events

Store Backends

StoreImportBackend
MemoryStore@conveyor/store-memoryIn-memory (ideal for testing)
PgStore@conveyor/store-pgPostgreSQL (production-grade, LISTEN/NOTIFY)
SqliteStore@conveyor/store-sqlite-nodeSQLite for Node.js / Deno
SqliteStore@conveyor/store-sqlite-bunSQLite for Bun
SqliteStore@conveyor/store-sqlite-denoSQLite for Deno (native)

All stores implement the StoreInterface contract. Switching backends requires changing a single line of configuration.

Types

All shared types are exported from @conveyor/shared. See the Types reference for the full list, including JobOptions, JobState, BackoffOptions, RepeatOptions, LimiterOptions, and more.

Quick Example

typescript
import { Queue, Worker } from '@conveyor/core';
import { MemoryStore } from '@conveyor/store-memory';

const store = new MemoryStore();
await store.connect();

const queue = new Queue<{ to: string }>('emails', { store });
const worker = new Worker<{ to: string }>('emails', async (job) => {
  console.log(`Sending to ${job.data.to}`);
}, { store });

await queue.add('welcome', { to: '[email protected]' });

Released under the MIT License.