Skip to main content
n8n is designed to be self-hosted, giving you complete control over your workflows, data, and infrastructure. Whether you’re running a small team or an enterprise deployment, n8n provides flexible hosting options to meet your needs.

Why Self-Host n8n?

Data Control

Keep all workflow data, credentials, and execution logs within your infrastructure

Customization

Install custom nodes, configure security policies, and integrate with internal systems

Scalability

Scale horizontally with worker nodes and queue mode for high-throughput workloads

Fair-Code License

Self-host with a sustainable fair-code license that protects both users and the project

Deployment Options

Single Instance (Regular Mode)

Perfect for development, testing, or small production workloads. n8n runs as a single process handling the UI, workflow execution, and webhooks. Best for:
  • Development and testing environments
  • Small teams (< 10 users)
  • Low to moderate execution volume
  • Simple deployment requirements
Architecture:
┌─────────────────────────┐
│   n8n Main Process      │
│  ┌──────────────────┐   │
│  │ UI & API Server  │   │
│  ├──────────────────┤   │
│  │ Workflow Engine  │   │
│  ├──────────────────┤   │
│  │ Webhooks         │   │
│  └──────────────────┘   │
└─────────────────────────┘


   ┌──────────┐
   │ Database │
   │ (SQLite/ │
   │ Postgres)│
   └──────────┘

Queue Mode (Scaling Mode)

For production workloads requiring horizontal scaling, queue mode distributes workflow execution across multiple worker processes using Redis as a message broker. Best for:
  • Production environments
  • High execution volume
  • Horizontal scaling needs
  • Multiple concurrent workflows
Architecture:
┌──────────────────┐     ┌──────────────┐
│   Main Process   │────▶│    Redis     │
│  ┌────────────┐  │     │ (Job Queue)  │
│  │ UI & API   │  │     └──────┬───────┘
│  │ Server     │  │            │
│  └────────────┘  │            │
└──────────────────┘            │
         │                      │
         ▼                      ▼
   ┌──────────┐    ┌────────────────────┐
   │PostgreSQL│    │  Worker Processes  │
   │ Database │    │ ┌────────────────┐ │
   └──────────┘    │ │ Worker 1       │ │
                   │ │ (Executions)   │ │
                   │ ├────────────────┤ │
                   │ │ Worker 2       │ │
                   │ │ (Executions)   │ │
                   │ ├────────────────┤ │
                   │ │ Worker N       │ │
                   │ │ (Executions)   │ │
                   │ └────────────────┘ │
                   └────────────────────┘

Multi-Main Setup (Enterprise)

For high availability and load distribution, run multiple main processes behind a load balancer. Requires an Enterprise license. Best for:
  • High availability requirements
  • Large enterprise deployments
  • Geographic distribution
  • Maximum uptime needs
Architecture:
        ┌──────────────┐
        │Load Balancer │
        └──────┬───────┘

      ┌────────┴────────┐
      ▼                 ▼
┌──────────┐      ┌──────────┐
│ Main 1   │      │ Main 2   │
└────┬─────┘      └────┬─────┘
     │                 │
     └────────┬────────┘

      ┌──────────────┐
      │    Redis     │
      └──────┬───────┘


      ┌──────────────┐
      │  PostgreSQL  │
      └──────────────┘


      ┌──────┴───────┐
      │   Workers    │
      └──────────────┘

Task Runners

n8n uses task runners to execute workflow nodes in isolated environments for enhanced security and stability.
Task runners run as child processes spawned by n8n. This is the default mode and simplest to set up.
N8N_RUNNERS_MODE=internal
Pros:
  • Automatic lifecycle management
  • No additional infrastructure
  • Simple configuration
Cons:
  • Shares resources with main process
  • Less isolation

Database Support

n8n supports two database systems:

SQLite

Default database - File-based, no additional setup required.
  • Perfect for development and testing
  • Low to moderate workloads
  • Single instance deployments
  • Automatic backups with file copy

PostgreSQL

Recommended for production - Robust, scalable database.
  • Production environments
  • Queue mode deployments
  • Multi-main setups
  • High concurrency needs
  • Advanced backup and replication

System Requirements

Minimum Requirements

1

CPU

  • Single instance: 1 CPU core
  • Queue mode: 2+ CPU cores
  • Workers: 1 CPU core per worker
2

Memory

  • Single instance: 1GB RAM
  • Main process: 2GB RAM
  • Worker process: 512MB - 2GB RAM per worker
  • Task runners: 256MB - 1GB RAM per runner
3

Storage

  • Base installation: 500MB
  • Database: Varies by execution history (plan for 1GB+)
  • Binary data: Additional storage as needed
4

Network

  • Port 5678 for web UI and API
  • Port 5679 for task runner broker (external mode)
  • Port 6379 for Redis (queue mode)
  • Port 5432 for PostgreSQL (if using)
Main Process:
  - CPU: 2-4 cores
  - RAM: 4GB
  - Storage: 10GB

Worker Processes (each):
  - CPU: 2 cores
  - RAM: 2GB
  - Count: Based on execution volume

Database (PostgreSQL):
  - CPU: 2-4 cores
  - RAM: 4-8GB
  - Storage: 50GB+ (SSD recommended)

Redis:
  - CPU: 1-2 cores
  - RAM: 2-4GB

Security Considerations

Important Security Practices
  • Always set a strong N8N_ENCRYPTION_KEY and back it up securely
  • Use PostgreSQL with SSL/TLS for production deployments
  • Configure Redis authentication and TLS
  • Restrict file access with N8N_RESTRICT_FILE_ACCESS_TO
  • Disable risky nodes in production (NODES_EXCLUDE)
  • Use HTTPS/SSL for all external traffic
  • Implement proper firewall rules
  • Regular security updates and patches

Next Steps

Docker Deployment

Deploy n8n using Docker and Docker Compose

Configuration

Configure environment variables and settings

Scaling

Scale n8n with queue mode and workers

Resources