Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 36 ยท Alternatives: Make and n8n

n8n: Workflows, Nodes and Expressions

Learn n8n, the open source workflow tool you can self-host: nodes, items, expressions, the Code node, credentials, executions and how it compares with Zapier and Make.

n8n (pronounced "n-eight-n") is a workflow automation tool with a visual editor like Zapier and Make, but with two important differences: its source code is available under a "fair-code" licence, and you can run it yourself on your own server or use the vendor's hosted service. That makes it popular with developers and with companies that must keep data inside their own network. This lesson explains how n8n thinks, and how its ideas map onto the tools you have met.

The product cannot run on this site. The descriptions are in words (the interface changes between versions, so verify names in your version) and the code blocks are our own JavaScript stand-ins that model n8n's data flow. They are not n8n's code.

The vocabulary

Zapier n8n Notes
Zap Workflow Saved as JSON; can be exported and imported
Trigger Trigger node Webhook, Schedule, app triggers, manual
Action Node One operation, drawn as a box
Task Execution Cloud plans bill by executions of whole workflows, not per step
Zap history Executions list Shows input and output of every node
Connection Credential Stored encrypted, reused by nodes
Looping automatic per item, or Loop Over Items Nodes run for each item

Prices and plan structure change; the practical difference worth knowing is that a self-hosted community edition has no per-task fee (you pay for your own server and time).

Items: how data moves

In n8n every node receives a list of items and outputs a list of items. An item is a JSON object, shown as $json in expressions. Like Make's bundles, if a node outputs 5 items the next node processes all 5. Unlike Make it processes the list in one go: the node's code runs once for each item, but the whole run counts as one step in the execution.

Branching nodes decide which items go where:

  • IF: two outputs, true and false.
  • Switch: several outputs, like Paths.
  • Merge: combine two streams (append, match by key, join like SQL).
  • Split Out / Aggregate: turn a list field into items and back.
  • Loop Over Items (Split In Batches): handle items in groups, for example 50 at a time to respect rate limits.
flowchart LR
    W["Webhook"] --> E["Edit Fields"]
    E --> I{"IF amount over 100"}
    I -- "true" --> S["Send Slack message"]
    I -- "false" --> D["Save to Data table"]
    S --> R["Respond to Webhook"]
    D --> R

A small n8n workflow: nodes, two branches, one reply.

Expressions

Any field can switch from fixed text to an expression by typing {{ ... }}. Inside you can use JavaScript and n8n's helper variables:

  • {{ $json.email }} reads the field email of the current item.
  • {{ $json.amount * 1.2 }} does arithmetic.
  • {{ $('Webhook').item.json.order_id }} reads data from an earlier node by name.
  • {{ $now.toFormat('yyyy-MM-dd') }} gives today's date (date helpers use the Luxon library).

Because expressions are JavaScript, n8n usually needs fewer helper steps than Zapier: where you would add a Formatter step, you often just write the expression in place. The stand-in below evaluates {{ ... }} placeholders against an item, showing the idea.

JS Stand-in: evaluate {{ expressions }} for each item

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The last line shows a classic expression error: reading a key of something that is undefined. In n8n the optional chaining operator ?. avoids it: {{ $json.missing?.deep }}.

The Code node

When a visual node is not enough, the Code node runs JavaScript (or Python, on versions that include it) over your items. A typical script for "run once for all items" receives all items and returns a new list:

JavaScript
// Inside an n8n Code node (read-only example, "Run once for all items")
const out = [];
for (const item of $input.all()) {
  const total = item.json.items.reduce((s, i) => s + i.qty * i.price, 0);
  out.push({ json: { order_id: item.json.order_id, total } });
}
return out;

Here is the same logic as a runnable stand-in that fakes $input.all().

JS Stand-in: a Code node over items

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The code-first escape hatch is one reason developers like n8n: you are never stuck waiting for a built-in node.

Credentials, webhooks and executions

  • Credentials are stored once (API keys, OAuth apps) and chosen in nodes by name. On a self-hosted server an encryption key protects them, so back that key up.
  • The Webhook node has a test URL (works while you listen in the editor) and a production URL (works once the workflow is active). Mixing them up is the number one "why does nothing happen" cause, similar to Zapier's on/off state.
  • Executions record the input and output of each node, so debugging is a matter of clicking a node and reading its data. Many setups prune old executions to save space.
  • The Error Trigger node starts a separate workflow whenever another one fails, ideal for alerts (Error Handling and Replays).
  • Sub-workflows (Execute Workflow node) turn repeated logic into reusable parts.
  • You can export a workflow as JSON and keep it in Git, giving you real version history (Naming, Documentation and Change Management).

Self-hosting: what you take on

Self-hosting gives control of data and cost, but adds work: a server or container, HTTPS, backups of the database and encryption key, updates, monitoring, and queue-mode scaling if load grows. Plan for it like any small production service. For many teams the hosted version is a fair compromise.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In n8n, what is an item?

    Nodes receive and emit lists of items; $json is the current item's data.
  2. 2. How would you read the field email of the current item in an expression?

    Expressions sit inside double curly braces and use $json for the current item.
  3. 3. A workflow does nothing when called on the Webhook node's test URL after activation. Why?

    n8n has separate test and production webhook URLs.
  4. 4. Which is a real responsibility of self-hosting n8n?

    You run the service, so you also maintain it.

Summary

  • n8n is a node-based workflow tool you can self-host; workflows are JSON that you can export.
  • Nodes pass lists of items; IF, Switch, Merge, Split Out and Loop Over Items control flow.
  • Expressions in {{ }} use JavaScript; the Code node covers everything else.
  • Credentials, test versus production webhook URLs, the Error Trigger and sub-workflows are the key practical pieces.
  • Self-hosting trades per-task fees for operating work.

Next: Choosing an Automation Platform