Skip to content

Code Step

The Code step is an escape hatch. Use it when a small TypeScript program is clearer than a long chain of general-purpose steps, or when an existing package already solves the problem well.

The Code step editor with TypeScript, line numbers, autocomplete, and the Run action

You write the body of an asynchronous function. QuickFlo provides workflow data in scope; whatever you return becomes the step output.

const customer = $steps['fetch-customer'].body
return {
customerId: customer.id,
active: customer.status === 'active',
}

Downstream steps can now reference {{ my-code.customerId }} and {{ my-code.active }}.

Use a Code step when:

  • a maintained npm or JSR package already handles the job;
  • a focused transformation is substantially clearer in TypeScript;
  • several branches need intermediate values or reusable functions;
  • you are proving a pattern before deciding whether it deserves a first-class step.

Prefer dedicated steps for HTTP calls, AI, files, common data transformations, and control flow. They are easier to inspect and operate.

You need toRead
Understand available data, imports, console output, return values, and errorsInputs, imports, and outputs
Work locally, understand the sandbox, or design around limits and loopsDevelopment and limits
Start from complete TypeScript examplesExamples
Understand workflow retry and recovery behaviorError Handling

The editor provides TypeScript diagnostics, package imports, workflow-aware autocomplete, inline documentation, captured console output, and a Run action. Run the workflow once to give autocomplete the actual shape of earlier step outputs.