Deploy n8n deployment
Environment for self hosting n8n.
Just deployed
/var/lib/postgresql/data
striking-inspiration
Just deployed
/home/node/.n8n
Deploy and Host n8n on Railway
n8n is a fair-code workflow automation platform that connects 400+ apps and services through a visual, node-based editor. It lets you build automations ranging from simple integrations to complex, AI-powered workflows — with the option to drop into JavaScript or Python code whenever you need full control.
About Hosting n8n
Hosting n8n means running its Node.js server together with a persistent database for workflow definitions, credentials, and execution history. This template deploys the official n8n Docker image on Railway, backed by a PostgreSQL database provisioned alongside it. Encryption keys, database credentials, and the public webhook URL are wired up automatically through Railway environment variables, so webhooks work out of the box. Railway handles TLS, networking, and restarts, and you can scale vertically as your workflow volume grows. Upgrades are as simple as redeploying with a newer image tag.
Common Use Cases
- Automating business processes such as lead routing, CRM syncing, invoicing, and notification pipelines
- Building AI agents and LLM-powered workflows that combine models with your existing tools and data
- Integrating internal APIs, databases, and SaaS services without writing and maintaining custom glue code
Dependencies for n8n Hosting
- PostgreSQL database (provisioned automatically by this template)
- n8n encryption key (generated and set via environment variables)
- Basic auth credentials (must be set to your own values before deploying)
Deployment Dependencies
Implementation Details
The template sets the key environment variables needed for a production deployment:
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=${{Postgres.PGHOST}}
DB_POSTGRESDB_DATABASE=${{Postgres.PGDATABASE}}
N8N_ENCRYPTION_KEY=
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=
N8N_BASIC_AUTH_PASSWORD=
WEBHOOK_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
N8N_PORT=5678
> ⚠️ Important: Before deploying, set the N8N_BASIC_AUTH_USER and N8N_BASIC_AUTH_PASSWORD variables to your own credentials in the template configuration screen. Do not deploy with placeholder or default values — your n8n instance would be publicly reachable with credentials anyone could guess.
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 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
PGDATA
automatically generated inside the database service when you provision a PostgreSQL instance
PGPORT
automatically generated inside the database service when you provision a PostgreSQL instance
POSTGRES_DB
automatically generated inside the database service when you provision a PostgreSQL instance
POSTGRES_USER
automatically generated inside the database service when you provision a PostgreSQL instance
SSL_CERT_DAYS
automatically generated inside the database service when you provision a PostgreSQL instance
RAILWAY_DEPLOYMENT_DRAINING_SECONDS
automatically generated inside the database service when you provision a PostgreSQL instance
striking-inspiration
Alig1493/n8n-dockerN8N_HOST
Domain of the host. Find this in the settings of this instance.