Deploy N8N | Open-Source AI Worklow Automation | Zapier Alternative
Self-host n8n workflow automation with workers, postgres, webhooks & Redis
N8N Pro Stack [w/ Worker & Postgres]
Just deployed
/var/lib/postgresql/data
main
Just deployed
/data
worker
Just deployed
Redis
Just deployed
/data
webhook
Just deployed

Deploy and Host n8n on Railway
n8n is an open-source, fair-code workflow automation platform that lets you connect 400+ apps, databases, and APIs through a visual node editor — with full code escape hatches when drag-and-drop isn't enough. Self-host n8n on Railway to keep your workflow data, API keys, and customer payloads in infrastructure you control, instead of routing them through a third-party SaaS.
This Railway deployment runs a production-grade, queue-mode n8n stack: a main editor/API service, a dedicated worker pool, a separate webhook processor, PostgreSQL for persistence, and Redis as the BullMQ job broker. Every tier scales independently, so you can handle thousands of concurrent executions by adding workers without touching the editor.

Getting Started with n8n on Railway
Once the deployment finishes, open the main service's public URL — the first visit launches the owner account setup wizard. Create your admin email and password; this account encrypts all future credentials using the shared N8N_ENCRYPTION_KEY Railway generated at deploy time.
From the editor, click Workflows → Add workflow, drop a trigger node (Webhook, Schedule, or any of the 400+ app nodes), and chain actions to build your first automation. Webhook URLs the editor generates will automatically point at the scalable webhook service, not the main editor, so production traffic bypasses the UI tier entirely.

About Hosting n8n
n8n (pronounced "n-eight-n", short for nodemation) is a workflow automation tool maintained by n8n GmbH under the Sustainable Use License. Unlike no-code SaaS tools, self-hosted n8n gives you root-level control over data, execution logs, and custom JavaScript/Python code nodes — without per-execution pricing or step caps.
Key features:
- Visual drag-and-drop editor with 400+ integrations
- Code nodes (JavaScript + Python) for custom logic inside any workflow
- Webhook, schedule, and event triggers
- Queue mode for horizontal scaling across worker processes
- Built-in version control, error workflows, and execution replay
- AI nodes with native LangChain integration
The deployment uses queue mode (EXECUTIONS_MODE=queue) — the main service enqueues jobs to Redis, and a pool of worker replicas pulls them off in parallel.
Why Deploy n8n on Railway
Railway gives you a faster path to a hardened, scalable n8n:
- One-click horizontal scaling for workers and webhooks
- Managed PostgreSQL and Redis with private networking
- Zero-config HTTPS and a public domain per service
- Per-service metrics, logs, and rollback
- Template environments ship production defaults out of the box
Common Use Cases for Self-Hosted n8n
- Internal data pipelines — sync Airtable, HubSpot, Stripe, Slack, and your own APIs
- Customer-facing webhooks that need low-latency, scalable ingestion
- AI agent workflows with LangChain-style chaining and tool calls
- Scheduled ETL jobs with custom JavaScript transformations
- Glue for lifecycle emails, PagerDuty alerts, and ticket routing
Dependencies for n8n
- n8n —
docker.n8n.io/n8nio/n8n:1— editor UI + REST API - n8n-worker —
docker.n8n.io/n8nio/n8n:1— executes queued workflows (n8n worker --concurrency=10) - n8n-webhook —
docker.n8n.io/n8nio/n8n:1— dedicated webhook receiver (n8n webhook) - Postgres —
ghcr.io/railwayapp-templates/postgres-ssl:18— workflow + credential storage - Redis —
redis:8— BullMQ queue broker
Environment Variables Reference
| Variable | Purpose |
|---|---|
N8N_ENCRYPTION_KEY | Encrypts all stored credentials. Must be identical across main/worker/webhook. |
EXECUTIONS_MODE=queue | Enables distributed execution via Redis |
DB_POSTGRESDB_* | PostgreSQL connection details |
QUEUE_BULL_REDIS_* | Redis broker connection details |
WEBHOOK_URL | Public URL used in generated webhook nodes |
N8N_DISABLE_PRODUCTION_MAIN_PROCESS | Keeps main service UI-only |
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS | Test runs routed to workers, editor stays responsive |
Deployment Dependencies
- Runtime: Node.js 20 (baked into image)
- Image: docker.n8n.io/n8nio/n8n
- Source: github.com/n8n-io/n8n
- Docs: docs.n8n.io/hosting
Hardware Requirements for Self-Hosting n8n
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU (main) + 1 vCPU per worker | 2 vCPU main + 2 vCPU × N workers |
| RAM | 512 MB (main) + 512 MB per worker | 1.5 GB main + 1.5 GB × N workers |
| Storage | 1 GB (volume) | 5 GB + S3 for binary data |
| Runtime | Node.js 20 | Node.js 20 LTS |
Scale by adding worker replicas when Redis queue depth grows; raise --concurrency=N when worker CPU is under 70%.
Self-Hosting n8n
The official Docker image runs standalone:
docker run -it --rm \
-p 5678:5678 \
-e N8N_ENCRYPTION_KEY=$(openssl rand -hex 32) \
docker.n8n.io/n8nio/n8n:1
For production queue mode with Postgres and Redis:
docker run -d --name n8n-worker \
-e EXECUTIONS_MODE=queue \
-e DB_TYPE=postgresdb \
-e DB_POSTGRESDB_HOST=postgres \
-e QUEUE_BULL_REDIS_HOST=redis \
-e N8N_ENCRYPTION_KEY=$ENCRYPTION_KEY \
docker.n8n.io/n8nio/n8n:1 \
n8n worker --concurrency=10
How Much Does n8n Cost to Self-Host?
n8n's community edition is free and open-source under the Sustainable Use License. You only pay for the infrastructure it runs on. The paid cloud tier starts at $20/month with 2,500 executions, scaling to $667/month for 75,000 executions on the Enterprise plan. Self-hosting on Railway removes per-execution caps entirely — you pay only for compute, storage, and bandwidth consumed.
n8n vs Zapier vs Make
| Feature | n8n (self-host) | Zapier | Make |
|---|---|---|---|
| Pricing model | Infrastructure only | Per-task | Per-operation |
| Code nodes (JS/Python) | ✅ Yes | ❌ No | Partial |
| Self-hosting | ✅ Yes | ❌ No | ❌ No |
| Visual editor | ✅ Yes | ✅ Yes | ✅ Yes |
| AI/LangChain nodes | ✅ Native | Partial | Partial |
n8n wins for developer-heavy teams that want code escape hatches and full data ownership; Zapier stays ahead on polish for non-technical users.
FAQ
What is n8n and why self-host it on Railway? n8n is an open-source workflow automation tool — think Zapier or Make, but self-hosted. Running it on Railway keeps your workflow data, API tokens, and customer payloads inside your own infrastructure.
What does this Railway template deploy?
Five services: the n8n editor, a worker pool (2 replicas, concurrency 10), a dedicated webhook service, managed PostgreSQL, and Redis. Everything is pre-wired via ${{ServiceName.VAR}} references.
Why does n8n need Postgres and Redis? Queue mode requires Postgres for shared state across workers (SQLite isn't supported) and Redis as the BullMQ job broker so workers can claim executions atomically.
How do I scale n8n for thousands of concurrent workflow executions?
Add replicas to the n8n-worker service first — each worker polls Redis independently. If CPU stays under 70%, also raise --concurrency=N on the worker start command. Add n8n-webhook replicas when webhook ingestion is the bottleneck.
Can I run Code nodes with custom Python on self-hosted n8n?
Yes. The image ships a JS runner by default and supports Python via external task runners. Set N8N_RUNNERS_ENABLED=true (already set in this template).
Is my n8n data encrypted?
All credentials in Postgres are encrypted with N8N_ENCRYPTION_KEY. Workflow definitions are stored in plaintext. Rotate the encryption key by migrating credentials manually — losing it makes every stored credential unreadable.
Template Content
