Kizaki
Guides

Background Work

Use triggers, effects, and schedules for async workflows, retries, and recurring jobs.

Kizaki gives you three levels of background behavior:

  • triggers for synchronous in-transaction logic
  • effects for retryable async work
  • schedules for recurring jobs
entity Order {
  status: string,

  @on(update, status) effect sendReceipt {
    retries: 5,
    backoff: exponential(1s),
    timeout: 30s,
  }
}

schedule nightlyDigest {
  cron: "0 2 * * *",
  function: sendDigest,
  timeout: 5m,
}
  • if the work must succeed or fail with the write, use a trigger
  • if it can be retried later, use an effect
  • if it runs on a clock, use a schedule

Why The Split Exists

These tools solve different problems:

  • triggers keep derived data and invariants close to the write path
  • effects give you reliable async execution for external work
  • schedules give you time-based orchestration without building your own job runner

Trying to use one tool for all three jobs usually leads to confusion. The platform is easier to use when each mechanism has a clear role.

When you add background work, document the intent in the schema:

  • what event triggers it
  • why it must be synchronous or asynchronous
  • what failure mode is acceptable

That makes the system easier to reason about later, especially when effects, retries, and schedules start to accumulate.

On this page