4.7k

Backend Development

Custom Code

When a node doesn't cover what you need, drop down to code without leaving the canvas — the visual graph keeps working around it.

Demo placeholderThe Code node with a JavaScript snippet

Why this exists

No node library covers every possible calculation or transformation — and it shouldn't try to. Rather than blocking you until a matching node exists, Fimaflow lets you write the logic yourself, right on the canvas, as a normal step in the chain. The rest of your workflow doesn't need to know or care that one step happens to be hand-written.

The Code node

Write a snippet directly on the node, in the language set by codeLanguage (JavaScript by default). It receives the output of whatever is connected upstream as its input, and its return value becomes the output for the rest of the chain:

Plain Text
// input: { firstName: "Ada", lastName: "Lovelace" }

return {
  ...input,
  fullName: `${input.firstName} ${input.lastName}`,
}

Useful for one-off logic that's simpler to write than to assemble from Transform/Logic nodes — a date calculation, a string format, a small piece of math no node models directly.

The Function node

For larger pieces of logic, the Function node runs a full function with its own functionRuntime (TypeScript by default) and a configurable functionTimeout in milliseconds. A better fit than an inline Code snippet once the logic grows past a few lines, needs its own type definitions, or has to call another library.

Set the timeout deliberately — a Function node that hangs blocks the whole request until it hits that limit, then fails like any other node timeout would.

Nodes vs. code

Prefer nodes whenever one exists for what you're doing — they stay visible on the canvas, easy to reconfigure, and easy for a teammate to follow at a glance without reading a snippet. Reach for Code or Function when:

  • • The logic is genuinely one-off and unlikely to be reused elsewhere.
  • • You need a calculation or transformation with no matching node.
  • • You're porting an existing snippet of business logic as-is, and rebuilding it as a chain of nodes would just be busywork.

Interactions with the rest of the platform

  • • A Code or Function node can read the same Environment Variables as any other node, via {{VAR_NAME}} in a field it reads, or by resolving it inside the code itself.
  • • Custom code doesn't get automatic secret-masking on values it constructs itself — if a snippet builds a string containing a credential, mask it deliberately before returning it, the way you would in any hand-written service.

Errors & debugging

Errors thrown from a Code or Function node behave like any other node failure — they show up highlighted on the canvas with the message and stack trace attached, and everything downstream never runs. See Debugging for that exact flow.

Limitations

  • • No arbitrary npm package installs from inside a snippet — a Function node's runtime ships with a fixed standard library.
  • • A Function node's functionTimeout is capped by your plan's overall execution timeout — a very long-running task belongs in a Queue node instead of a single blocking call.

Next steps