DEV Community

EveryLocalAI
EveryLocalAI

Posted on

Build a Local AI Workflow Automation with n8n and Ollama

Automate tasks with AI-powered workflows that run entirely on your own hardware. n8n + Ollama = self-hosted Zapier with local LLM inference. No monthly fees, no data leaving your machine.

What You Need

  • A GPU with 12GB+ VRAM (for local AI) or any machine with Docker (n8n works CPU-only too)
  • Docker + Docker Compose
  • About 15 minutes

Architecture

Component Role
n8n Visual workflow engine with 500+ integrations and AI agent nodes
Ollama Serves local LLM via OpenAI-compatible API
Qwen3 14B Default model - strong reasoning, fits 12GB at Q4

Setup

Save this as docker-compose.yml:

services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    volumes:
      - ollama:/root/.ollama
    ports:
      - "11434:11434"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    restart: unless-stopped

  n8n:
    image: docker.n8n.io/n8nio/n8n
    container_name: n8n
    depends_on:
      - ollama
    environment:
      - N8N_RUNNERS_ENABLED=true
      - GENERIC_TIMEZONE=America/New_York
      - TZ=America/New_York
    volumes:
      - n8n_data:/home/node/.n8n
    ports:
      - "5678:5678"
    restart: unless-stopped

volumes:
  ollama:
  n8n_data:
Enter fullscreen mode Exit fullscreen mode

Start it:

docker compose up -d
docker exec ollama ollama pull qwen3:14b
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:5678 to access n8n.

Connect n8n to Ollama

In n8n, add an Ollama Chat Model node and set:

Use it with n8n's AI Agent node for agentic workflows.

Example Workflows

Email Summarizer

Trigger: New email → AI step: "Summarize this email in 2 sentences" → Output: Slack message

Content Generator

Trigger: Cron schedule → AI step: "Write a newsletter about [topic]" → Output: Email to subscribers

Smart Classifier

Trigger: Webhook (support tickets) → AI step: "Classify as billing/technical/feature" → Output: Route to different teams

Cost vs Cloud

Local n8n + Ollama Zapier + ChatGPT
Monthly $0 $20-100+
Hardware ~$300 once $0
Data safety Stays on your LAN Sent to cloud
AI calls Unlimited, free Token-limited
Workflows Unlimited Task-limited

After 3-6 months the hardware pays for itself.


Full guide with detailed troubleshooting and alternatives: https://everylocalai.com/stack/n8n-ollama-ai-automation

Top comments (0)