---
title: "Deploy N8N"
description: "Workflow automation tool with AI agents, 400+ integrations, and more"
category: "Automation"
url: https://railway.com/deploy/n8n-railway
---

# Deploy N8N

Workflow automation tool with AI agents, 400+ integrations, and more

**[Deploy N8N on Railway](https://railway.com/template/n8n-railway)**

- **Creator:** A3A
- **Category:** Automation
- **Total deploys:** 2

## Template content

### n8n-worker https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/n8n.svg

- **Image:** ghcr.io/n8n-io/n8n:2.32.6
- **Start command:** `tini -- /docker-entrypoint.sh worker`
- **Health check:** /healthz

### n8n https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/n8n.svg

- **Image:** ghcr.io/n8n-io/n8n:2.32.6
- **Health check:** /healthz
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### n8n-runner https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/n8n.svg

- **Image:** ghcr.io/n8n-io/runners:2.32.6-distroless

## Documentation

![n8n Nodes](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

# Deploy and Host n8n on Railway

n8n is a source-available workflow automation platform where you wire triggers, apps, databases, and AI models together on a visual canvas. It ships 400+ native integrations plus a generic HTTP Request node. Deploy n8n on Railway and you get the editor, the execution tier, and the code sandbox as three separate services instead of one overloaded container.

Self-host n8n on Railway with five services wired together at deploy time. `n8n` serves the editor, REST API, and webhook endpoints from `ghcr.io/n8n-io/n8n:2.32.6` on port `5678`, and it is the only service with a public domain. `Postgres` stores workflows, encrypted credentials, execution history, and binary data. `Redis` is the job queue: because `EXECUTIONS_MODE=queue` is set, the main process never runs a workflow itself, it enqueues one. `n8n-worker` runs the same image with the `worker` command and pulls jobs off Redis. `n8n-runner` runs `ghcr.io/n8n-io/runners:2.32.6-distroless` and evaluates Code-node JavaScript and Python inside its own container, attached to the worker's task broker on port `5679`. The full request path is Railway edge → `n8n:5678` → Redis → worker → runner.

![n8n Railway architecture](https://res.cloudinary.com/rroe4rtk/image/upload/v1785653403/231_1x_shots_so_qnpnag.png)

## Getting Started with n8n on Railway

Open the generated Railway domain. Self-hosted n8n has no default credentials: the first visit shows the owner-account setup form, and whoever submits it becomes the instance owner, so reach the URL yourself before sharing it. n8n then offers a free community licence key by email that unlocks folders and richer execution debugging; skipping it costs you nothing. 

From Overview, click **Create Workflow**, add a Manual Trigger, add a Code node returning `[{ json: { ok: true } }]`, and press **Execute workflow** — that one run exercises the entire stack, because the request travels main → Redis → worker → the runner container that actually evaluates your JavaScript. 

Open **Executions** and confirm the run is listed as finished; a run stuck in *waiting* points at the worker or the Redis connection rather than the editor. 

![n8n dashboard screenshot](https://europe1.discourse-cdn.com/n8n/original/3X/1/d/1d726424ed9ace1ce06d4d6fedf68bef96637149.png)

## About Hosting n8n

- **Visual editor with 400+ integrations** — SaaS apps, databases, message queues, and an HTTP Request node for anything else.
- **Code nodes in JavaScript and Python** — full expression language, npm-style community packages, and per-item or per-run execution modes.
- **AI agent building blocks** — 70+ AI nodes covering chat models, tools, memory, embeddings, and vector stores for RAG workflows.
- **Production triggers** — webhooks, cron schedules, polling, and queue consumers, with retries and error workflows.
- **Encrypted credential vault** — secrets are encrypted at rest in Postgres and never rendered back into the editor.
- **Full execution history** — inspect, retry, and prune past runs from the UI or automatically.

## Why Deploy n8n on Railway

Railway handles the infrastructure work around a five-service n8n stack.

- Managed Postgres and Redis, provisioned with private networking already wired up.
- Free HTTPS domain with automatic TLS, so webhook URLs work immediately.
- Scale throughput by raising worker replicas instead of resizing a VPS.
- Usage-based pricing — pay for the CPU and RAM you actually burn.
- Per-service logs, metrics, variables, and one-click rollbacks.

## Common Use Cases for Self-Hosted n8n

- **AI agents and RAG assistants.** Chain a chat model, a vector store, and your internal APIs as tools so an agent can answer from company documents and take actions, with prompts and embeddings never leaving your infrastructure.
- **Scheduled data movement.** Cron-triggered syncs between Postgres, spreadsheets, warehouses, and SaaS tools, plus nightly reports, backups, and stale-record cleanups.
- **Internal API orchestration.** Expose a webhook as a lightweight internal endpoint that fans out to several microservices, normalises their responses, and returns one JSON payload — useful for support tooling and ops runbooks.

## Dependencies for n8n

- **`n8n`** — `ghcr.io/n8n-io/n8n`, the official image, current
- **`Postgres`** — Railway managed Postgres 13+ with its own volume at `/var/lib/postgresql/data`. Queue mode does not support SQLite, so Postgres is mandatory here.
- **`Redis`** — Railway managed Redis with a volume at `/data`, acting as the BullMQ job broker for queue mode.

### Deployment Dependencies

- Images: `ghcr.io/n8n-io/n8n` and `ghcr.io/n8n-io/runners` (also published as `docker.n8n.io/n8nio/n8n`).

## Hardware Requirements for Self-Hosting n8n

| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU across the stack | 4+ vCPU (≈1–2 per worker) |
| RAM | 2 GB total | 4–8 GB; 512 MB–1 GB per worker |
| Storage | 1 GB Postgres volume | 10 GB+ if binary data is stored in Postgres |
| Runtime | Node.js 22 (bundled in the image) | Postgres 13+ and Redis 6+ |

n8n is memory-hungry rather than CPU-hungry: a 4-core box with 8 GB of RAM outperforms an 8-core box with 4 GB.

## Self-Hosting n8n with Docker

For a quick single-container evaluation with SQLite, the Docker command is:

```
docker run -d --name n8n -p 5678:5678 \
  -v n8n_data:/home/node/.n8n \
  -e N8N_ENCRYPTION_KEY="$(openssl rand -hex 32)" \
  -e N8N_HOST=localhost -e N8N_PORT=5678 \
  ghcr.io/n8n-io/n8n:2.32.6
```

## n8n vs Zapier vs Make

| | n8n | Zapier | Make |
|---|---|---|---|
| Self-hosting | Yes, full stack | No | No |
| Licence | Sustainable Use License (fair-code) | Proprietary | Proprietary |
| Billing unit | Per workflow execution (or free when self-hosted) | Per task/step | Per operation |
| Native integrations | 400+ plus HTTP for any API | 6,000+ | 2,000+ |
| Custom code | JavaScript and Python nodes | Limited code steps | Limited code steps |
| AI agents | 70+ LangChain-based nodes, vector stores, memory | Add-on AI actions | Add-on AI actions |


## How Much Does n8n Cost to Self-Host?

The n8n Community Edition is free with no execution cap and no feature metering — self-host it and you pay zero licence fees. n8n Cloud starts around €20/month for 2,500 executions, and paid self-hosted Business and Enterprise tiers exist for SSO, Git-based version control, and multi-project governance. On Railway your cost is infrastructure only: five services (main, worker, runner, Postgres, Redis) billed on usage-based pricing for CPU, memory, egress, and volumes. 

One thing to note about the licence: the Sustainable Use License permits internal commercial use freely but restricts reselling n8n itself as a hosted service to third parties.

## FAQ

**What is n8n?**

n8n is a source-available workflow automation and AI agent platform with a visual node editor, 400+ integrations, JavaScript and Python code nodes, webhook and cron triggers, an encrypted credential store, and full execution history. It is licensed under the Sustainable Use License, which is fair-code rather than OSI open source.

**What does this Railway template deploy?**

Five services: `n8n` (editor and API, public domain, port `5678`), `n8n-worker` (executes workflows), `n8n-runner` (isolated Code-node runtime from `ghcr.io/n8n-io/runners:2.32.6-distroless`), plus managed `Postgres` and `Redis`. Secrets are generated at deploy time and the service references are pre-wired.

**Why does self-hosted n8n need Postgres and Redis?**

Postgres holds workflows, encrypted credentials, execution history, community-node records, and binary data — it is the only durable store in the stack, which is why no n8n service needs its own volume. Redis is the job broker that queue mode requires; without it the main process would execute workflows itself and one heavy run could block the editor.

**How do I scale n8n workers on Railway?**

Increase throughput by raising replicas on `n8n-worker`. Note that n8n requires one task-runner sidecar per worker, so give each worker its own runner service pointed at that worker's broker on port `5679` rather than sharing a single runner.

**Can I run Python code in self-hosted n8n?**

Yes. `N8N_NATIVE_PYTHON_RUNNER=true` enables the native Python runner in the launcher, so a Code node set to Python executes in the runner container alongside the JavaScript runtime.

**Do community nodes survive a redeploy without a volume?**

Yes. Nodes installed through the UI are recorded in Postgres, and `N8N_REINSTALL_MISSING_PACKAGES=true` reinstalls them on boot, so they persist across container replacements.

**Is n8n free for commercial use?**

Yes for your own internal business automations. The Sustainable Use License only restricts redistributing or reselling n8n itself as a hosted product to third parties; running it to automate your own operations needs no licence purchase.


## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — [Jul'26] WhatsApp automation platform using Evolution API, n8n & PostgreSQL
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

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