Next.js Spec

Waymark's first JavaScript target is Next.js. The runtime model is the same - workflows define durable control flow, actions define distributed work - but the front-end will be a TypeScript compiler that lowers your authored source into the same Waymark IR the Rust runtime already executes. The runtime, Postgres persistence, and worker pool need no changes; only the compiler in front of them is new.

Status

Design stage. The Python SDK proved out the compile-once model end to end; the JavaScript compiler reuses that runtime contract. When an implementation lands, this page becomes the reference for it.

The authoring model

The intended shape mirrors Python directly. Actions are exported async functions; workflows are classes extending Workflow with a durable run() entrypoint; parallel fan-out uses the language's native primitive:

export class WelcomeEmailWorkflow extends Workflow {
  async run(userIds: string[]): Promise<EmailResult[]> {
    const users = await fetchUsers(userIds);
    const activeUsers = users.filter((user) => user.active);

    return await Promise.all(
      activeUsers.map((user) => sendWelcomeEmail({ to: user.email })),
    );
  }
}

As in Python, the authored run() body is compiler input, not runtime business logic. The build compiles it to IR once; the runtime executes the compiled program durably, with no replay.

What carries over from Python

  • Actions are the retryable, distributed work units.
  • Workflows are the durable control-flow layer.
  • The workflow definition is compiled once, not re-run during recovery.
  • Retry and timeout policy attach to action calls, not the workflow as a whole.
  • Parallel fan-out uses the language's native primitive: Promise.all in TypeScript, asyncio.gather in Python.

If you want durable workflows today, start with the Python Quickstart.