n8n Complete Guide 2026: Build AI Workflows & Automations Without Code

n8n is the open-source workflow automation platform that lets you connect any app, build AI agent pipelines, and automate repetitive tasks — all with a visual editor you can self-host on your own server or run in the cloud in minutes.

1. What Is n8n?

n8n (pronounced "n-eight-n" or "nodemation") is a source-available, self-hostable workflow automation platform that lets you connect apps, APIs, and databases through a visual node-based editor. Think Zapier or Make (formerly Integromat), but with the ability to run on your own server, write JavaScript/TypeScript code inside any node, and — since 2024 — build full AI agent workflows using built-in LangChain integration.

Founded in 2019 by Jan Oberhauser, n8n reached over 400 native integrations, 90,000+ community members, and 50 million workflow executions per month as of early 2026. Its GitHub repository has over 50,000 stars.

Core value proposition

  • Visual + Code — Drag-and-drop editor for non-coders; full JavaScript access for developers.
  • Self-hostable — Run on any Docker-capable machine. Your data never leaves your server.
  • AI-native — Native LangChain nodes let you build agents, memory chains, and RAG pipelines visually.
  • Fair-code license — Source available, free for personal/internal use; commercial self-hosting requires a license above 3 active users.

2. Why n8n in 2026?

Workflow automation is no longer optional for businesses. The rise of AI agents has made automation platforms the glue connecting AI models to real-world data and systems. n8n sits at the intersection of these two trends:

  • AI agent boom — n8n's LangChain nodes let you build agentic pipelines (plan → tool use → observe → respond) without any backend code.
  • Data sovereignty — Enterprises and developers who cannot send data to US-based SaaS platforms use n8n self-hosted to keep data in-region.
  • Cost control — Zapier's pricing becomes expensive at high execution volumes. A $10/month VPS running n8n replaces hundreds of dollars in SaaS automation fees.
  • Developer-friendly — Unlike no-code-only tools, n8n respects developers: you can write real code, use npm packages, connect to databases, and version-control workflows as JSON.
  • MCP integration — n8n added Model Context Protocol (MCP) support in 2025, enabling it to act as an MCP server for AI assistants like Claude Desktop.

Key milestones

  • 2022 — Raised $35M Series B. Passed 200 integrations.
  • 2024 — Launched AI Agent node with native LangChain support. n8n Cloud reaches 10,000+ customers.
  • 2025 — Added MCP node support; introduced workflow templates marketplace with 1,000+ templates.
  • 2026 — n8n v2 released with improved performance engine and multi-main architecture for high availability.

3. Architecture & Core Concepts

┌─────────────────────────────────────┐
│          n8n Editor (Browser)        │
│        (React SPA on port 5678)      │
└───────────────┬─────────────────────┘
                │ REST / WebSocket
┌───────────────▼─────────────────────┐
│          n8n Server (Node.js)        │
│  Workflow Engine  ·  Queue Service   │
│  Credential Store (AES-256)          │
│  Webhook Server   ·  Schedule Engine │
└──────┬────────────────────┬─────────┘
       │                    │
┌──────▼──────┐      ┌──────▼──────┐
│  Database   │      │  Worker(s)  │
│  (SQLite /  │      │  (Queue     │
│  PostgreSQL)│      │   Mode)     │
└─────────────┘      └─────────────┘

Key concepts

  • Workflow — A directed graph of nodes connected by edges. Each node performs an action (HTTP call, database query, AI inference, etc.).
  • Node — The building block. Action nodes do work; trigger nodes start the workflow.
  • Item — n8n passes data between nodes as an array of items. Each item is a JSON object.
  • Credentials — Securely stored API keys and OAuth tokens used by nodes.
  • Execution — A single run of a workflow, triggered manually, by webhook, or by schedule.
  • Queue Mode — Scale horizontally by running multiple worker processes consuming from a Redis queue.

4. Installation: Self-Hosted

4.1 Docker (recommended)

# Create a data directory
mkdir -p ~/n8n-data

# Run n8n with Docker
docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v ~/n8n-data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n

Open http://localhost:5678 and create your owner account. The instance is ready for use immediately.

4.2 Docker Compose (production)

# docker-compose.yml
version: "3.8"
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:latest
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=n8n.yourdomain.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://n8n.yourdomain.com/
      - GENERIC_TIMEZONE=America/New_York
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=strongpassword
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      - postgres

  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: n8n
      POSTGRES_USER: n8n
      POSTGRES_PASSWORD: strongpassword
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  n8n_data:
  postgres_data:

4.3 Using npm

# Requires Node.js 18+
npm install -g n8n
n8n start

5. n8n Cloud Setup

n8n Cloud is the managed, hosted version of n8n offered at n8n.io/cloud. No server management required — ideal for individuals and teams who want instant access.

Cloud plans (2026)

  • Starter — $24/month. 2,500 workflow executions, 5 active workflows.
  • Pro — $60/month. 10,000 executions, unlimited workflows, custom variables.
  • Enterprise — Custom pricing. SSO, audit logs, dedicated infrastructure, SLA.

Sign up at n8n.io → choose your plan → your instance is provisioned in <60 seconds with a *.app.n8n.cloud URL.

6. The Editor UI Explained

n8n's visual editor runs entirely in the browser. Key areas:

  • Canvas — Main workspace where you drag, drop, and connect nodes.
  • Node Panel — Left sidebar listing all available nodes, searchable by name or category.
  • Node Settings — Right panel that opens when you click a node; configure parameters, credentials, and expressions.
  • Execution Log — Bottom panel showing input/output data for each node in the last run. Invaluable for debugging.
  • Run Workflow button — Execute the workflow manually in the editor with test data.
  • Workflow Settings — Error workflow, timezone, execution retention policy.

7. Your First Workflow

Let's build a workflow that triggers every hour, fetches a public API, and sends the result to a Slack channel.

  1. Click + on the canvas to add a node. Search for Schedule Trigger. Set interval to Every Hour.
  2. Click the + connector on the Schedule Trigger node. Add an HTTP Request node. Set URL to https://api.quotable.io/random. Method: GET.
  3. Add a Slack node. Create Slack credentials (OAuth2). Select Send Message action. Set channel and message body using an expression: {{ $json.content }} — {{ $json.author }}.
  4. Click Execute Workflow to test. You should see a quote appear in your Slack channel.
  5. Click Save and toggle Active to enable the schedule.

8. Triggers: Start Any Workflow

n8n workflows start with one or more trigger nodes:

  • Schedule Trigger — Cron expression or interval (every minute, hour, day, week).
  • Webhook — Exposes an HTTP endpoint. Any external system that sends a POST/GET to that URL starts the workflow. Supports path parameters and authentication.
  • Manual Trigger — Only runs when you click the button in the editor. Used for testing and one-off jobs.
  • App Triggers — Many integrations provide native triggers: Gmail: New Email, GitHub: New Issue, Stripe: New Payment, etc. These use polling or native webhooks.
  • n8n Form Trigger — Generates a public HTML form that starts the workflow when submitted. No coding needed to build forms.

9. Essential Nodes & Integrations

n8n offers 400+ built-in integrations. Below are the most widely used categories:

Data & Logic

  • Set — Add, rename, or remove fields from items. Used constantly for data shaping.
  • IF — Conditional branching. Route items to different paths based on conditions.
  • Switch — Multi-branch routing (like a switch statement).
  • Merge — Combine data from multiple branches.
  • Code — Write arbitrary JavaScript or Python (experimental) directly in the node.
  • Function Item — Transform each item with JavaScript.

Communication

  • Slack & Discord — Send messages, manage channels, look up users.
  • Gmail & Outlook — Send/receive emails, manage labels and folders.
  • Telegram & WhatsApp Business — Bot messages and business messaging.
  • Twilio — SMS and voice calls.

Productivity

  • Google Sheets — Read, append, update rows. Great for lightweight databases.
  • Notion & Airtable — Full CRUD on databases.
  • Jira, Linear, Trello — Issue and project management.
  • Google Drive & Dropbox — File operations.

Databases

  • PostgreSQL, MySQL, SQLite — Run raw SQL queries or use the GUI query builder.
  • MongoDB — Collection operations.
  • Redis — Key-value operations; great for caching and counters.

10. AI Agent Nodes & LangChain Integration

n8n's most powerful feature in 2026 is its native AI Agent toolkit, built on LangChain. You can build complete agentic workflows visually:

10.1 The AI Agent Node

The AI Agent node is the brain of an agentic workflow. It connects to an LLM (OpenAI GPT-4o, Claude 3.5 Sonnet, Mistral, Ollama, etc.) and uses tools to take actions in the world.

# Example: AI Agent workflow structure
[Chat Trigger]
    ↓
[AI Agent Node]
    ├── LLM: OpenAI Chat Model (GPT-4o)
    ├── Memory: PostgreSQL Chat Memory
    └── Tools:
        ├── HTTP Request Tool (search the web)
        ├── Code Tool (run calculations)
        └── Google Calendar Tool (check availability)

10.2 Available AI node types

  • AI Agent — Autonomous agent with tool use and memory.
  • Basic LLM Chain — Simple prompt → LLM → response pipeline.
  • Summarization Chain — Summarize long documents using map-reduce or stuff strategy.
  • Question & Answer Chain — RAG pipeline: embed query → retrieve from vector store → answer with context.
  • Text Classifier — Use an LLM to classify items into categories.
  • Information Extractor — Extract structured JSON from unstructured text.
  • Sentiment Analysis — Detect sentiment using an LLM.

10.3 Supported LLMs

  • OpenAI (GPT-4o, GPT-4o mini, o3, o4-mini)
  • Anthropic (Claude 3.5 Sonnet, Claude 3 Haiku)
  • Google (Gemini 2.0 Flash, Gemini 1.5 Pro)
  • Mistral AI
  • Ollama (local models: Llama 3, Mistral, Qwen, Phi)
  • AWS Bedrock
  • Azure OpenAI

10.4 Vector stores for RAG

  • Pinecone, Qdrant, Milvus, Weaviate, PGVector, Supabase

11. Expressions & Data Mapping

n8n uses a powerful expression language to map data from previous nodes into fields of the current node. Expressions are wrapped in double curly braces: {{ }}.

Common expression examples

// Reference output from previous node
{{ $json.email }}

// Reference output from a specific named node
{{ $('Get User').item.json.name }}

// Use built-in methods
{{ $now.toFormat('yyyy-MM-dd') }}
{{ $json.name.toUpperCase() }}

// Conditional expression
{{ $json.status === 'active' ? 'Enabled' : 'Disabled' }}

// Iterate over arrays
{{ $json.tags.join(', ') }}

n8n also includes a Data Pinning feature: pin test data on a node so you can develop downstream nodes without re-triggering the entire workflow.

12. Error Handling & Retries

Production workflows must handle failures gracefully:

  • Error Workflow — Set a dedicated "error handler" workflow under Workflow Settings. It receives the error object when any execution fails.
  • Retry on Fail — Enable on individual nodes. Configure max retries and wait time between attempts.
  • Continue on Fail — Instead of stopping the workflow, route failed items to a separate branch for logging.
  • Try/Catch pattern — Use IF or Switch nodes after a fallible node to route on error conditions.
// Example error workflow notification (Slack node)
Message: ⚠️ Workflow "{{ $workflow.name }}" failed
Details: {{ $json.error.message }}
Execution ID: {{ $execution.id }}

13. Credentials & Security

n8n stores all credentials encrypted with AES-256. Key practices:

  • Set a strong N8N_ENCRYPTION_KEY environment variable and never lose it — it encrypts all stored credentials.
  • Use environment variables for sensitive config, not hardcoded values in workflows.
  • Use least privilege OAuth scopes when connecting to services.
  • Enable two-factor authentication on your n8n instance (available in Enterprise).
  • Place n8n behind a reverse proxy (Nginx, Caddy, Traefik) with TLS. Never expose port 5678 directly to the internet.
  • Enable user management and assign roles (owner, admin, member) to limit access.

14. Sub-Workflows & Reusability

Large automations become complex fast. Sub-workflows solve this by allowing you to call one workflow from another:

  • Create a reusable workflow with an Execute Workflow Trigger node.
  • Call it from a parent workflow using the Execute Workflow node.
  • Pass data in and receive data back — like calling a function.

Best practice: extract common patterns (e.g., "format and send Slack notification", "log to database", "enrich with AI") into reusable sub-workflows. This keeps parent workflows clean and maintainable.

15. Scheduling & Cron Jobs

n8n's Schedule Trigger supports both simple intervals and advanced cron expressions:

# Simple intervals
Every 15 minutes
Every 2 hours
Daily at 9:00 AM
Weekly on Monday at 8:00 AM

# Advanced cron syntax (minute hour day month weekday)
0 9 * * 1-5    # Weekdays at 9:00 AM
0 0 1 * *      # First day of each month
*/30 * * * *   # Every 30 minutes

You can add multiple schedules to a single trigger node, and the timezone is configurable per instance or per workflow.

16. Webhooks & HTTP API

Webhooks are one of n8n's most powerful features. Each Webhook node generates a unique URL like https://n8n.yourdomain.com/webhook/abc123.

  • Test URL — Active only when you're in the editor with the workflow listening. Used during development.
  • Production URL — Active when the workflow is saved and enabled. Receives events from external services.
  • Authentication — Protect webhooks with Basic Auth, Header Auth, or JWT.
  • Response mode — Choose whether n8n immediately returns 200 OK (async) or waits for workflow completion to return a custom response (sync).

n8n also exposes its own REST API for managing workflows, executions, and credentials programmatically.

17. Custom Nodes with JavaScript

When no built-in node fits your needs, you can build a custom node using TypeScript/JavaScript:

# Install n8n-node-starter
npx n8n-node-dev create

# Develop your node (TypeScript class extending INodeType)
# Describe parameters, properties, and execute() function

# Build and link
npm run build
npm link
n8n-node-dev build --destination ~/.n8n/custom

Custom nodes appear alongside built-in nodes in the editor. You can also publish them to the npm registry under the n8n-nodes- prefix so other n8n users can install them.

18. Real-World Automation Examples

18.1 Lead enrichment pipeline

  1. Webhook receives new lead from web form.
  2. HTTP Request node calls Clearbit API to enrich with company data.
  3. AI Agent node scores the lead and writes a personalised outreach email draft.
  4. Google Sheets node logs the enriched lead.
  5. Gmail node sends the draft email for human review.

18.2 AI-powered Slack assistant

  1. Slack Trigger fires when someone @mentions the bot.
  2. AI Agent node receives the message, uses tools to search Notion, query Jira, and check Google Calendar.
  3. Agent composes a consolidated answer and posts it back to Slack.

18.3 Automated content moderation

  1. Webhook receives new user-generated content from your app.
  2. Text Classifier node (LLM-backed) classifies content as safe / flagged / rejected.
  3. IF node routes flagged content to a human review queue (Airtable) and rejected content triggers automatic removal via your app's API.

19. n8n vs Zapier vs Make

Feature n8n Zapier Make
Self-hostable ✅ Yes ❌ No ❌ No
AI agent nodes ✅ Native LangChain ⚠️ Limited ⚠️ Limited
Code execution ✅ JS / Python ⚠️ Limited JS ✅ JS
Integrations (native) 400+ 6,000+ 1,500+
Free tier Unlimited (self-host) 100 tasks/month 1,000 ops/month
Data ownership ✅ Full (self-host) ❌ Zapier servers ❌ Make servers
Price at 50k ops/month ~$10 (VPS) or $60 (Cloud) ~$49 ~$29

20. Performance & Scaling

For production workloads with high execution volumes:

  • Queue mode — Add EXECUTIONS_MODE=queue and a Redis instance. Run multiple worker containers to process executions in parallel.
  • PostgreSQL — Switch from the default SQLite to PostgreSQL for concurrent write performance.
  • Multi-main (n8n v2+) — Run multiple main instances behind a load balancer for high availability. Requires Redis for coordination.
  • Binary data storage — Store large files (attachments, images) in S3-compatible storage instead of the database.
  • Execution data pruning — Configure EXECUTIONS_DATA_MAX_AGE and EXECUTIONS_DATA_SAVE_DATA_ON_SUCCESS to avoid unbounded database growth.

21. Security Hardening

  • Set N8N_ENCRYPTION_KEY to a cryptographically random 32+ character string.
  • Enable N8N_BASIC_AUTH_ACTIVE=true or configure SSO (SAML/OIDC in Enterprise) to protect the editor.
  • Use a reverse proxy (Nginx or Traefik) with HTTPS.
  • Restrict inbound access to the n8n port (5678) to the reverse proxy only (firewall rules).
  • Regularly rotate credentials and audit the credential store.
  • Enable webhook authentication (Header Auth or JWT) on all public webhook endpoints.
  • Set N8N_RUNNERS_DISABLED=false to use the task runner sandbox for Code nodes (prevents accidental filesystem access).

22. Use Cases by Industry

Marketing

  • Sync leads from web forms to CRM (HubSpot, Salesforce)
  • Auto-schedule social media posts from a content calendar
  • Generate weekly performance reports with AI narrative

Engineering

  • Auto-create Jira tickets from Sentry error alerts
  • Deploy previews on PR open, post status to Slack
  • Daily infrastructure cost reports from AWS Cost Explorer

Finance

  • Reconcile Stripe payments with QuickBooks
  • Flag unusual transactions via AI and alert via email
  • Generate invoice PDFs and email them automatically

Operations

  • Onboarding automation: create accounts in 10+ tools from a single HR system event
  • Collect and summarize customer feedback daily
  • Automate support ticket routing based on sentiment and topic

23. FAQ

Is n8n really free?
Self-hosting n8n is free for personal use and businesses with up to 3 active users under its fair-code license. Above that, an Enterprise license is required. n8n Cloud has paid plans.
Can n8n replace custom backend code?
For integration and automation tasks, yes. For performance-critical APIs or complex business logic, use n8n alongside a proper backend — not instead of one. The Code node is powerful but not a substitute for a real service.
Does n8n work offline / without internet?
Yes. Self-hosted n8n runs entirely on your local network. As long as the services you connect to are also local (or you have VPN), it works offline.
How are n8n workflows versioned?
Workflows are stored as JSON and can be exported/imported. You can version-control them in Git manually. The n8n CLI and API support programmatic export for CI/CD pipelines.
What happens if a workflow execution fails?
Failed executions are logged with full input/output data per node. You can inspect and re-run failed executions from the executions list. Configure an Error Workflow for automated alerting.
Can I run n8n on a Raspberry Pi?
Yes, for light workloads. Use the Docker image on a Pi 4 (4GB RAM minimum). Not recommended for high-volume production use.

24. Glossary

Node
The fundamental building block of an n8n workflow. Each node performs a single action or integration.
Trigger
A special type of node that starts a workflow in response to an event (webhook, schedule, manual click).
Item
A single unit of data passed between nodes. Workflows process arrays of items, enabling batch processing.
Expression
A dynamic value in a node parameter written as {{ }} that references data from previous nodes or built-in variables.
Queue Mode
A scaling architecture where workflow executions are distributed across multiple worker processes via a Redis queue.
LangChain
An open-source framework for building LLM-powered applications. n8n integrates LangChain concepts natively through its AI node suite.
Credential
Securely stored authentication data (API key, OAuth token) used by nodes to access external services.

25. References & Further Reading

26. Conclusion

n8n has evolved from a niche open-source Zapier alternative into one of the most capable AI workflow automation platforms available in 2026. Its combination of 400+ integrations, native AI agent support, self-hostability, and a code-friendly environment makes it the tool of choice for developers and teams who need real automation power without vendor lock-in.

Whether you're connecting a CRM to an email tool, building a multi-step AI agent that browses the web and writes Notion pages, or orchestrating your entire company's data operations, n8n can handle it — and you can run it for the price of a VPS.

Install n8n with a single Docker command, build your first workflow in 10 minutes, and discover why over 90,000 developers have made it their automation platform of choice.