Skip to content
Trigora
GitHub ↗

Quickstart

The first useful Trigora program is ordinary TypeScript with a few durable operations.

import { effect, waitForEvent } from "@trigora/sdk";
export async function order(input: Order) {
const payment = await effect("payment", () =>
charge(input)
);
const approval = await waitForEvent("approved");
return fulfill(payment, approval);
}

The point is not the syntax. It is this loop:

  1. Start an execution of order.
  2. The payment effect commits.
  3. The program waits. No compute is held.
  4. Kill the runtime.
  5. Start it again. Recovery restores the execution at the wait — it does not charge again.
  6. Send approved. The program continues and returns.

That is the product. If a future API cannot be taught in this loop, the API is wrong.

The intended client shape:

const run = await trigora.start(order, input);
// later, after restore
await run.send("approved", {
reviewer: "omar",
});

Next: Programs · Executions