Code that survives crashes and long waits
Pick another answerDurable execution on your own database
What Temporal, Restate, Inngest, DBOS, and cloud step functions call a workflow is a process here. Whether you use those tools or stitch jobs with queues and cron, Trestle runs that model in a library over your database, saving each step before it starts.
claim 1042Pay the claim
- Attempt 1key 7f3a9cbegan 09:12:04engine 1 died mid-paymentOutcome unknown
- Attempt 2key 7f3a9cbegan 09:12:09engine 2 picked up the run from its recordPaid
The bank’s ledger
key 7f3a9c1 payment
actKey and pays, while the bank’s ledger shows one payment.- Retry with the same key (default)
- Retry only within a time window
- Pause for a person to decide
How a run recovers after a crash
When a run resumes, the function replays from the top and receives saved results for finished steps, repeating only work since the last save.
What “once” actually means
Messages, answers, and started processes are taken exactly once. Each
actreceives anactKeythat survives retries and renames, so outside work happens once when that system respects the key.Long waits and deadlines
A
waitpauses a run for minutes or months without keeping anything in memory. You can back off retries with longer delays, cap each attempt’s duration, or put a deadline on any section.Changing code while runs are active
Processes declare whether active runs move to new code, finish on their starting version, or stop for a person. A pre-deploy check reports each unfinished run’s outcome without running code, and the engine follows it; declared renames keep their history.
No separate server to run
Trestle runs over SQLite or Postgres, including behind PgBouncer under a role with no create privileges. It works on Node, browsers, Web Workers, and edge runtimes, with guides for single machines, containers, Cloudflare, AWS Lambda, and Google Cloud Run.
What stays yours to keep safe
- Network, clock, or random calls outside a step repeat on replay; tests fail on the ones Trestle detects.
- An outside system that ignores
actKeycan still run a retried step twice. - Because runs replay from the top, one run supports up to 10,000 recorded steps and messages; split larger work by calling another process.
Your visit is running on Trestle.
This is the real Trestle engine running a live process in your browser tab, not a simulation. Each of the eight topic pages you open answers its question once, showing the path you have taken and the pages you have not opened yet—until you copy npm create @trestlerun to finish it.
Your path so far
npm create @trestlerunYou have opened all eight pages. Copy npm create @trestlerun whenever you are ready to finish the process.
You copied npm create @trestlerun, so this process has finished and recorded your full visit.
Show the code and detailsHide the code and details
export const visit = process({
name: 'visit',
body: async () => {
for (const _lap of Object.keys(CASES)) {
const next = await choice({
name: 'What do you care about?',
party: visitor,
cases: CASES,
});
if (next === START) {
return 'started a project';
}
}
return 'never started a project';
},
});export const visit = process({
name: 'visit',
body: async () => {
for (const _lap of Object.keys(
CASES,
)) {
const next = await choice({
name: 'What do you care about?',
party: visitor,
cases: CASES,
});
if (next === START) {
return 'started a project';
}
}
return 'never started a project';
},
});Your answers and the run are stored only in this browser.
npm create @trestlerun