Phase 1: No-Code Automation Platforms — Zapier, Make, n8n · 55 min · n8n · Docker · OpenAI API
n8n Fundamentals and Self-Hosting with Docker
Self-hosted, unlimited executions, deep AI integration.
Hiring signal: n8n is the platform most automation engineering roles actually use in production. Being able to self-host n8n with Docker, explain why it's 4–10x cheaper than Zapier at scale, and build a workflow with trigger nodes and AI nodes is the technical baseline for automation engineer interviews.
What you will learn
- Self-host n8n using Docker Compose with persistent storage and environment configuration
- Understand n8n's workflow anatomy: trigger nodes, processing nodes, AI nodes, action nodes
- Navigate the visual canvas: connecting nodes, mapping data between steps
- Manage credentials securely in n8n's built-in credential manager
The Problem
A team has been using Zapier for 6 months. They're at 40,000 tasks/month, paying $799/month. They need to add custom JavaScript logic, AI agents with tool calling, and vector store integration for RAG. Zapier can't do any of this. They need a platform that supports code, AI agents, and self-hosting — and costs less than $100/month.
n8n is the answer: open-source, self-hostable, with Code nodes (JavaScript + Python), LangChain integration, AI Agent nodes, and vector store nodes. But self-hosting requires Docker knowledge, and n8n's visual canvas has its own patterns for data mapping and credential management.
n8n is the production platform for AI automation
Zapier gets you started. Make handles mid-market complexity. n8n is what you run in production when you need code, AI agents, self-hosting, and cost control. Learning to self-host n8n with Docker is the technical baseline for automation engineer roles.
The Concept
n8n Workflow Anatomy
┌──────────────────────────────────────────────────────────────┐
│ n8n WORKFLOW │
│ │
│ TRIGGER NODE What starts the workflow │
│ ├── Webhook HTTP endpoint (real-time) │
│ ├── Schedule Cron-based (batch) │
│ ├── Manual Click to run │
│ ├── Email IMAP polling │
│ └── App triggers Slack, GitHub, etc. │
│ │
│ PROCESSING NODES Transform and route data │
│ ├── Code JavaScript/Python custom logic │
│ ├── Set Map/transform fields │
│ ├── IF Conditional branching │
│ ├── Switch Multi-way routing │
│ ├── Merge Combine multiple branches │
│ └── Filter Remove items that don't match │
│ │
│ AI NODES LangChain-powered AI steps │
│ ├── AI Agent ReAct agent with tools + memory │
│ ├── OpenAI GPT-4o, GPT-4o-mini │
│ ├── Anthropic Claude 3.5 Sonnet/Haiku │
│ ├── Ollama Local LLM (Llama, Mistral) │
│ ├── Embeddings Generate vector embeddings │
│ └── Vector Store Pinecone, Qdrant, Supabase pgvector │
│ │
│ ACTION NODES Execute outcomes │
│ ├── HTTP Request Call any REST API │
│ ├── Postgres Database operations │
│ ├── Slack Send messages │
│ ├── Email Send via SMTP │
│ └── 400+ app nodes Pre-built integrations │
└──────────────────────────────────────────────────────────────┘
Data Flow in n8n
n8n processes data as arrays of "items." Each item has a json object:
[
{ "json": { "name": "Alice", "email": "alice@example.com" } },
{ "json": { "name": "Bob", "email": "bob@example.com } }
]
Each node receives items from the previous node, processes them, and passes to the next. You reference data using expressions: {{ $json.name }} or {{ $node["Previous Node"].json.email }}.
In n8n, a Webhook node receives a POST request with {"name": "Jane", "score": 85}. How do you access the score in the next node?
{{ $json.score }} accesses the score field from the current item's JSON data. $json is shorthand for the current item's json object. You can also use {{ $node["Webhook"].json.score }} to explicitly reference the Webhook node's output, but $json.score is the standard shorthand when referencing the immediately previous node.
Self-Hosting with Docker
┌─────────────────────────────────────────────────┐
│ Docker Compose Architecture │
│ │
│ ┌──────────┐ ┌──────────┐ │
│ │ n8n │ ←→ │ Postgres │ │
│ │ (app) │ │ (data) │ │
│ └──────────┘ └──────────┘ │
│ ↓ │
│ ┌──────────┐ │
│ │ Volume │ (persistent storage) │
│ │ /data │ │
│ └──────────┘ │
│ │
│ Environment: │
│ N8N_HOST=n8n.yourdomain.com │
│ N8N_PROTOCOL=https │
│ WEBHOOK_URL=https://n8n.yourdomain.com │
│ N8N_ENCRYPTION_KEY=your-secret-key │
└─────────────────────────────────────────────────┘
Credential Management
n8n has a built-in encrypted credential store. Credentials are:
- Encrypted at rest using
N8N_ENCRYPTION_KEY - Referenced by name in nodes (not hardcoded)
- Scoped per workflow (credentials don't leak between workflows)
- Exportable for backup (encrypted)
Never hardcode API keys in Code nodes
Always store API keys in n8n credentials and reference them via {{ $credentials.apiKey }}. Hardcoded keys in Code nodes are visible in execution logs and exported workflow JSON.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Build It, Use It, Ship It, Exercises, Key Terms, Common Pitfalls — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy