marzapower

For TypeScript developers

Sturdle

Your background jobs, in your own Postgres.

Run jobs, retries and scheduled work in your TypeScript apps, reusing the results of the steps already completed. Jobs, steps and logs live in a dedicated schema of your own Postgres, and workers can run in your app's Node.js process. Sturdle is open source under the MIT license and is the background job engine of Fabulous Factory.

Illustrative example: a job resumes from its saved results

Attempt 1
StepStatus
Fetch invoice completed
Charge timeout
Record not run
Queue receipt not run

wait before the next attempt

Attempt 2
StepStatus
Fetch invoice reused
Charge rate limited
Record not run
Queue receipt not run

wait before the next attempt

Attempt 3
StepStatus
Fetch invoice reused
Charge completed
Record completed
Queue receipt completed
A demo job: the invoice lookup is saved once and reused on later attempts; after two errors on the charge, the job records the entry and queues the receipt. Adapted from the demo on sturdle.marzapower.com.
Role
I designed and built the engine, the Postgres adapter and the console components, and the Sturdle website on Fabulous Factory.
Status
Open source, MIT license, evolving.
Built with
TypeScript, Node.js, PostgreSQL with the pg driver, Zod to validate payloads
Updated
November 2026

How it started

When you build a product, some work has to carry on beyond the request that started it: an email to send later, a payment to retry, a report to prepare every night. Across projects, including those in production, I kept encountering the same needs: avoid repeating completed work, handle long waits, and understand why a job stopped.

I gathered those answers into Sturdle, an open-source project that keeps job state in your own Postgres and preserves the results of completed steps.

In Fabulous Factory you find Sturdle already integrated for your apps' background jobs. And the Sturdle website is built on Fabulous Factory.

What you can do with it

Keep jobs in your own Postgres

Jobs, steps and logs live in a dedicated schema of the database you already use. The adapter creates the schema and applies its own migrations on startup, coordinating instances that boot together.

  • Reuse results on retries

    Once a step completes and its result is saved, later attempts reuse it. Your handler runs again from the top, and step.run returns the recorded result for every step already completed.

  • Free workers while jobs wait

    With step.sleep and step.sleepUntil a job waits minutes or days without holding a worker. When the wait ends, it goes back in the queue and resumes from the results of the completed steps.

  • Coordinate crons across replicas

    Schedule work with cron expressions; the state shared in Postgres decides which instance starts each occurrence. After an interruption, the engine considers the latest occurrence within the configured delay.

  • Show the history of every job

    With the console's open-source React components you show attempts, waits, reused results and saved logs inside your own interface.

  • Run jobs on demand

    Where there's no long-running process, on-demand mode connects engine.tick to a route of your app, called by an external scheduler: each call moves the available work forward.

Where it fits

With Fabulous Factory and Sturdle I build open-source tools for people developing products, including those working with AI agents.

  • Open-source foundations

    Fabulous Factory

    Give your AI agent an already-connected foundation to build your product on. Background jobs run on Sturdle, next to the other services you find in the foundations.

    How Fabulous Factory is built
  • Technical documentation

    Guarantees and limits

    See how Sturdle fits your app: how a job is claimed, how retries work and what happens when a process stops. Every statement points to the file in the code where you can check it.

    Read the guarantees and limits
  • Planned

    Sturdle Pro

    Flow control for jobs (rate limits, throttling, batches and workflows) and alerts that understand retries, still to be validated. The planned model is a flat-rate license per organization; what's published under MIT stays MIT.

    See what's planned for Sturdle Pro

How it's built

For those who want to look underneath.

The engine talks to storage through a contract; the Postgres adapter implements it on the pg driver, without an ORM. A worker claims a job in one transaction with FOR UPDATE SKIP LOCKED. While a job runs, a heartbeat renews its lease; a sweep requeues jobs whose leases have expired and that still have attempts remaining.

You connect the events Sturdle emits to the observability tools you already use, through onEvent. The integration lives in your app's code, and the engine stays free of any vendor SDK.

Where it stands

Sturdle is open source under the MIT license, evolving, and integrated into Fabulous Factory. The console components are in the repository; the installable console application, the Redis adapter and Sturdle Pro are planned. On-demand mode has been run locally, and the next step is a serverless deployment. Delivery is at least once, so external effects such as a charge should be idempotent: the guarantees page collects this and the other limits, with references to the code.

Evolving, November 2026

Designing background jobs for your app?

Whether you want to bring them onto your own database, plan a migration or make retries easier to read, let's talk.

Write to me

More projects

  • Fabulous FactoryFoundations already in place for your AI agent. It builds the product.
  • EmoviaBringing AI into clinical practice, starting with the time between sessions.
  • AriannaStudy from a manual built for you, not from scattered slides.
  • Power PuzzlesPuzzles you solve by reasoning, never by guessing.
  • The One IncrementalAn incremental game about bringing infinity down to zero, and the open-source engine that runs it.