Chapter 02
n8n in depth
How n8n workflows are built and billed: nodes and items, triggers, expressions, credentials, the Code node, self-hosting, the fair-code licence and executions.
Workflow and nodes
Also called canvas, trigger node, Webhook node, Schedule Trigger
- What
- An n8n workflow is a canvas of nodes: one trigger node starts it and each following node does one job. A workflow must be activated for its production trigger to fire.
- Why
- Knowing that test webhook URLs only listen while you are in the editor, and production URLs only when active, avoids the most common go-live failure.
Watch out
Giving a client the test webhook URL, which stops working when you close the editor.
Items
Also called n8n data structure, Split Out, Aggregate
- What
- Data flows between n8n nodes as a list of items, each holding a json object. Most nodes run once per item they receive.
- Why
- Item counts decide how many emails, rows or API calls a node makes. Split Out turns an array into items; Aggregate joins items back into one.
- Example
- An HTTP node returns 50 contacts as 50 items, so the next Slack node sends 50 messages unless you aggregate first.
Watch out
Not noticing whether you have one item holding an array or many items.
Expressions
Also called $json, $now, Luxon
- What
- JavaScript snippets inside double curly braces that fill a node field.
$jsonis the current item,$('Node name').item.jsonreaches an earlier node, and$nowis a Luxon date. - Why
- Expressions handle most cleaning, joining and date formatting without adding a Code node.
{{ $json.name?.trim() || 'there' }}
{{ $('Webhook').item.json.body.email }}
{{ $now.setZone('Africa/Lagos').toFormat('yyyy-LL-dd') }}Watch out
Referencing a node by name and then renaming the node.
Credentials
Also called encryption key, N8N_ENCRYPTION_KEY
- What
- Stored API keys, OAuth connections and passwords that nodes reference by name. n8n encrypts them in its database with an encryption key.
- Why
- Credentials keep secrets out of workflow JSON, so exports and shared templates do not leak keys. Losing the encryption key on a self-hosted instance loses every credential.
Watch out
Typing a key into an HTTP node header instead of a credential.
Code node
Also called Function node, $input.all(), Run Once for All Items
- What
- A node that runs your own JavaScript or Python. In Run Once for All Items mode,
$input.all()returns every item, and you must return a list of{ json }items. - Why
- It covers reshaping and validation that expressions and built-in nodes cannot. On n8n Cloud, external npm packages cannot be imported.
const seen = new Set();
const out = [];
for (const item of $input.all()) {
const email = (item.json.email || '').trim().toLowerCase();
if (!email || seen.has(email)) continue;
seen.add(email);
out.push({ json: { ...item.json, email } });
}
return out;Watch out
Returning plain objects instead of items shaped as { json: {...} }.
Self-hosting and n8n Cloud
Also called Community Edition, Docker, n8n Cloud, self-hosting, self-hosted instance
- What
- n8n Cloud is hosted by n8n on a paid plan. The free Community Edition can be self-hosted, usually in Docker, on a server you or the client runs.
- Why
- Self-hosting removes execution fees and keeps data on a chosen server, but you own HTTPS, backups, updates and outages.
docker volume create n8n_data
docker run -it --rm --name n8n -p 5678:5678 \
-e GENERIC_TIMEZONE="Asia/Karachi" \
-e TZ="Asia/Karachi" \
-v n8n_data:/home/node/.n8n \
n8nio/n8nWatch out
Running without a named volume, so workflows vanish when the container is removed.
Sustainable Use License
Also called fair-code, n8n licence, n8n Enterprise License
- What
- The fair-code licence n8n is published under: free to use, modify and self-host for internal business and personal use, with commercial limits set by n8n.
- Why
- Per the official licence page, building workflows for clients as a consultant is allowed; offering n8n itself as a hosted service or embedding it in a product needs a separate agreement.
Watch out
Selling logins to a rebranded n8n instance as your own platform.
Executions
Also called n8n pricing, execution billing
- What
- One execution is one full run of a workflow, however many nodes or items it has. n8n Cloud plans are priced by executions per month.
- Why
- Long workflows are cheap per run; triggers that fire constantly are expensive. As of 2026-09, Starter is listed from 20 euros a month billed annually for 2,500 executions.
- Example
- A workflow on every new order for a shop with 150 orders a day is about 4,500 executions a month.
Watch out
A one-minute polling trigger that runs about 43,000 times a month and mostly finds nothing.