Updated April 2026 20 min read Open Source AI Native

n8n
The complete guide

Open-source automation without limits. 400+ Integrations, built-in AI Nodes, Self-hosting and full JavaScript — everything you need to build professional-grade automations, for free.

400+
Integrations
Free
Self-Hosted
AI
Native
MIT
Open source

What is n8n and why is it different?

n8n (pronounced "n-eight-n") is an open-source visual automation tool that lets you connect apps, build complex Workflows, and run AI Agents — all in a drag-and-drop interface. Unlike Zapier and Make.com, which run everything in their cloud for a monthly fee, n8n enables full Self-hosting: your data stays with you, and Executions are free forever.

n8n's philosophy is "visual-first, code when needed" — most automations are built visually, but when you need complex logic you can drop full JavaScript into a Code Node. That's what sets it apart from the competition: not a choice between no-code and code, but both together.

n8n vs Zapier vs Make.com — a quick comparison table

Criterion n8n Make.com Zapier
Self-hosted cost Free forever 🏆 Not available Not available
Cloud cost (base) $20/month $9/month 🏆 $19.99/month
Ease of use Medium Very easy 🏆 Easy
Logical flexibility Very high 🏆 Medium Low
Full JavaScript Yes 🏆 Limited No
Built-in AI Nodes Yes — LangChain 🏆 Limited Basic
Data privacy Full (Self-hosted) 🏆 Cloud only Cloud only
Number of Integrations 400+ 2,000+ 7,000+ 🏆
The anatomy of a Workflow
bolt
Trigger
tune
Process
filter_alt
IF/Switch
send
Action
info
When to choose n8n?

n8n wins when you have many Executions, sensitive data that cannot be sent to an external cloud, or when you need complex logic with JavaScript. Make.com / Zapier are better when you want to start fast with 200+ ready-made integrations.

Installation — 3 options

n8n can be installed in three main ways. For most users Docker is the best choice — it is isolated, easy to update, and works identically on every operating system.

Option 1 — Docker (recommended for servers)

# Basic run — n8n available at http://localhost:5678
docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  n8nio/n8n

Option 2 — Docker Compose (for production)

version: "3"
services:
  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "5678:5678"
    volumes:
      - ~/.n8n:/home/node/.n8n
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=your_secure_password
      - N8N_ENCRYPTION_KEY=your_32_char_key
      - N8N_HOST=your-domain.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https

Option 3 — npm (for local development)

# Requirement: Node.js 18+
npx n8n

# or global installation
npm install n8n -g
n8n start

# open: http://localhost:5678
app.n8n.cloud — Workflow Editor
n8n Workflow Canvas
webhook
Webhook
http
HTTP
transform
Set
mail
Gmail
✓ Executed 4 items
play_circle
n8n Automation Tutorial — beginner to advanced
YouTube • search for tutorials
open_in_new
cloud
Free Self-hosting — Railway.app

Deploy n8n to Railway.app for free (500 hours/month). Search "n8n" in the Railway template library and within 2 minutes you'll have a working n8n environment with a free public URL.

Core concepts

Before building your first Workflow, it's important to understand n8n's basic building blocks.

Triggers — what starts the Workflow?

Nodes — the building blocks of the Workflow

Data Flow — how does data flow?

Each Node receives an array of Items — each Item is a JSON Object. If the previous Node returned 5 items, the next Node processes each of them separately (unless Merge). This is what's called an "implicit loop" — an automatic loop.

Expressions — accessing data

{{ $json.email }}                        // the email field from the current Item
{{ $json.user.name }}                    // nested field
{{ $now.format('YYYY-MM-DD') }}         // today's date
{{ $items("Gmail Trigger")[0].json.subject }} // a field from a specific Node
{{ $env.MY_API_KEY }}                    // environment variable
{{ $json.price * 1.17 }}                // a math calculation
{{ $json.text.toUpperCase() }}          // string operations
app.n8n.cloud — Node Inspector (JSON Output)
OUTPUT — Item 1 of 3
{
  "id": 1,
  "email": "user@example.com",
  "name": "John Doe",
  "company": "StartupXYZ",
  "createdAt": "2026-04-16T09:00:00Z",
  "tags": ["lead", "enterprise"]
}
$json.email → "user@example.com"

IF / Switch — Branching Logic

First Workflow — step by step

We'll build a full Workflow: a Webhook receives data → sends an HTTP Request to an external API → processes the response → sends an email with the result.

The Workflow flow
Webhook
HTTP Request
Set (Transform)
Gmail Send

Step 1 — Webhook Trigger

Click "+ Add Node" → search "Webhook" → select Webhook. Configure:

n8n will give you a URL: https://your-n8n.com/webhook/my-first-workflow

Step 2 — HTTP Request Node

Add a Node → HTTP Request. Configure:

Method: GET
URL: https://jsonplaceholder.typicode.com/posts/{{ $json.postId }}
# postId comes from the Webhook body

Step 3 — Set Node (Transform)

Add a Set Node to shape the data:

# Define new Fields:
subject:  "New post: {{ $json.title }}"
body:     "{{ $json.body }}"
postId:   {{ $json.id }}
fetchedAt: {{ $now.toISO() }}

Step 4 — Gmail Node (Send Email)

Step 5 — Test!

curl -X POST https://your-n8n.com/webhook/my-first-workflow \
  -H "Content-Type: application/json" \
  -d '{"postId": 1, "recipientEmail": "you@example.com"}'
bug_report
Tip: Test Mode

Click "Test Workflow" in n8n before Activation. The Webhook will be available for 120 seconds and you'll see the data flow from Node to Node in green.

AI & LLM Nodes — n8n as an AI Orchestrator

This is the most important section for our readers. n8n v1.0+ includes a full LangChain integration with an AI Agent Node, Vector Store Nodes, Embeddings and more — all visually, without a single line of code (if you don't want to).

AI Agent Node — the heart of n8n AI

The AI Agent Node is a LangChain Agent that runs directly in n8n. It receives a Chat Message, decides which Tools to use, runs them, and returns an answer. Tools are other Nodes in n8n — Google Search, Calculator, HTTP Request, Notion, and more.

AI Agent Workflow
Chat Trigger
AI Agent
🔧 Google Search
🔧 Calculator
🔧 Notion Write
Response

All the AI Nodes in n8n

app.n8n.cloud — AI Agent Node Configuration
smart_toy
AI Agent
LangChain ReAct Agent
Chat Model OpenAI GPT-4o
Memory Window Buffer Memory
System Message
You are an AI assistant that manages Tasks. Use the available tools to answer accurately.
Connected Tools
Search Notion +3

Code Node — AI Processing with JavaScript

When you need logic the built-in Nodes don't provide, the Code Node allows full JavaScript with access to the entire n8n API:

// Code Node — custom AI processing
const items = $input.all();
const results = [];

for (const item of items) {
  const response = await $http.request({
    method: 'POST',
    url: 'https://api.openai.com/v1/chat/completions',
    headers: {
      Authorization: `Bearer ${$env.OPENAI_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: {
      model: 'gpt-4o',
      messages: [
        {
          role: 'system',
          content: 'You help analyze lead data. Return JSON only.'
        },
        {
          role: 'user',
          content: `Analyze the following lead:\n${JSON.stringify(item.json)}`
        }
      ],
      response_format: { type: 'json_object' }
    }
  });

  const analysis = JSON.parse(
    response.choices[0].message.content
  );

  results.push({
    json: {
      ...item.json,
      aiScore: analysis.score,
      aiSummary: analysis.summary,
      nextAction: analysis.recommendedAction
    }
  });
}

return results;
play_circle
n8n AI Agents — full LangChain Nodes
YouTube • AI Agent + Vector Store + Memory
open_in_new

Popular integrations

n8n comes with 400+ Native Nodes and thousands more integrations via the HTTP Request Node (any API with documentation).

app.n8n.cloud — Node Search
search Search integrations...
📧
Gmail
📊
Sheets
💬
Slack
🗄️
Notion
🤖
OpenAI
🔗
HTTP API

Google Workspace

CRM & Business Tools

Communication

E-commerce & Dev

Advanced techniques

Sub-workflows — Reusable Components

A Sub-workflow is a Workflow called from another Workflow. It enables modularity — one "Send Email" Sub-workflow that all other Workflows call. One change updates them all.

# To run a Sub-workflow:
# Add a Node: "Execute Workflow"
# Workflow: select the Sub-workflow
# Wait for Sub-workflow Completion: true
# Parameters: { "email": "{{ $json.email }}" }

Webhooks with Authentication

# Header Authentication
Authorization: Bearer {{ $env.WEBHOOK_SECRET }}

# Basic Auth
Username: {{ $env.WEBHOOK_USER }}
Password: {{ $env.WEBHOOK_PASS }}

# HMAC Signature Verification (Code Node)
const crypto = require('crypto');
const signature = $request.headers['x-hub-signature-256'];
const expectedSig = 'sha256=' + crypto
  .createHmac('sha256', $env.WEBHOOK_SECRET)
  .update(JSON.stringify($request.body))
  .digest('hex');

if (signature !== expectedSig) {
  throw new Error('Invalid webhook signature');
}

Database Nodes

Triggering Workflows Programmatically

# Trigger a Webhook from the Terminal
curl -X POST https://your-n8n.com/webhook/my-workflow \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_SECRET" \
  -d '{"action": "process", "userId": 123, "data": "hello"}'

# Trigger via the n8n REST API
curl -X POST https://your-n8n.com/api/v1/workflows/1/activate \
  -H "X-N8N-API-KEY: your-api-key"

Queue Mode — Scaling for high volume

For sites with thousands of Executions per hour, n8n supports Queue Mode with Redis:

# .env for Queue Mode
EXECUTIONS_MODE=queue
QUEUE_BULL_REDIS_HOST=redis
QUEUE_BULL_REDIS_PORT=6379
N8N_CONCURRENCY_PRODUCTION_LIMIT=10

# Docker Compose with Redis
services:
  redis:
    image: redis:7-alpine
    restart: always
  n8n-main:
    image: n8nio/n8n
    environment:
      - EXECUTIONS_MODE=queue
  n8n-worker:
    image: n8nio/n8n
    command: n8n worker
    scale: 3  # 3 worker processes
security
Self-Hosting — Security Checklist

1. Set N8N_ENCRYPTION_KEY (32+ characters) before the first deployment. 2. Enable Basic Auth or a Reverse Proxy with HTTPS. 3. Back up ~/.n8n daily — where all the Workflows live. 4. Set N8N_LOG_LEVEL=info and monitor Error logs.

n8n vs Make.com vs Zapier — a full analysis

All the tools are good — the question is what your case is. Here's how to decide:

Situation Choose n8n Choose Make.com Choose Zapier
Tight budget ✓ Self-hosted free
Sensitive data ✓ Data at home
Many integrations 400+ 2,000+ ✓ 7,000+
Fast start ✓ Easy onboarding
Complex AI Agents ✓ LangChain built-in
Complex JavaScript ✓ Full JS
Completely non-technical ✓ The friendliest UI
Enterprise + Support ✓ Enterprise support
lightbulb
The right strategy

Most businesses start with Make.com (easy to start) and move to n8n Self-hosted when Executions raise the pricing, or when they need advanced AI Agents. There's no problem holding both.

5 ready-to-build projects

5 real Workflows ready to copy, ordered by difficulty:

1
Automatic Lead Capture Easy

Every website form submission → Google Sheets → a welcome email → Mailchimp

Typeform Trigger Google Sheets Append Gmail Send Mailchimp Add
2
Social Media Autopilot Medium

RSS Feeds → AI summarizes → an automatic scheduled LinkedIn + Twitter Post

Schedule (07:00) RSS Read AI Agent (Summarize) LinkedIn + Twitter
3
WhatsApp Customer Support Bot Medium

WhatsApp message → AI classifies and replies → Notion Ticket → Slack Alert to the team

WhatsApp Webhook AI Classify Notion + Slack Reply
4
AI Email Assistant Advanced

Gmail → Claude analyzes and drafts a reply → saves a Draft → Human-in-the-loop approval

Gmail Trigger Claude Analyze Draft Response Human Review
5
Full AI Sales Pipeline Advanced

A Lead comes in → AI Qualify → CRM → Slack Alert → AI Personalized Email Sequence

Webhook Lead AI Score Lead HubSpot CRM Email Sequence

Cheat sheet — Quick Reference

Common Expressions

// accessing data
{{ $json.fieldName }}                    // a Basic field
{{ $json.nested.field }}                // nested
{{ $json.array[0].value }}              // first in the array

// date and time
{{ $now.toISO() }}                      // ISO format
{{ $now.format('DD/MM/YYYY') }}         // day/month/year format
{{ $now.minus({days: 7}).toISO() }}     // one week back

// files and environment
{{ $env.MY_SECRET_KEY }}                // env variable
{{ $binary.data }}                      // binary data (files)

// another Node
{{ $items("Node Name")[0].json.field }} // from a specific Node
{{ $("Node Name").first().json.field }} // shortcut

// Conditional
{{ $json.score > 80 ? "VIP" : "Standard" }}  // ternary

Common Cron Expressions

Expression Meaning
0 9 * * 1-5Every workday at 09:00
0 */2 * * *Every two hours
*/15 * * * *Every 15 minutes
0 8 1 * *The 1st of the month at 08:00
0 23 * * 0Every Sunday at 23:00
0 0 * * *Midnight every night

Common Node Patterns

# Pattern 1 — Enrich Data
HTTP Request (GET /users/{id}) → Set (merge fields) → output

# Pattern 2 — Filter + Route
IF (score > 80) → [True] Premium path / [False] Standard path

# Pattern 3 — Batch Processing
Split In Batches (size: 10) → HTTP Request → Wait (1s) → Merge

# Pattern 4 — Error Handling
Try: [Main Workflow] → Catch: Error Trigger → Slack Alert + Retry

# Pattern 5 — RAG Pipeline
Document Loader → Text Splitter → Embeddings → Vector Store Insert

Webhook Testing Tips

Important Environment Variables

N8N_ENCRYPTION_KEY=32_char_secret_key    # required!
N8N_HOST=your-domain.com
N8N_PORT=5678
N8N_PROTOCOL=https
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=secure_password
N8N_LOG_LEVEL=info                        # debug | info | warn | error
EXECUTIONS_DATA_SAVE_ON_SUCCESS=all       # keep history
EXECUTIONS_DATA_MAX_AGE=168               # keep 7 days (hours)
rocket_launch

The next step

Now that you know n8n — the natural next step is to integrate AI Agents. n8n + the Claude API = an AI Agent that can act in every business tool you've connected. The AI Agents guide will help you build a real Agent with Tool Use and RAG.