Scrapeless Wiki

What Is n8n? – Definition and How It Works

Informational P2 what is n8n

Learn what n8n is, how nodes and item-based execution work, why the Code node matters, and where visual automation fits for data work.

n8n is a workflow automation tool where flows are built by connecting nodes on a canvas. It can be self-hosted, which is the property that distinguishes it from most alternatives.

1. The Model

  • Nodes perform steps β€” trigger, request, transform, branch, write.
  • Connections define the order.
  • Items flow between nodes; each node receives a list and emits a list.
  • Expressions reference earlier data in field values.

That item-based execution is the concept newcomers most often miss: a node receiving five items runs five times, once per item, unless it is explicitly designed otherwise.

2. Triggers

Trigger Starts on
Schedule A cron-style timetable
Webhook An incoming HTTP request
App event A change in a connected service
Manual A button, for development

3. The HTTP Request Node

For anything without a dedicated integration, the generic HTTP node covers it: method, URL, headers, query parameters, authentication, and body.

Credentials are stored separately from the workflow, so an exported flow does not carry the key. That separation matters β€” a workflow shared with a key embedded in a node is a leak.

4. The Code Node Is Where Real Work Happens

Visual nodes handle common shapes; anything beyond that is a small piece of JavaScript or Python:

return items.map(item => ({
  json: {
    name: (item.json.title ?? '').trim(),
    price: Number(String(item.json.price).replace(/[^\d.]/g, '')),
  },
}));

Trimming, type coercion, reshaping, and validation all belong here. Attempting them through chains of visual nodes produces flows that are hard to read and harder to change.

5. Where Visual Automation Fits

  • Connecting services that already have integrations.
  • Moderate volume, where per-item overhead is irrelevant.
  • Cross-team visibility, since a canvas is readable by non-developers.
  • Fast iteration on a workflow's shape.

6. Where Code Fits Better

  • High volume, where per-item execution overhead accumulates.
  • Complex logic that becomes unreadable as a node graph.
  • Version control and code review, which suit text far better than exported JSON.
  • Comprehensive testing.

Self-hosting also means operating a service, which is a real cost against a scheduled script.

7. Practical Notes

  • Keep credentials in credential storage, never in node fields.
  • Use the Code node early for cleaning, rather than late for repair.
  • Handle pagination explicitly with a loop and a stop condition.
  • Export workflows to version control, even though the format is JSON.
  • Set error handling per node, so one failing item does not silently drop a batch.

8. Summary

n8n builds automations from connected nodes with item-based execution, a generic HTTP node for any API, and Code nodes for the transformation work.

It suits service connection and moderate volumes with cross-team visibility, and it gives way to code when logic complexity, volume, or testing requirements grow.