---
title: "n8n fundamentals: cloud vs self-hosted"
description: "What n8n is n8n is a workflow automation platform with a node-based editor, strong support for code and raw APIs, and first-class AI nodes. Its source is…"
url: https://optimizeall.com/learn/no-code-ai-automation-n8n-make-zapier/n8n-fundamentals-cloud-vs-self-hosted
updated: 2026-10-05
---

AI Automation with n8n, Make and Zapier · n8n in depth · lesson 3 of 17 · 16 min

# n8n fundamentals: cloud vs self-hosted

## What n8n is

**n8n** is a workflow automation platform with a node-based editor, strong support for code and raw APIs, and first-class AI nodes. Its source is available under a "fair-code" license (the Sustainable Use License, with enterprise features under a separate license), which is why you can **self-host** it. n8n 2.0 (released December 2025) focused on security, reliability and performance, including sandboxed Code node execution by default and a clearer save-versus-publish model for workflows. Check the release notes for the current version's behavior.

## Cloud vs self-hosted

| | n8n Cloud | Self-hosted |
|---|---|---|
| Setup | Minutes | You deploy (Docker, Kubernetes, managed hosts) |
| Maintenance | Managed by n8n | You patch, back up, monitor, scale |
| Data location | n8n's hosting regions | Wherever you run it (your cloud region, on-premises) |
| Cost model | Subscription (execution-based plans) | Infrastructure + your time; enterprise license for some features |
| Best for | Teams without DevOps capacity | Data residency needs, high volumes, custom nodes, full control |

**Data residency matters in our markets.** A Saudi or UAE organization with strict data rules may self-host n8n in an in-country cloud region, keeping workflow data local. Remember that calls to external APIs (for example an LLM provider) still send data wherever that provider processes it.

## Self-hosting quickstart (Docker)

```bash
docker volume create n8n_data
docker run -it --rm --name n8n -p 5678:5678 \
  -e GENERIC_TIMEZONE="Asia/Dubai" -e TZ="Asia/Dubai" \
  -e N8N_ENCRYPTION_KEY="${N8N_ENCRYPTION_KEY}" \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n
```

For production, use Docker Compose or Kubernetes with: a PostgreSQL database; HTTPS via a reverse proxy; `WEBHOOK_URL` set to your public URL; a fixed `N8N_ENCRYPTION_KEY` stored as a secret (credentials are encrypted with it; lose it and you lose access to stored credentials); backups; and, for high volume, **queue mode** with Redis and separate worker processes. Pin the image version and upgrade deliberately after reading release notes.

## The n8n workflow model

- **Nodes** receive and output **items**: arrays of JSON objects (plus optional binary data for files).
- **Expressions** in double curly braces read data: `{{ $json.email }}` (current item), `{{ $('Get Contact').item.json.id }}` (a previous node's matching item), `{{ $now }}` (Luxon date-time).
- **Core nodes** you will use constantly: Webhook, Schedule Trigger, HTTP Request, Edit Fields (Set), IF, Switch, Merge, Loop Over Items, Wait, Code, Execute Workflow (sub-workflows), Respond to Webhook, Error Trigger.
- **Sub-workflows** let you reuse logic ("process lead") across many triggers; pass inputs and return outputs.
- **Executions** log every run with input and output data per node, so you can debug and retry.
- **Credentials** are stored encrypted and referenced by nodes; share them carefully across projects.

## Debugging like a pro

- **Pin data**: freeze a node's output while you build downstream nodes, so you don't re-trigger external systems.
- **Execute step by step** and inspect items in table/JSON views.
- **Use the executions list** to find failures; re-run with the same data after a fix.
- **Name nodes clearly** ("CRM: upsert contact", not "HTTP Request3"); expressions reference node names.

## Worked example: a Riyadh clinic group's appointment reminder workflow (self-hosted)

Requirements: patient data must stay in-country; reminders by WhatsApp 24 hours before appointments; no reminders during prayer times configured by the clinic; logs retained 30 days.

Design: n8n self-hosted in a KSA cloud region with PostgreSQL; Schedule Trigger every 15 minutes (Asia/Riyadh); HTTP Request to the clinic's scheduling API (credentials stored in n8n); Code node filters appointments in the 24-hour window and not already reminded; IF node checks the clinic's quiet-time table; WhatsApp Business Cloud API template messages; a data table or database row marks "reminded" to prevent duplicates; execution data pruning set to 30 days. No LLM involved: deterministic and cheap.

## Hands-on: your first useful n8n workflow

1. Add a **Webhook** node (POST), copy the test URL.
2. Add an **Edit Fields** node: set `email` to `{{ $json.body.email.trim().toLowerCase() }}` and `name` to `{{ $json.body.name }}`.
3. Add an **IF** node: `{{ $json.email }}` ends with your company domain -> internal; else external.
4. On the external branch, add a **Google Sheets** (or Airtable) node to append a row.
5. Add **Respond to Webhook** returning `{"ok": true}`.
6. Test with curl:

```bash
curl -X POST "$N8N_TEST_WEBHOOK_URL" -H "Content-Type: application/json" \
  -d '{"email":" Sara@Example.com ","name":"Sara Khan"}'
```

7. Publish/activate the workflow and switch to the production webhook URL.

## Pitfalls

- Losing `N8N_ENCRYPTION_KEY`, which makes stored credentials unreadable.
- Running production self-hosted instances on SQLite without backups.
- Testing against the test webhook URL and forgetting it differs from the production URL.

## Video lecture: n8n fundamentals: cloud vs self-hosted

Lecture coming soon · 14 chapters · about 8 minutes. Read the full transcript below.

1. n8n fundamentals
2. Why n8n
3. What n8n is
4. Analogy: rent vs own
5. Cloud vs self-hosted
6. Production self-hosting
7. Workflow model
8. Debugging
9. Worked example: Riyadh reminders
10. Example 2: Manchester consultancy
11. Common mistakes
12. Watch me do it: intake workflow in n8n
13. Recap and next step
14. Try this now

## Lecture transcript

### n8n fundamentals

n8n has become a favorite of technical marketers and automation agencies, and for good reason. It's visual like other tools, but it's friendly to code and raw APIs, has first-class AI nodes, and you can run it on your own servers. In this lesson you'll learn what n8n is, when to choose cloud or self-hosted, how to self-host safely, the workflow model of items and expressions, and how to debug like a professional.

### Why n8n

Why learn n8n in depth? Because it sits in a sweet spot: visual enough for fast building, open enough for code and raw APIs, and deployable on your own infrastructure when data rules require it. For agencies and technical marketers in Pakistan and the Gulf, where data residency and cost matter, that flexibility is often decisive.

### What n8n is

n8n's source is available under a fair-code license, which is why you can self-host it. Version two point zero, released in December twenty twenty-five, focused on security, reliability and performance, including sandboxed code execution by default and a clearer model for saving versus publishing workflows. Always check the current release notes, because behavior changes between versions.

### Analogy: rent vs own

An analogy: n8n Cloud is like renting a fully serviced office, and self-hosting is like owning your building. The serviced office is ready today, and someone else fixes the lifts and the air conditioning. Owning the building gives you full control over who comes in and where things are kept, but you pay for maintenance, security and repairs. Neither is better in general. It depends on your needs, your team and your rules.

### Cloud vs self-hosted

Cloud or self-hosted? n8n Cloud takes minutes to set up and n8n maintains it. It's best for teams without DevOps capacity. Self-hosted means you deploy, patch, back up, monitor and scale it yourself, but you control where data lives, can handle high volumes, and can add custom nodes. Data residency matters in our markets. A Saudi or UAE organization may self-host in an in-country cloud region to keep workflow data local. But remember: calls to external services, like a language model provider, still send data wherever that provider processes it.

### Production self-hosting

Self-hosting starts with a single Docker command, shown in the lesson text. But production needs more: a PostgreSQL database, HTTPS through a reverse proxy, the webhook URL set to your public address, backups, and a fixed encryption key stored as a secret. That key encrypts your stored credentials. Lose it, and you lose access to every credential. For high volume, use queue mode with Redis and separate workers. And pin the image version, upgrading deliberately after reading release notes.

### Workflow model

Now the workflow model. Nodes receive and output items, which are arrays of JSON objects, plus optional binary data for files. Expressions in double curly braces read data: the current item's email, a previous node's matching item by node name, or the current time. You'll use a core set of nodes constantly: webhook, schedule, HTTP request, edit fields, IF, switch, merge, loop, wait, code, execute workflow for sub-workflows, respond to webhook, and error trigger. Sub-workflows let you reuse logic, like process lead, across many triggers.

### Debugging

Debug like a professional. Pin data on a node to freeze its output while you build downstream, so you don't keep re-triggering external systems. Execute step by step and inspect items in table and JSON views. Use the executions list to find failures and re-run them with the same data after fixing. And name nodes clearly, like CRM upsert contact, not HTTP Request three, because expressions reference node names and your future self will thank you.

### Worked example: Riyadh reminders

Here's a self-hosted example. A clinic group in Riyadh needs appointment reminders by WhatsApp twenty-four hours ahead, with patient data kept in-country and no messages during configured quiet times. They run n8n in a Saudi cloud region with PostgreSQL. A schedule trigger runs every fifteen minutes on Riyadh time, fetches appointments from the scheduling API, filters the twenty-four hour window, checks quiet times, sends WhatsApp template messages, and marks each appointment as reminded to prevent duplicates. Execution data is pruned after thirty days. No AI needed: deterministic and cheap.

### Example 2: Manchester consultancy

A simple example. A two-person marketing consultancy in Manchester uses n8n Cloud. They build a workflow that takes new newsletter sign-ups from a form, adds them to their email tool, and posts a message in their team chat. They don't need self-hosting, since there's no special data residency requirement, and they'd rather spend their time on clients than on servers. Cloud is the right call.

### Common mistakes

Common mistakes. Losing the encryption key on a self-hosted instance, which makes every stored credential unreadable. Running production on the default lightweight database without backups. Testing against the test webhook URL and forgetting that production uses a different one. And upgrading to the latest version without reading release notes, which can change behavior your workflows depend on.

### Watch me do it: intake workflow in n8n

Watch me do it. I build the intake part of our lead workflow in n8n. I name the workflow sales lead intake webform version one. Webhook node: method POST, path lead intake, and I note both the test and production URLs in the workflow description. I pin the sample data from last lesson. Edit fields node, renamed normalize fields, using expressions: email is the body email trimmed and lowercased, name is the body name trimmed. For the phone, I call the Code node we wrote, renamed normalize phone. Next, an Execute Workflow node that calls a separate sub-workflow called process lead, passing the clean item. Keeping processing in a sub-workflow means the Facebook lead ads trigger can reuse it later. Then a Respond to Webhook node returning ok true, so the website gets an answer immediately. I test with curl against the test URL, open the executions list, and inspect each node's output in table view. One mistake shows up: I referenced a node by its old name in an expression after renaming it, so it returned empty. I fix the reference. Finally I publish the workflow, switch the website form to the production URL, submit one real test lead, and see it in the executions list.

### Recap and next step

Recap. n8n combines a visual editor with code, APIs and AI. Choose cloud for speed or self-hosted for control and residency, and if you self-host, protect the encryption key, use PostgreSQL, HTTPS and backups. Master items and expressions, and debug with pinned data and executions. Your next step: build the first workflow in the lesson text, a webhook that normalizes an email, branches, appends a row and responds, then test it with curl and publish it.

### Try this now

Try this now. If you don't have n8n yet, start a cloud trial or run the Docker command from the lesson text. Build the webhook workflow: normalize the email, branch with an IF node, append a row to a sheet, and respond with ok true. Test it with curl, check the execution list, pin the webhook data and add one more node. Then publish the workflow and call the production URL.

## Key takeaways

- n8n is a fair-code, node-based automation platform available as cloud or self-hosted; n8n 2.0 (Dec 2025) emphasized security and reliability.
- Self-hosting enables data residency and control but requires PostgreSQL, HTTPS, backups, version pinning and a protected N8N_ENCRYPTION_KEY.
- Nodes pass items (JSON arrays); expressions like {{ $json.email }} and $('Node').item reference data.
- Debug with pinned data, step execution and the executions list; name nodes clearly.

## Try it

Build the webhook workflow from the hands-on steps (normalize, branch, append row, respond). Test it with curl, then publish it and test the production URL.

- [Previous: Triggers, actions and data mapping](https://optimizeall.com/learn/no-code-ai-automation-n8n-make-zapier/triggers-actions-and-data-mapping)
- [Next: n8n AI: the AI Agent node, LangChain nodes and MCP](https://optimizeall.com/learn/no-code-ai-automation-n8n-make-zapier/n8n-ai-agents-and-langchain-nodes)
- [All lessons of AI Automation with n8n, Make and Zapier](https://optimizeall.com/learn/no-code-ai-automation-n8n-make-zapier)
