Skip to content
Architecture 2026-07-01 10 min

Background Jobs

Queues, retries, idempotency and scheduling.

By Mohammad Zayed

Overview

Move slow, failure-prone work off the request path into jobs with explicit success and failure handling.

Idempotency

job
async function sendInvoice(id: string) {
  const job = await db.job.findUnique({ where: { key: id } });
  if (job?.done) return; // idempotent
  await email.send(id);
  await db.job.update({ where: { key: id }, data: { done: true } });
}

Retries

Use exponential backoff with a max attempt count; route permanent failures to a dead-letter queue for inspection.

Frequently asked questions

Is this the only way to build it?
No. These are reference patterns we reuse. Adapt the boundaries to your constraints, team and compliance needs.
Should I copy this exactly?
Use it as a starting point. Validate each decision against your traffic, data sensitivity and team size.
Can NorthFlow implement this?
Yes. Share a project brief and we'll tailor the architecture to your product.

Continue reading

Want this architecture for your product?

Share one workflow and the outcome you want. We'll review your brief and suggest an appropriate next step; scope and deliverables are agreed before work begins.

Founder-led delivery · Existing systems first · Available internationally