InkApex docs
Guides

Background jobs

A Postgres queue by default, workers and brokers when you need them.

export const sendReceipt = defineJob({
  name: 'billing.send_receipt',
  schema: z.object({ orderId: z.string() }),
  run: async ({ orderId }, { db, mailer }) => { /* … */ },
});

await enqueue(tx, sendReceipt, { orderId }); // commits with the transaction

Add the job to modules/jobs/registry.ts. Jobs retry with backoff, so run must be safe to repeat. Payloads are stored in plain text: never put a token or secret in one. Recurring work goes in SCHEDULES.

Scaling

LevelSettingWhen
Inside the APIdefaultAlmost always
Dedicated workersWORKER_INLINE=false, run node dist/worker.jsHeavy jobs
A brokerQUEUE_DRIVER=rabbitmq, kafka or pubsubYou already run one, or volume outgrows polling

With a broker, Postgres stays the record: the broker carries only the job's id.

On this page