Railway

Deploy n8n Automation Hub – Self-Hosted

[Jun'26] Self-hosted n8n: 400+ integrations, Postgres DB & AI workflows

Deploy n8n Automation Hub – Self-Hosted

Just deployed

Deploy and Host n8n on Railway

Self-host the open-source alternative to Zapier — unlimited executions, no per-task billing, full data ownership.

n8n is the world's most popular open-source workflow automation platform with 188k+ GitHub stars, 100M+ Docker pulls, and 500+ integrations. Build powerful automations visually, write code when you need it, and connect AI agents, APIs, and databases — all without execution caps or vendor lock-in.

n8n workflow builder


What This Template Deploys

ServicePurpose
n8nWorkflow engine and visual editor, accessible at your Railway public URL on port 5678
PostgreSQLManaged Railway database — stores workflows, credentials, and execution history persistently

Both services connect over Railway's private network. PostgreSQL credentials are injected automatically — no manual configuration required.


Deploy in Under 5 Minutes

  1. Click Deploy on Railway and wait for the build to complete (~2–3 minutes)
  2. Railway provisions n8n + PostgreSQL automatically
  3. Open your Railway URL — set your admin credentials on first launch
  4. Start building workflows immediately

No SSH. No Docker Compose. No reverse proxy. No SSL certificates to manage.


Configuration

VariableRequiredDescription
DB_TYPE✅ Pre-setpostgresdb — connects n8n to Railway PostgreSQL
DB_POSTGRESDB_HOST✅ Auto-injectedPostgreSQL private hostname via Railway reference variable
DB_POSTGRESDB_DATABASE✅ Auto-injectedDatabase name from Railway PostgreSQL service
DB_POSTGRESDB_USER✅ Auto-injectedDatabase user from Railway PostgreSQL service
DB_POSTGRESDB_PASSWORD✅ Auto-injectedDatabase password via Railway secret reference
WEBHOOK_URL✅ RequiredYour Railway public URL — required for webhook triggers to work
N8N_BASIC_AUTH_ACTIVERecommendedSet to true — protects the n8n UI from public access
N8N_BASIC_AUTH_USERRecommendedUsername for basic auth
N8N_BASIC_AUTH_PASSWORDRecommendedPassword for basic auth — use a strong value
N8N_ENCRYPTION_KEYRecommended32-character random string — encrypts stored credentials
PORTPre-set5678 — the default n8n port

Set WEBHOOK_URL to your Railway public domain. Find it under your n8n service → Settings → Domains. Without this, webhook-triggered workflows will not receive external traffic.


Common Use Cases

  • Self-hosted alternative to Zapier — replace per-task billing with unlimited executions; a 10-step workflow costs 1 execution on n8n vs 10 tasks on Zapier
  • AI and LLM workflow orchestration — connect Claude, GPT-4o, or Gemini to APIs, databases, and business logic using n8n's native AI and LangChain nodes
  • Webhook-based real-time integrations — receive live events from Stripe, GitHub, Shopify, and any third-party service; apply business rules and trigger downstream actions
  • Business process automation — automate CRM updates, support routing, invoice processing, Slack alerts, and cross-tool data sync without execution caps
  • Scheduled background jobs — run cron-based workflows for reports, monitoring, data backups, and recurring operational tasks at any frequency

n8n automation workflows overview


n8n vs. Alternatives

n8n (self-hosted)n8n CloudZapierMake
Monthly cost~$5 (Railway)From $20From $19.99From $9
Executions✅ Unlimited❌ 2,500–10,000 cap❌ Per step❌ Per operation
Data ownership✅ Your infra⚠️ n8n servers❌ Zapier servers❌ Make servers
Custom code✅ JS/Python + npm✅ Yes❌ Limited❌ Limited
AI/LLM nodes✅ Native✅ Yes⚠️ Basic⚠️ Basic
Self-hostable✅ Yes❌ No❌ No❌ No

Frequently Asked Questions

How much does it cost to run n8n on Railway? Around $5/month on Railway's Hobby plan — with unlimited workflow executions. n8n Cloud Starter costs $20/month but caps you at 2,500 executions. Zapier Starter is $19.99/month for 750 tasks where every step in a workflow counts separately.

Do I lose my workflows if Railway redeploys? No. Everything is stored in the Railway-managed PostgreSQL database — not inside the container. Redeploys, updates, and restarts do not touch your workflows, credentials, or execution history.

Do webhooks work on Railway? Yes. Set WEBHOOK_URL to your Railway public domain and external services can trigger your workflows in real time. Railway provides automatic HTTPS — no certificate setup needed.

Can I use n8n's AI and LangChain nodes when self-hosting? Yes — all of them. Claude, GPT-4o, Gemini, Pinecone, Qdrant, and all vector store integrations are included in the free Community Edition. Bring your own API keys. No AI execution limits.

What features does self-hosted Community Edition not include vs n8n Cloud? Only enterprise-grade extras: SSO/SAML, advanced RBAC, audit log streaming, and dedicated support SLAs. All 500+ integrations, AI nodes, and core workflow features are fully available self-hosted.

How do I update n8n to a newer version? Change the Docker image tag in Railway service settings (e.g. n8nio/n8n:2.20.9) and redeploy. Your PostgreSQL data is unaffected. Pin to a specific version in production — avoid latest to prevent unexpected breaking changes.


Why Deploy n8n 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 on Railway, you get unlimited workflow executions, a production-grade PostgreSQL backend, automatic HTTPS webhook support, and zero server administration — at ~$5/month flat, with full ownership of your data and automations.


Resources


Template Content

More templates in this category

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

jakemerson
View Template
NEW
Evolution API with n8n
WhatsApp HTTP REST API with n8n automation, PostgreSQL and Redis.

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

Railway Templates