Core Concepts
Understanding Nodes, Edges, and Data Flow
Core Concepts
To build workflows effectively in Nodes2Cloud, you need to understand the three fundamental building blocks: Nodes, Edges, and Data References.
Nodes
A Node is a single step in your workflow. Nodes perform specific actions, such as receiving a webhook, sending an email, or transforming data.
There are three main categories of nodes:
- Trigger Nodes: These start the workflow. Every workflow must have exactly one trigger node (e.g., Webhook, Cron).
- Action Nodes: These perform an operation (e.g., Send Slack Message, Query Database).
- Control Flow Nodes: These route the execution path based on logic (e.g., If/Else, Loop).
Edges
An Edge is the visual connection between two nodes on the canvas.
- Execution Flow (Solid Lines): These determine the order in which nodes execute. When Node A finishes, execution follows the solid edge to Node B.
- Data Flow (Implicit): You do not need to wire "data" edges explicitly. Any node can read the output of a node that ran earlier in the same run using a Data Reference.
Data References (Expressions)
When a node executes, it produces output data. You can reference this data in later nodes with expressions inside {{ }}. Expressions are compiled into the Worker's code along with the rest of the graph; they are never evaluated with eval.
$json
The payload the trigger received for this run, such as a webhook's parsed request body.
{{ $json.email }}$node
The output of a specific node, addressed by its ID (here, a node with the ID lookup_customer).
{{ $node.lookup_customer.email }}$item, $itemIndex and $loop
Inside a loop, $item is the current element and $itemIndex its position. $loop exposes loop state such as count, isFirst and isLast.
{{ $item.email }}
{{ $loop.isLast }}A Code node inside a loop gets the same values as the variables $item, $itemIndex and $loop. Outside a loop they are undefined.
Working with lists
Each node produces one value per run, and a connection only sets the order nodes run in. Nothing iterates implicitly. If a step that handles one thing (send an email, create a row) is given a list, it receives the whole list once. To process each item, choose how explicitly:
- Run for each item. Open the step and turn on Run for each item in, then pick the list, for example
{{ $node.fetch_users.body }}. The step runs once per item, with$itemset to the current item, and its output becomes the list of every run's result. When a step receives a list after a test run, the editor offers this as one click. - A loop region. Use a loop node (Loop Over Rows, or Loop Over Items (Batch) for batches) when several steps should run per item. Wire its Loop output into the first step and the last step back into the loop.
- Collect the results. After a loop, a reference to a step inside it sees only the last item's value. Add an Aggregate Loop Results node after the loop to gather every item's value, or use the editor's Add to loop collector fix on that warning.
Every loop, including Run for each item, has a maximum item count (1,000 unless you change it). A longer list fails the run instead of being cut short. On a workflow with durable steps, each item is its own retried, replay-safe step.
List and text helpers
Expressions can call a fixed set of functions. There are no callbacks, so pluck replaces .map(x => x.field):
| Function | Example | Result |
|---|---|---|
first / last | {{ first($node.fetch.body) }} | first or last element |
pluck | {{ pluck($node.fetch.body, "email") }} | ["[email protected]", …] |
sum / min / max / avg | {{ sum(pluck($json.items, "price")) }} | numbers only; other values are skipped |
unique / flatten / compact | {{ unique(pluck($json.rows, "team")) }} | de-duplicated, one level flattened, empties removed |
keys / values | {{ keys($json.metadata) }} | an object's keys or values |
slice | {{ slice($json.items, 0, 10) }} | part of a list or text |
replace | {{ replace($json.phone, "-", "") }} | every occurrence, replaced literally |
number / string | {{ number($json.qty) + 1 }} | converted value |
length, upper, lower, trim, round, floor, ceil, abs, join, split, contains, default, formatDate, json, parseJson | {{ join(pluck($json.tags, "name"), ", ") }} | as named |
$error
Available only inside an error branch (a node's error output that you have wired up). It holds the message of the error that was caught.
{{ $error }}Built-in Helpers
You also have access to standard context values:
{{ $now }}- The current time as an ISO 8601 string.{{ $env.MY_SECRET }}- A variable or secret from the deployed Worker's environment.{{ $execution }}and{{ $workflow }}- Details about the current run and workflow.
Executions
An Execution is a single run of your workflow. Your graph was compiled ahead of time into plain TypeScript, so at runtime there is no graph to walk: when a trigger fires, Cloudflare runs the compiled Worker in your Cloudflare account, and the Worker runs that code.
Graphs with durable steps, such as a wait, a delay or a sub-workflow call, compile to a Cloudflare Workflow instead. Each side-effecting step runs inside step.do, so Cloudflare retries it on failure and keeps its result, and a run can pause for as long as the wait needs.
