Skip to main content
Define cron jobs in confect/crons.ts using CronJob and CronJobs from @confect/server. Each job has a unique identifier, a schedule, and a ref to an internal mutation or action. Schedules are either an Effect Cron (cron expression) or a Duration (fixed interval). The Confect CLI re-exports the result into convex/crons.ts.
Cron schedules must not use a custom seconds fieldβ€”Convex cron expressions only support minute-level granularity. For sub-minute scheduling, use a Duration interval instead.
Non-UTC timezones are not supported by Convex. A schedule with no timezone is treated as UTC.
Duration intervals must be a positive, whole number of seconds, minutes, or hours. Sub-second durations (e.g. Duration.millis(500)) are not supported.
confect/crons.ts
CronJob.make accepts a unique identifier, a schedule (Cron or Duration), a ref to an internal mutation or action, and an optional args object matching the ref’s args schema. CronJobs.make() creates an empty collection; each .add() call returns a new CronJobs object, so calls can be chained. For the full scheduling APIs, see the Effect Cron documentation, the Effect Duration documentation, and the Convex cron jobs documentation.