Deploy n8n [Aug 26]

n8n workflow automation + Postgres — 400+ integrations · Updated Aug 26

Deploy n8n [Aug 26]

/var/lib/postgresql/data

Deploy and Host n8n + Postgres on Railway

About Hosting

Railway provides a streamlined platform for deploying web applications and databases. This template runs n8n — the popular workflow automation platform with 400+ integrations — on Railway with a PostgreSQL database. n8n's official Docker image is pinned to a stable version, so deploys are reproducible and updates are a one-line bump.

Why Deploy

Deploying this template gives you a self-hosted automation platform in minutes:

  • Workflow automation — build no-code/code workflows with 400+ integrations (HTTP, webhooks, AI, Slack, Gmail, and more)
  • Postgres-backed — workflows, credentials, and execution history stored in PostgreSQL 16 instead of the default SQLite, ready for production
  • Zero manual setup — database migrations run automatically on boot; the Railway deploy wizard prompts for the encryption key
  • Cheap to run — the n8n service supports sleep (serverless) when idle; the Postgres service stays warm

Common Use Cases

  • Automation server — centralize integrations, webhooks, and scheduled jobs for your SaaS
  • AI workflows — connect LLM nodes with your data and APIs (n8n has native AI/agent nodes)
  • Team productivity — notifications, syncs, and internal tooling without writing glue code
  • Self-hosted alternative — replace hosted automation tools with your own instance and data control

Dependencies for

This template requires:

Deployment Dependencies

  • PostgreSQL 16 — add the Postgres service in the Railway dashboard; the template maps DB_* variables automatically
  • N8N_ENCRYPTION_KEY — required to encrypt stored credentials; generate with openssl rand -hex 16 (the deploy wizard will prompt you)
  • n8n 2.33.x image pinned in the Dockerfile (bump the tag to update)

Getting Started

  1. Click Deploy on Railway
  2. In the deploy wizard, provide N8N_ENCRYPTION_KEY (or generate one with openssl rand -hex 16)
  3. Add a Postgres service — Railway injects the connection variables automatically
  4. Open the generated domain and create your n8n account

Next Steps

  • Webhooks — set WEBHOOK_URL to https://${{RAILWAY_PUBLIC_DOMAIN}}/ so webhook URLs are reachable
  • Custom domain — add one to your n8n service and set N8N_HOST
  • Sleep (serverless) — enable sleep on the n8n service so it pauses when idle; Postgres stays awake

License

n8n is fair-code (Sustainable Use License). This template's wrapper and configuration are MIT.


Template Content

More templates in this category

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

jakemerson
119
View Template
Evolution API with n8n
Automate WhatsApp workflows with Evolution API, n8n, and Postgres.

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

Railway Templates
871