What is n8n?
n8n (pronounced “n-eight-n”) is a workflow automation platform that combines the speed of no-code visual builders with the flexibility of full-code development. The name is a numeronym derived from “nodemation” — a fusion of node and automation, with the 8 representing the eight letters between the first and last “n”.
Think of it as Zapier or Make.com, but self-hostable, developer-friendly, and with native AI agent capabilities built in.
Why n8n Over Zapier or Make?
| Feature | n8n | Zapier | Make (Integromat) |
|---|---|---|---|
| Self-hosting | ✅ Free Community Edition | ❌ Cloud only | ❌ Cloud only |
| Pricing model | Per workflow execution (unlimited steps) | Per task (each step = 1 task) | Per operation |
| Code in workflows | ✅ JavaScript & Python nodes | ❌ Limited | ⚠️ Limited |
| AI agent builder | ✅ Native, 70+ AI nodes | ⚠️ Basic | ⚠️ Basic |
| Custom nodes | ✅ Build your own | ❌ | ❌ |
| Data control | ✅ Your infrastructure | ❌ Their cloud | ❌ Their cloud |
| Open source | ✅ Fair-code licensed | ❌ | ❌ |
| Free tier | ✅ Self-hosted = free unlimited | ⚠️ Limited free tier | ⚠️ Limited free tier |
| Integrations | 400+ nodes | 7,000+ apps | 1,500+ apps |
| Cost at scale | Very low (self-hosted) | Expensive (per-task pricing) | Moderate |
The key difference: Zapier and Make charge per step/operation. A workflow with 10 steps costs 10 tasks. n8n charges per execution (one complete workflow run) regardless of how many steps it has. Self-hosted n8n Community Edition is free with unlimited executions.
What n8n is Good For
- Automating repetitive tasks — sync data between apps, send notifications, process files
- API orchestration — connect multiple APIs into complex multi-step workflows
- AI agent workflows — build RAG chatbots, autonomous agents, and AI-powered automations
- Data pipelines — ETL operations, data transformation, database syncing
- DevOps automation — CI/CD triggers, infrastructure monitoring, alerting
- Business operations — lead processing, email campaigns, CRM sync, reporting
Who Uses n8n?
n8n is designed for technical users — developers, DevOps engineers, sysadmins, and technically-minded power users. You don’t need to be a developer to use it, but comfort with JSON, basic JavaScript, and API concepts will take you much further.
Pricing: n8n Cloud vs Self-Hosted
n8n Cloud (Hosted by n8n)
| Plan | Price | Executions/mo | Concurrent | Best For |
|---|---|---|---|---|
| Starter | $20/mo (billed annually) | 2,500 | 5 | Getting started, testing |
| Pro | $50/mo (billed annually) | 10,000 | 20 | Solo builders, small teams |
| Business | $800/mo (billed annually) | 40,000 | 30+ | Companies <100 employees |
| Enterprise | Contact sales | Custom | 200+ | Large orgs, compliance needs |
What counts as an execution? One complete run of a workflow from start to finish. It doesn’t matter how many steps/nodes the workflow has — a 1-node workflow and a 50-node workflow both count as 1 execution.
Self-Hosted
| Edition | Cost | Key Features |
|---|---|---|
| Community | Free | Full core product, unlimited workflows & executions, 400+ nodes, AI nodes, code nodes |
| Business | $800/mo | Adds SSO/SAML, version control via Git, multi-environment, advanced roles, scaling |
| Enterprise | Custom | Adds external secret store, log streaming, extended data retention, dedicated SLA |
Key insight: The Community Edition is remarkably capable. It has all 400+ integration nodes, AI agent nodes, code nodes, webhooks — everything you need to build production automations. The paid tiers are mainly about team collaboration, SSO, and enterprise governance, not about unlocking core automation features.
Cost Comparison at Scale
| Scenario | n8n Self-Hosted | n8n Cloud Pro | Zapier |
|---|---|---|---|
| 1,000 executions/mo, 10 steps each | Free (just server cost ~$5-10/mo) | $50/mo | ~$50-100/mo (10K tasks) |
| 10,000 executions/mo, 20 steps each | Free (just server cost) | $50/mo | ~$200-500/mo (200K tasks) |
| 50,000 executions/mo, 15 steps each | Free (just server cost) | $800/mo (Business) | ~$500-1,500/mo |
Bottom line: Self-hosting n8n on a $5-10/month VPS gives you unlimited automations that would cost hundreds or thousands per month on Zapier.
Deployment: How to Host n8n
Hosting Options Overview
| Method | Difficulty | Cost | Best For |
|---|---|---|---|
| n8n Cloud | Easiest | $20-800/mo | Non-technical users, no server management |
| Docker (single container) | Easy | ~$5-10/mo VPS | Quick self-hosting, testing |
| Docker Compose | Medium | ~$5-20/mo VPS | Production self-hosting with PostgreSQL + SSL |
| npm | Medium | Your machine | Local development only |
| Kubernetes | Advanced | Varies | Enterprise scaling, high availability |
| Cloud providers | Medium | Varies | AWS, Azure, GCP, DigitalOcean, Hetzner |
Option 1: n8n Cloud (Easiest)
Sign up at n8n.io/cloud. No server, no setup. Choose a plan, get a URL, start building. Data stored in EU (Frankfurt, Germany).
Pros: Zero maintenance, automatic updates, managed infrastructure Cons: Monthly cost, data not on your infrastructure, execution limits
Option 2: Docker Compose (Recommended for Self-Hosting) ⭐
This is the sweet spot — full control, production-ready, with PostgreSQL for the database and Traefik for automatic SSL.
Prerequisites
- A Linux server (VPS or local machine)
- Docker and Docker Compose installed
- A domain name with DNS access
Step-by-Step
1. Install Docker and Docker Compose:
# Verify Docker is installed
docker --version
docker compose version
2. Set up DNS:
Create an A record pointing your subdomain to your server’s IP:
| Record Type | Name | Destination |
|---|---|---|
| A | n8n | your.server.ip.address |
3. Create project directory and .env file:
mkdir n8n-compose
cd n8n-compose
mkdir local-files
Create a .env file:
# Your domain
DOMAIN_NAME=example.com
SUBDOMAIN=n8n
# Result: https://n8n.example.com
# Timezone (affects cron schedules)
GENERIC_TIMEZONE=Australia/Melbourne
# Email for SSL certificate
SSL_EMAIL=you@example.com
4. Create compose.yaml:
services:
traefik:
image: "traefik"
restart: always
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
- "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
- "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- traefik_data:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
labels:
- traefik.enable=true
- traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
- traefik.http.routers.n8n.tls=true
- traefik.http.routers.n8n.entrypoints=websecure
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
- traefik.http.services.n8n.loadbalancer.server.port=5678
environment:
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=443
- N8N_PROTOCOL=https
- NODE_ENV=production
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- N8N_ENCRYPTION_KEY=your-random-64-char-string-here
volumes:
- n8n_data:/home/node/.n8n
- ./local-files:/files
volumes:
n8n_data:
traefik_data:
5. Generate an encryption key:
openssl rand -hex 32
Add the output to your .env file as N8N_ENCRYPTION_KEY.
⚠️ Critical: Save this key somewhere safe. If you lose it, all stored credentials become permanently undecryptable after a restart.
6. Start n8n:
docker compose up -d
7. Access n8n:
Navigate to https://n8n.example.com and create your admin account. Done!
Option 3: Docker Compose with PostgreSQL (Production) ⭐⭐
For production workloads, replace the default SQLite with PostgreSQL for better performance and reliability. Add this to your compose.yaml:
postgres:
image: postgres:16-alpine
restart: always
environment:
- POSTGRES_DB=n8n
- POSTGRES_USER=n8n
- POSTGRES_PASSWORD=your-strong-password
volumes:
- postgres_data:/var/lib/postgresql/data
n8n:
# ... same as above, plus:
environment:
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_PASSWORD=your-strong-password
depends_on:
- postgres
volumes:
n8n_data:
traefik_data:
postgres_data:
Option 4: Quick Local Docker (Testing)
For local testing without SSL or a domain:
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
Then open http://localhost:5678.
Key Concepts: How n8n Works
The Building Blocks
| Concept | What It Is | Analogy |
|---|---|---|
| Workflow | A complete automation — a series of connected nodes | A recipe |
| Node | A single step in a workflow (trigger, action, logic, etc.) | One instruction in a recipe |
| Trigger | The first node that starts a workflow | ”When the oven is ready…” |
| Connection | The link between nodes that passes data | The flow of ingredients |
| Item | A single piece of data flowing through the workflow | One egg |
| Expression | Dynamic value referencing data from other nodes | {{$json.fieldName}} |
| Execution | One complete run of a workflow from start to finish | Cooking one batch |
How Data Flows
Trigger Node → Node A → Node B → Node C → Output
↓ ↓ ↓ ↓
Starts the Receives Receives Receives
workflow items items items
from A from B from C
Each node receives items (JSON objects) from the previous node, processes them, and passes results to the next node. A single execution can process multiple items — if a trigger receives 10 emails, the workflow runs 10 times through the pipeline.
Node Types
| Type | What It Does | Examples |
|---|---|---|
| Trigger | Starts the workflow | Schedule, Webhook, Polling, Manual |
| Action | Performs an operation | Send email, Create record, HTTP request |
| Transform | Modifies data | Set, Edit Fields, Filter, Sort, Merge |
| Logic | Controls flow | If, Switch, Loop, Error Trigger |
| Code | Run custom code | Function (JavaScript), Python |
| AI | AI/LLM operations | AI Agent, OpenAI, Anthropic, LangChain |
Expressions
Expressions let you dynamically reference data from other nodes. They use the {{ }} syntax:
{{ $json.fieldName }} → Access a field from current item
{{ $node["NodeName"].json.field }} → Access data from a specific node
{{ $now }} → Current timestamp
{{ $workflow.id }} → Current workflow ID
JSON: The Universal Language
n8n is built on JSON. Every item that flows through a workflow is a JSON object:
{
"name": "John",
"email": "john@example.com",
"order_total": 150.00,
"items": ["widget", "gadget"]
}
Understanding JSON is essential for n8n. If you’re not comfortable with JSON, spend an hour learning the basics — it’ll make everything else much easier.
AI in n8n: Building AI Agent Workflows
n8n has 70+ AI nodes built in, making it one of the most powerful platforms for building AI agent workflows. It integrates natively with LangChain concepts.
AI Node Categories
| Category | Nodes | What You Can Build |
|---|---|---|
| AI Agent | AI Agent, Agent Memory, Agent Tools | Autonomous agents that reason and act |
| Chat Models | OpenAI, Anthropic, Google Gemini, Ollama, Groq | Connect to any LLM |
| Memory | Window Buffer, Postgres, Redis | Give agents conversation memory |
| Tools | Calculator, HTTP Request, Custom Code, Database | Let agents take actions |
| RAG | Embeddings, Vector Store, Document Loader | Build retrieval-augmented generation |
| Output Parsers | Structured Output, Auto-fixing | Force structured LLM responses |
Example: RAG Chatbot Workflow
Webhook (receives question)
↓
AI Agent
├── Chat Model: OpenAI GPT-4
├── Memory: Postgres (conversation history)
└── Tools:
├── Vector Store (search your documents)
└── HTTP Request (look up external data)
↓
Respond to Webhook (sends answer)
Example: Email Triage Agent
Schedule Trigger (every 5 minutes)
↓
Read Emails (IMAP node)
↓
AI Agent (classifies each email)
├── Chat Model: Claude
├── Memory: Window Buffer
└── Tools:
├── Slack (notify team of urgent emails)
├── Google Sheets (log all emails)
└── HTTP Request (create ticket in helpdesk)
↓
Move Email to folder (based on AI classification)
Supported AI Providers
| Provider | Node | Use Case |
|---|---|---|
| OpenAI | GPT-4, GPT-4o, o1, o3 | General purpose, most popular |
| Anthropic | Claude 3.5/4 Sonnet, Opus | Long context, reasoning |
| Gemini Pro, Flash | Multimodal | |
| Ollama | Local LLMs (Llama, Mistral, etc.) | Privacy, no API cost |
| Groq | Fast inference | Speed-critical |
| Mistral | Mistral models | Open weights |
| Cohere | Command R+ | Enterprise |
Pro tip: Use Ollama with n8n to connect to your local LLM (like the Mac Mini M4 Pro we discussed!). This gives you fully private AI automation with zero API costs.
Environment Variables: The Important Ones
| Variable | Purpose | Example |
|---|---|---|
N8N_HOST | The hostname n8n runs on | n8n.example.com |
N8N_PORT | The port (use 443 with SSL) | 443 |
N8N_PROTOCOL | http or https | https |
N8N_ENCRYPTION_KEY | Encrypts stored credentials | Random 64-char hex string |
GENERIC_TIMEZONE | Timezone for schedule triggers | Australia/Melbourne |
DB_TYPE | Database type | sqlitedb or postgresdb |
DB_POSTGRESDB_HOST | PostgreSQL host | postgres |
DB_POSTGRESDB_PASSWORD | PostgreSQL password | Strong password |
N8N_BASIC_AUTH_ACTIVE | Enable basic auth | true |
N8N_BASIC_AUTH_USER | Basic auth username | admin |
N8N_BASIC_AUTH_PASSWORD | Basic auth password | Strong password |
EXECUTIONS_DATA_PRUNE | Auto-delete old execution logs | true |
EXECUTIONS_DATA_MAX_AGE | Days to keep execution logs | 30 |
N8N_METRICS | Enable Prometheus metrics | true |
VPS Recommendations for Self-Hosting
| Provider | Minimum Spec | Price | Notes |
|---|---|---|---|
| Hetzner Cloud | CX22 (2 vCPU, 4GB RAM) | ~€4-6/mo | Best value, EU servers |
| DigitalOcean | Basic Droplet (1 vCPU, 2GB) | ~$12/mo | Simple, good docs |
| Vultr | Cloud Compute (1 vCPU, 2GB) | ~$12/mo | Similar to DO |
| AWS EC2 | t3.small (2 vCPU, 2GB) | ~$15-20/mo | Overkill but familiar |
| Oracle Cloud | Always Free (4 vCPU, 24GB) | Free | ARM instance, great if available |
| Home server | Your hardware | Free | You already have hardware |
Minimum specs: 1 vCPU, 1GB RAM for light workloads (a few workflows, low frequency). 2 vCPU, 4GB RAM for production with PostgreSQL and multiple active workflows.
Common Use Cases
1. Sync Data Between Apps
Schedule (daily at 9am)
↓
Read from Google Sheets
↓
Transform data (Filter, Set fields)
↓
Write to Notion / Airtable / Database
2. Webhook-Triggered API
Webhook (receives POST request)
↓
Process payload (validate, transform)
↓
Create record in database
↓
Send Slack notification
↓
Respond to webhook with result
3. Scheduled AI Content Generation
Schedule (every Monday 8am)
↓
HTTP Request (fetch this week's news/articles)
↓
AI Agent (summarise into newsletter format)
├── Chat Model: GPT-4 or Claude
└── Memory: Window Buffer
↓
Send via Email (Gmail / SMTP)
↓
Post to Slack
4. Home Automation Bridge
Webhook (from Home Assistant)
↓
Switch (based on event type)
├── Motion detected → Send Telegram notification + log to Sheets
├── Door opened → Send push notification + trigger camera recording
└── Temperature alert → Adjust thermostat + send email
5. Lead Processing Pipeline
Webhook (from website form)
↓
AI Agent (enrich & score the lead)
├── Chat Model: Claude
└── Tools: HTTP Request (lookup company), Calculator (score)
↓
Switch (based on lead score)
├── Hot lead → Create CRM record + notify sales team in Slack
├── Warm lead → Add to email sequence
└── Cold lead → Log for analytics
Best Practices
Workflow Design
| Practice | Why | How |
|---|---|---|
| Start simple, add complexity gradually | Easier to debug | Build core flow first, add branches/conditions after |
| Use the Test Workflow button | Verify each step works | Click “Test step” on each node to see input/output |
| Add error handling | Prevent silent failures | Connect an Error Trigger node to notify you on failure |
| Name your nodes | Readability | Click the node name and give it a descriptive name |
| Use Set/Edit Fields nodes | Clean data | Don’t pass messy data between nodes — explicitly set what you need |
| Avoid overly long workflows | Maintainability | Break into sub-workflows using the Execute Workflow node |
Security
| Practice | Why |
|---|---|
| Set N8N_ENCRYPTION_KEY before first run | Protects all stored credentials |
| Enable basic auth or put behind a reverse proxy | Prevents unauthenticated access |
| Use environment variables for secrets | Don’t hardcode API keys in workflows |
| Restrict webhook URLs | Don’t expose sensitive workflows to the public internet |
| Regular backups of n8n_data volume | Includes workflows, credentials, and execution history |
| Keep n8n updated | Security patches and new features |
Performance
| Practice | Why |
|---|---|
| Use PostgreSQL for production | SQLite is fine for testing but doesn’t scale |
| Enable execution pruning | Old execution logs consume disk space |
| Batch API calls where possible | Fewer executions = faster workflows |
| Use the Loop node sparingly | Each iteration is an execution step — can be slow |
| Set execution timeouts | Prevent runaway workflows from consuming resources |
Backup Strategy
# Backup n8n data volume
docker run --rm -v n8n_data:/data -v $(pwd):/backup \
alpine tar czf /backup/n8n-backup-$(date +%Y%m%d).tar.gz -C /data .
# Backup PostgreSQL
docker exec n8n-postgres pg_dump -U n8n n8n > n8n-db-backup-$(date +%Y%m%d).sql
Your 30-Day n8n Learning Plan
Week 1: Basics
| Day | Task | Output |
|---|---|---|
| 1 | Deploy n8n locally (Docker quick start) | Running instance at localhost:5678 |
| 2 | Complete the n8n beginner course | First workflow built |
| 3 | Build a simple workflow: Schedule trigger → HTTP Request → Set fields → Send email | Working notification workflow |
| 4 | Learn expressions — use {{$json.field}} to pass data between nodes | Understanding of data flow |
| 5 | Explore the workflow templates — import 3 templates | 3 working workflows from templates |
| 6 | Add error handling to your workflows (Error Trigger node) | Self-healing workflows |
| 7 | Deploy n8n to a VPS with Docker Compose + Traefik SSL | Production instance running |
Week 2: Intermediate
| Day | Task | Output |
|---|---|---|
| 8 | Build a webhook-triggered workflow (receive data, process, respond) | API workflow |
| 9 | Use the IF node for branching logic | Conditional workflow |
| 10 | Use the Loop node to process multiple items | Batch processing workflow |
| 11 | Integrate with an external API (Slack, Gmail, Google Sheets) | Real integration workflow |
| 12 | Write custom JavaScript in a Code node | Custom data transformation |
| 13 | Set up PostgreSQL as the database | Production database config |
| 14 | Add cron-scheduled workflows for recurring tasks | Automated daily reports |
Week 3: AI Workflows
| Day | Task | Output |
|---|---|---|
| 15 | Connect an LLM (OpenAI or Anthropic) to n8n | First AI-powered workflow |
| 16 | Build a simple chatbot using AI Agent + Memory | Chatbot workflow |
| 17 | Add tools to your AI agent (Calculator, HTTP Request) | Agent with tools |
| 18 | Build a RAG workflow with vector store + embeddings | Document Q&A workflow |
| 19 | Connect Ollama for local LLM inference | Private AI workflow (no API costs!) |
| 20 | Build an email triage agent (read, classify, route) | AI automation in production |
| 21 | Add structured output parsing to force JSON from LLM | Reliable AI output |
Week 4: Production
| Day | Task | Output |
|---|---|---|
| 22 | Set up monitoring and alerts for failed workflows | Self-healing system |
| 23 | Configure execution pruning and data retention | Clean, maintainable instance |
| 24 | Build a sub-workflow using Execute Workflow node | Modular workflow architecture |
| 25 | Set up backup strategy (automated daily backups) | Backup script running |
| 26 | Build a real production workflow for your business | One real automation live |
| 27 | Optimise workflow performance (batching, pruning) | Efficient workflows |
| 28 | Document your workflows and create a runbook | Documentation |
| 29 | Explore the n8n community forum for advanced patterns | Community knowledge |
| 30 | Plan your next 5 workflows | Automation roadmap |
Learning Resources
Official Resources
| Resource | Link | What You’ll Learn |
|---|---|---|
| n8n Docs | docs.n8n.io | Complete reference — nodes, config, deployment |
| n8n Learning Paths | docs.n8n.io/learning-paths | Interactive courses with hands-on exercises |
| n8n Workflow Templates | n8n.io/workflows | 1,000+ pre-built workflows you can import |
| n8n Community Forum | community.n8n.io | Q&A, tutorials, advanced patterns |
| n8n YouTube | youtube.com/@n8n-io | Official tutorials and deep dives |
| n8n GitHub | github.com/n8n-io/n8n | Source code, issues, contributing |
YouTube Courses
| Course | Length | Best For |
|---|---|---|
| ”Master n8n in 2 Hours” | 2 hours | Complete beginner crash course |
| ”n8n Tutorial – Zero to Hero” by Marconi | 4 hours | Comprehensive deep dive |
| ”Self-hosted automation for EVERYTHING!“ | 30 min | Quick overview + deployment |
| ”Agentic RAG, Open LLMs, FREE Embeddings” | 45 min | AI agent workflows |
Key Documentation Pages
| Page | What It Covers |
|---|---|
| Build your first workflow | Step-by-step workflow creation |
| Integrate AI | AI agent and LLM integration |
| Use Docker Compose | Production deployment guide |
| Environment variables | All configuration options |
| Community Edition features | What’s in the free tier |
n8n Vocabulary Glossary
| Term | Definition |
|---|---|
| Workflow | A series of connected nodes that automate a task |
| Node | A single step in a workflow (trigger, action, transform, logic, or code) |
| Trigger | The first node that starts a workflow (schedule, webhook, polling, manual) |
| Item | A single JSON object that flows through the workflow |
| Execution | One complete run of a workflow from start to finish |
| Expression | Dynamic value using {{ }} syntax to reference data from other nodes |
| Connection | The link between two nodes that passes items |
| Credential | Stored authentication info for an external service (API key, OAuth, etc.) |
| Sub-workflow | A workflow called by another workflow using the Execute Workflow node |
| Pin | Fix data on a node for testing — pinned data won’t change between test runs |
| Fair Code | n8n’s license — source is open, self-hosting is free, but commercial redistribution requires a license |
| Queue mode | Running multiple n8n instances with a shared database for scaling (Business/Enterprise) |
Final Thoughts
n8n is the most powerful workflow automation tool available for self-hosters and technical users. It hits a unique sweet spot: visual enough for rapid prototyping, powerful enough for production systems, and flexible enough to handle anything from simple notifications to autonomous AI agents.
The combination of n8n + a local LLM (Ollama) + your self-hosted infrastructure is arguably the most cost-effective and privacy-respecting automation stack available today. Zero per-execution costs, zero API costs for AI, and full control over your data.
Start with the Docker quick start, build a few simple workflows, and work your way up to AI agents. The platform rewards curiosity — every workflow you build teaches you something new about what’s possible.
This guide was compiled from n8n official documentation, community resources, and current deployment practices as of July 2026. n8n version at time of writing: stable 2.29.8. Last updated: July 2026.