Automate recurring work (syncs, reports, notifications) so it retries itself, never double-fires, and tells you when it's stuck.
Recommended stack
- Supabase Cron + Queues (pgmq) or Inngest - scheduling. Cron in the database (or durable functions) beats a forgotten VM crontab.
- TypeScript - jobs. Shared types between producer and consumer stop payload drift.
- A dead-letter table + Slack/email alert - failure path. Jobs that fail silently are jobs that don't exist.
Build steps
- Make every job a pure function of (config, window): re-running yesterday's job must be safe.
- Key side effects on an idempotency id (event id, date+entity) checked before acting.
- Verify webhook signatures; queue the payload and return 200 fast - process async.
- Record every run (started, finished, count, error) in a runs table; alert on missed schedules.
- Backoff with jitter on retries; park poison messages in the dead-letter table after N attempts.
Watch out for
- Doing work inside the webhook request handler - timeouts become data loss.
- Retries without idempotency keys (double emails, double charges).
- Alerting only on failure, not on absence-of-success.
Definition of done
- Killing a job mid-run and re-running produces correct results
- A failed webhook replays from the dead-letter table with one command
- Missed schedule pages someone within 15 minutes