---
title: "Deploy N8N Main + Worker"
description: "Deploy and Host N8N with Inactive worker."
category: "Automation"
url: https://railway.com/deploy/n8n-main-worker
---

# Deploy N8N Main + Worker

Deploy and Host N8N with Inactive worker.

**[Deploy N8N Main + Worker on Railway](https://railway.com/template/n8n-main-worker)**

- **Creator:** jakemerson's Projects
- **Category:** Automation
- **Total deploys:** 119

## Template content

### Worker https://devicons.railway.app/i/n8n.svg

- **Image:** n8nio/n8n
- **Start command:** `n8n worker`

### Postgres https://img.icons8.com/color/48/postgreesql.png

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl
- **Start command:** `/bin/sh -c "unset PGPORT; docker-entrypoint.sh postgres --port=5432"`

### Redis https://img.icons8.com/color/48/redis--v1.png

- **Image:** bitnamisecure/redis:latest

### Main https://devicons.railway.app/i/n8n.svg

- **Image:** n8nio/n8n
- **Start command:** `n8n start`
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host N8N Main + Worker on Railway

N8N Main + Worker is a scalable automation setup using [n8n](https://n8n.io), a workflow automation tool. The **Main instance** handles workflow orchestration, while the **Worker instance** processes jobs from a Redis-powered queue. This architecture allows you to handle higher loads and run workflows in parallel with better reliability.

## About Hosting N8N Main + Worker

Hosting N8N Main + Worker on Railway gives you a ready-to-use environment with **Postgres** for persistent storage and **Redis** for queue execution. By default, only the **Main instance** is active in *regular mode*. If you don’t need queue execution, you can safely remove the Worker.  
If you do need scaling, you simply switch the Main’s environment variable `EXECUTIONS_MODE=queue` and deploy the Worker. Redis then manages tasks, offloading execution from the Main instance to the Worker, improving scalability and stability. This setup lets you start small and easily scale as workflow demand increases.

## Common Use Cases

- Running heavy or long-running workflows in a distributed worker model  
- Scaling automation tasks for enterprise workloads  
- Ensuring reliability by offloading execution from the Main instance  

## Dependencies for N8N Main + Worker Hosting

- **Postgres** – Database for storing workflows, executions, and credentials  
- **Redis** – Required for enabling and managing queue execution mode  

### Deployment Dependencies

- [n8n Documentation – Scaling with Workers](https://docs.n8n.io/hosting/scaling/queue-mode/)  
- [Railway Docs](https://docs.railway.app/)  

### Implementation Details

This template provides a ready-to-use setup with the following services:

- **Postgres** – Database for persisting n8n data  
- **Redis** – Required for queue execution mode  
- **n8n (Main Instance)** – Your primary n8n workflow automation instance  
- **n8n (Worker Instance)** – Optional worker for queue mode  

---

#### ⚙️ Usage Instructions

**1. Default Setup**  
By default, the **Worker instance is disabled**.  
After deploying the template, you can safely **remove the Worker deployment** if you do not plan to use it.

**2. Enabling Queue Mode**  
If you want to take advantage of **queue execution mode**:

1. Go to the **Main n8n instance**  
2. Update the environment variable:  

`EXECUTIONS_MODE=queue`

3. Re-enable and deploy the **Worker instance**  
4. Your workflows will now be processed using Redis as a queue with worker execution.

---

#### ✅ Summary
- **Regular mode (default)** → Only Main instance is required.  
- **Queue mode** → Requires both Main and Worker instances, with `EXECUTIONS_MODE=queue` set in Main.

This setup gives you flexibility to start simple and scale when needed.

## Why Deploy N8N Main + Worker 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 Main + Worker 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.

## Similar templates

- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Automate WhatsApp workflows with Evolution API, n8n, and Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage
- [Prefect [Updated Aug ’26]](https://railway.com/deploy/prefect) — Prefect [Aug ’26] (ETL & Automation alternative to Airflow) Self Host

Open this page in a browser: https://railway.com/deploy/n8n-main-worker
