Railway

Deploy n8n-self-hosted

Deploy and Host n8n-self-hosted with Railway

Deploy n8n-self-hosted

Just deployed

/home/node/.n8n

/var/lib/postgresql/data

Deploy and Host n8n-self-hosted on Railway

n8n is an open-source workflow automation platform that lets you connect 400+ apps, APIs, and AI models with a visual drag-and-drop editor. Build everything from simple Zapier-style automations to complex AI agent workflows - self-hosted with full data ownership, no per-workflow limits, and zero vendor lock-in.

About Hosting n8n-self-hosted

Self-hosting n8n gives you complete control over your automation infrastructure - your workflows, credentials, and execution data stay on your own servers. This Railway template deploys n8n with a managed PostgreSQL database, pre-configured with secure environment variables, persistent storage, and a public HTTPS domain. Railway handles networking, SSL certificates, and container orchestration so you can focus on building workflows. Unlike n8n Cloud ($24/month for 2,500 executions), self-hosting on Railway costs ~$5-10/month with unlimited executions - making it ideal for teams running high-volume automations.

Common Use Cases

  • AI Agent Workflows : Build LangChain-powered AI agents that research, summarize, and respond using OpenAI, Anthropic, or local LLMs with built-in memory and tool-use nodes
  • CRM & Sales Automation : Sync leads between HubSpot, Salesforce, Google Sheets, and Slack. Trigger follow-up sequences, enrich contacts, and score leads automatically
  • DevOps & Monitoring : Monitor GitHub repos, trigger CI/CD pipelines, post deploy notifications to Discord/Slack, and auto-create Jira tickets from error alerts
  • Data Pipeline & ETL : Pull data from APIs, transform it with JavaScript/Python code nodes, and load into PostgreSQL, Airtable, Google Sheets, or data warehouses on a schedule
  • Product Ops & No-Code Automation : Automate user feedback triage from Typeform to Linear, sync Mixpanel cohorts to email tools, generate weekly product metrics reports, and connect Notion, Jira, and Slack without writing a single line of code — perfect for product managers who want to own their workflows without depending on engineering
  • Content & Social Media : Auto-publish blog posts to WordPress, schedule social media across platforms, generate AI content, and track engagement metrics in one workflow

Dependencies for n8n-self-hosted Hosting

  • PostgreSQL : Stores workflow definitions, credentials (encrypted), execution history, and user data. Railway provisions and manages this automatically with persistent volumes.
  • Persistent Volume : Mounted at /home/node/.n8n to persist the encryption key, custom nodes, and configuration across deploys.

Deployment Dependencies

Implementation Details

This template uses the official n8nio/n8n:2.19.2 Docker image with PostgreSQL configured via Railway's managed database service. Key environment variables are auto-wired using Railway's template variable references:

DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=${{Postgres.PGHOST}}
DB_POSTGRESDB_PORT=${{Postgres.PGPORT}}
DB_POSTGRESDB_DATABASE=${{Postgres.PGDATABASE}}
DB_POSTGRESDB_USER=${{Postgres.PGUSER}}
DB_POSTGRESDB_PASSWORD=${{Postgres.PGPASSWORD}}
N8N_ENCRYPTION_KEY=${{secret(32)}}
WEBHOOK_URL=https://${{n8n.RAILWAY_PUBLIC_DOMAIN}}

The encryption key is auto-generated at deploy time using Railway's secret() function, ensuring credentials stored in n8n are securely encrypted. The webhook URL is automatically set to the public Railway domain so webhook-triggered workflows work out of the box.

Why Deploy n8n-self-hosted 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-self-hosted 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.


Template Content

More templates in this category

View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
View Template
(v1) Simple Medusa Backend
Deploy an ecommerce backend and admin using Medusa

Shahed Nasser