stateful-loop

Stateful Loop Node for n8n — maintain state across iterations.

Package Information

Downloads: 1 weekly / 19 monthly
Latest Version: 1.1.9
Author: OXSR

Documentation

n8n-nodes-stateful-loop

Author: OXSR
Icon: fa:repeat

Stateful Loop Node for n8n that lets you iterate over incoming items while preserving state (variables, counters, accumulators) between iterations.

Features

  • Automatic iteration counter.
  • Optional result storage per iteration (vars.results).
  • Custom user variables via JSON initializer.
  • Flexible JavaScript exit condition.
  • Summary output with total iterations and final state.

Usage

  1. Add the Stateful Loop node to your workflow.
  2. Configure:
    • Max Iterations — safety cap.
    • Variable Initializer (JSON) — starting state, e.g. {"sum":0,"products":[]}.
    • Exit Condition — JS expression, e.g. totalSinStock >= 5.
  3. Wire downstream nodes to consume the final summary.

Development

npm install
npm run build

Publish to npm or load locally in n8n via the Community Nodes feature.

Discussion