Skip to Content

Self-Host n8n: Build Powerful AI Workflows in Your Homelab in 15 Minutes

Tired of paying Zapier $50+/month for simple automations? n8n lets you build complex workflows — including AI-powered ones — on your own infrastructure. No per-task pricing, no data leaving your servers, full code access. Here's how to get it running in 15 minutes flat.

Why Self-Host n8n?

n8n is the open-source workflow automation platform that developers actually like. Think Zapier, but:

  • 400+ integrations — from Slack to PostgreSQL to OpenAI
  • AI-native — built-in nodes for LLMs, vector stores, and agents
  • Self-hosted = unlimited executions — no per-operation billing
  • Code when you need it — JavaScript/Python nodes inline
  • Version control friendly — export workflows as JSON

Perfect for homelabbers who want to automate backups, sync data between services, or build AI pipelines without vendor lock-in.

Prerequisites

  • VPS or home server with 2+ CPU cores, 4GB RAM, 20GB disk
  • Docker + Docker Compose installed
  • A domain or subdomain pointed to your server (optional but recommended)
  • 5 minutes of your time

Step 1: Create the Docker Compose File

Create a directory for n8n and drop in this docker-compose.yml:

version: "3.8"

services:
  n8n:
    image: n8nio/n8n:latest
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=change-me-in-production
      - N8N_HOST=n8n.yourdomain.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.yourdomain.com/
      - GENERIC_TIMEZONE=UTC
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

Key environment variables:

  • N8N_BASIC_AUTH_* — protects your instance (change the password!)
  • N8N_HOST / WEBHOOK_URL — required for webhooks to work correctly behind a reverse proxy
  • GENERIC_TIMEZONE — sets schedule node timezone

Step 2: Launch n8n

mkdir n8n && cd n8n
# Paste the compose file above
docker compose up -d

# Check logs
docker compose logs -f n8n

Wait for the "Editor is now accessible" message, then hit http://your-server-ip:5678.

Step 3: First-Time Setup

  1. Open the web UI — you'll see the n8n editor
  2. Create your owner account (email + password)
  3. Skip the template gallery for now — we'll build a real workflow

Step 4: Build Your First AI Workflow

Let's create a workflow that summarizes RSS feeds using AI — useful for monitoring tech news:

  1. Add an RSS Feed node — set URL to https://news.ycombinator.com/rss
  2. Add an OpenAI node — connect your API key, set prompt to "Summarize this in 2 sentences: {{$json.title}}"
  3. Add a Slack node — send the summary to a channel
  4. Schedule Trigger — run every 6 hours

Hit Execute Workflow to test, then Save and toggle Active.

Step 5: Add a Reverse Proxy (Optional but Recommended)

If you're using Traefik or Nginx Proxy Manager, point n8n.yourdomain.com to port 5678. For Traefik:

labels:
  - "traefik.enable=true"
  - "traefik.http.routers.n8n.rule=Host(`n8n.yourdomain.com`)"
  - "traefik.http.routers.n8n.entrypoints=websecure"
  - "traefik.http.routers.n8n.tls.certresolver=letsencrypt"
  - "traefik.http.services.n8n.loadbalancer.server.port=5678"

Verification Checklist

  • ✅ n8n editor loads at your domain/IP
  • ✅ Can create and save a workflow
  • ✅ Test execution completes without errors
  • ✅ Webhook URLs show your domain (not localhost)
  • ✅ Data persists after docker compose restart

Next Steps

  • Add PostgreSQL — swap SQLite for production-grade storage
  • Enable encryption — set N8N_ENCRYPTION_KEY for credential security
  • Build AI agents — use n8n's AI Agent node with tools and memory
  • Monitor executions — set up failure alerts to Slack/Telegram

Related Guides

  • Self-Host PostgreSQL for production n8n storage
  • Self-Host LiteLLM for unified AI API access
  • Self-Host Traefik for reverse proxy and SSL

Questions? Drop a comment or hit us up on Discord. Happy automating.

Self-Host Coolify: Your Own Vercel/Netlify Alternative in 20 Minutes