Railway

Deploy N8N (w/ task runners)

n8n with external task runners for isolated and reliable code execution

Deploy N8N (w/ task runners)

/var/lib/postgresql/data

Just deployed

Just deployed

Deploy and Host n8n with Task Runners on Railway

n8n is a powerful workflow automation platform for connecting APIs, applications, databases, AI models, and business processes. This template pairs n8n with PostgreSQL and dedicated external Task Runners, providing a cleaner architecture for executing Code node tasks separately from the main n8n process.

About Hosting n8n with Task Runners

N8N

This template deploys a self-hosted n8n stack with PostgreSQL for persistent application data and dedicated n8n Task Runners for isolated task execution.

The Main service hosts the n8n editor, APIs, webhooks, scheduling, and workflow orchestration. PostgreSQL stores workflows, credentials, execution history, and other persistent n8n data. The separate Task Runners service connects to n8n's task broker and executes supported Code node tasks outside the main n8n process.

Unlike n8n Queue Mode deployments, this template does not require Redis or separate workflow workers, keeping the infrastructure smaller while still providing dedicated task execution.

Included Architecture

ServicePurpose
Mainn8n editor, API, webhooks, scheduling, and workflow orchestration
RunnersDedicated external Task Runners for Code node task execution
PostgreSQLPersistent database for workflows, credentials, executions, and configuration

Common Use Cases

  • Build AI-powered workflows and AI agents
  • Connect APIs, databases, SaaS applications, and internal systems
  • Run JavaScript and supported Python tasks through dedicated Task Runners
  • Automate backend processes and API integrations
  • Build webhook-driven automation
  • Process and transform data inside workflows
  • Automate CRM, notifications, reporting, and business operations
  • Connect LLMs and AI services to existing applications
  • Build scheduled and event-driven workflows
  • Self-host automation while keeping control of your data

n8n vs Other Workflow Automation Platforms

PlatformSelf-HostedVisual WorkflowsCustom CodeAI AutomationDedicated Task ExecutionBest Fit
n8n✅ Yes✅ Yes✅ Strong✅ Yes✅ Task RunnersDevelopers, APIs, AI workflows, advanced automation
Zapier❌ Primarily SaaS✅ Yes⚠️ Limited compared with n8n✅ Yes❌ Managed internallyFast SaaS integrations and business automation
Make❌ Primarily SaaS✅ Yes✅ Supported✅ Yes❌ Managed internallyVisual automation and complex business scenarios
Activepieces✅ Yes✅ Yes✅ Extensible✅ YesArchitecture differsOpen-source-oriented workflow automation

n8n is particularly well suited to technical teams that need flexible workflow logic, API integrations, custom code, AI automation, and control over where their automation infrastructure runs.

Dependencies for n8n with Task Runners Hosting

  • n8n Main — workflow editor, API, webhooks, scheduling, and orchestration
  • n8n Task Runners — dedicated external execution environment for supported Code node tasks
  • PostgreSQL — persistent relational database
  • Railway Private Networking — communication between Main, Runners, and PostgreSQL
  • Shared Runner Authentication Token — securely authenticates Task Runners with the n8n task broker
  • n8n Encryption Key — protects stored credentials and encrypted application data

Deployment Dependencies

Implementation Details

This template uses external Task Runner mode.

                    ┌──────────────┐
                    │    Users     │
                    └──────┬───────┘
                           │
                           ▼
                    ┌──────────────┐
                    │   n8n Main   │
                    │ UI / API /   │
                    │ Webhooks     │
                    └──────┬───────┘
                           │
               ┌───────────┴────────────┐
               │                        │
               ▼                        ▼
       ┌──────────────┐         ┌──────────────┐
       │ PostgreSQL   │         │ Task Broker  │
       │ Persistent   │         │    :5679     │
       │ Data         │         └──────┬───────┘
       └──────────────┘                │
                                       ▼
                               ┌──────────────┐
                               │ Task Runners │
                               │ n8nio/runners│
                               └──────────────┘

The Main service runs n8n using PostgreSQL as its database backend and exposes the Task Runner broker over Railway's private network.

The Runners service uses the official:

n8nio/runners

container image and connects privately to the task broker running on the Main service.

A shared N8N_RUNNERS_AUTH_TOKEN is used to authenticate communication between n8n and its external Task Runners.

This architecture intentionally does not use:

Redis
n8n Worker
EXECUTIONS_MODE=queue

Task Runners and Queue Mode solve different problems. Task Runners provide a separate execution environment for supported tasks such as Code node execution, while Queue Mode distributes complete workflow executions across n8n workers using Redis.

This makes the template a useful middle ground between a basic single-container n8n deployment and a larger Queue Mode deployment with Redis and multiple workers.

Why Use External Task Runners?

Basic n8nn8n with Task Runners
Code tasks execute alongside the main applicationCode tasks can execute in dedicated runner processes
Simpler infrastructureBetter process separation
Good for lightweight deploymentsBetter suited for workflows using Code nodes
Main instance handles more responsibilitiesDedicated runners handle supported task execution
Fewer servicesMore controlled execution architecture

External Task Runners are particularly useful when workflows rely heavily on custom JavaScript or Python logic while keeping the main n8n application process focused on workflow orchestration.

Why Deploy n8n with Task Runners on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying n8n with Task Runners on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
N8N Main + Worker
Deploy and Host N8N with Inactive worker.

jakemerson
120
View Template
Evolution API with n8n
[Jul'26] WhatsApp automation platform using Evolution API, n8n & PostgreSQL

codestorm
67
View Template
Postgres Backup
Cron-based PostgreSQL backup to bucket storage

Railway Templates
870