Durable background jobs on the database you already have
Queues, retries, crons and durable step functions for TypeScript. Jobs live in their own schema of the database you already run — next to your data, not on someone else's servers.
A demo job, drawn by the same component as the console: attempt 1 times out, attempt 2 is rate-limited and replays its first step from memory instead of re-running it, attempt 3 replays it again and finishes. Select a bar to open its step below.
You write one file. Sturdle does the rest.
The job on the left is the job on the right: the same billing/invoice.sync the trace above shows, defined with the API that ships today. Follow it from the first line to the finished run.
import { Engine, JobRegistry } from "@sturdle/engine";
import { PostgresAdapter } from "@sturdle/postgres";
JobRegistry.register({
name: "Sync invoice to ledger",
event: "billing/invoice.sync",
queue: "billing",
concurrency: { limit: 1, key: "customerId" },
func: async ({ event, step }) => {
const invoice = await step.run("Fetch invoice", () =>
fetchInvoice(event.data),
);
const charge = await step.run("Charge card", () =>
chargeCard(invoice),
);
await step.run("Record ledger entry", () =>
recordLedger(invoice, charge),
);
await step.sendEvent("Send receipt email", {
name: "email/send",
data: {
customerId: invoice.customerId,
chargeId: charge.id,
},
});
},
});const engine = new Engine({
databaseAdapter: new PostgresAdapter({
connectionString: process.env.DATABASE_URL,
}),
});await engine.start();await engine.addJob(
"billing/invoice.sync",
{ invoiceId: "inv_4471", customerId: "cus_2201" },
{ maxAttempts: 5 },
);// Attempt 1 times out on the card charge, attempt 2 is
// rate-limited, attempt 3 replays "Fetch invoice" from memory,
// charges, records the ledger entry and sends the receipt.01
Register the job
A name, the event that triggers it, a queue, and a concurrency limit per customer. Each step.run is memoized: once a step has completed it never runs again for that job, on any attempt. The task appears in the fleet with its last 24 hours; the runs and rates shown here are demo data.
02
Point it at your database
The adapter talks to Postgres through the pg driver, with a pool it owns or one you already have. No broker, no queue server, no ORM, nothing new to provision.
- Owns a pg.Pool, or reuses yours
- Runs in the process you already deploy
- No ORM, no vendor SDK
03
Start it
On the first connect Sturdle creates a dedicated schema and applies its versioned migrations under an advisory lock, so several instances can boot at once. The DDL is exportable for teams whose DBAs review every change.
Schema sturdle, six tables
- jobs
- job_streams
- delayed_jobs
- job_metadata
- distributed_locks
- schema_migrations
Applied by migrate() under pg_advisory_lock
04
Enqueue it
The job is claimed with FOR UPDATE SKIP LOCKED, so workers never contend. Attempt 1 times out on the card charge, attempt 2 is rate-limited; each retry backs off exponentially and replays the steps already done.
05
Watch it finish
Attempt 3 charges the card, records the ledger entry and sends the receipt as a child job. Every attempt, step and log line is in your Postgres, next to the invoice it belongs to.
CompletedCompleted after 3 attemptsJoin early access
Why on the database you already run
- State stays home
- Jobs, steps and logs live in a schema of your own database, in your region, under your backups. How a Postgres queue works
- Your code stays where it is
- Workers run inside the process you already deploy. Calling your serverless deploy is planned. How Sturdle runs
- Not metered per step
- Retries, sleeps and replays are engine mechanics, not billable events. The engine is open source; what it does today is meant to stay free, and no pricing model that meters steps is on the table. How durable steps work
What's real today, and what's planned
Works today
- Queues on Postgres —
FOR UPDATE SKIP LOCKEDclaims, a worker pool, heartbeats, stale-job recovery - Retries with backoff, dead letter (including jobs with no handler), deadlines on stuck jobs
- Durable
step.runwith memoization,step.sleep/step.sleepUntil, memoizedstep.sendEvent, replay traces - Cron with a distributed lock, so exactly one instance ticks
- Concurrency limits per task, plus keyed concurrency per payload value
- Payload validated against a zod schema before it runs
- Per-job and per-attempt logs, persisted steps, task and queue statistics
- The execution timeline above: every attempt, backoff waits, dead letters, and steps replayed from memoization
Planned
- The console as an installable app — free
- The SDK —
defineJob,npx sturdle init— free - Flow control — rate limit, throttle, batch, workflows — Sturdle Pro
- Retry-aware alerts — Sturdle Pro, to validate
Run your first job on the database you already trust
Early access is open. No credit card, no new infrastructure to provision.