Deploy n8n 2 Workflow Automation (Postgres)

Simple, low-cost n8n with Postgres, secure owner login and pinned version.

Deploy n8n 2 Workflow Automation (Postgres)

Deploy and Host n8n with Railway

n8n is a fair-code workflow automation platform with a visual editor, 400+ integrations, webhooks and AI agent nodes. This community template runs one n8n 2.47.7 service with Postgres: the simple, low-cost setup most projects need, with the owner account created for you so nobody can claim your instance first.

About Hosting n8n

Most n8n templates either leave the setup page open (the first visitor becomes the owner) or ship a full queue-mode stack you may not need yet. This one is deliberately small: a single n8n process that runs the editor, triggers, webhooks and JavaScript Code nodes, and a Postgres database that keeps workflows, credentials, executions and uploaded files. The n8n version is pinned by tag and digest, the owner login is generated at deploy, old executions are pruned so the database stays small, and n8n waits for Postgres on a cold start instead of crash-looping. Measured on Railway: about 0.5 GB of RAM for n8n and 0.1 GB for Postgres at idle.

Common Use Cases

  • Webhook and API automations between SaaS tools (Slack, Google Sheets, HubSpot, Stripe, Notion)
  • Scheduled syncs, reports and data clean-up jobs
  • AI agent and chatbot workflows with OpenAI, Anthropic or other LLM nodes
  • Forms and simple internal tools with n8n's Form trigger
  • A cheap personal or team automation server to grow from

Dependencies for n8n Hosting

  • n8n 2.47.7 (n8nio/n8n, official image, stable channel)
  • PostgreSQL 18 (Railway's postgres-ssl image)

Deployment Dependencies

Implementation Details

ServiceRolePublic
n8nEditor, REST API, triggers, webhooks, forms and the JavaScript task runner for Code nodesyes
PostgresWorkflows, credentials, executions and binary data; private only, with a volumeno

First login

  1. Wait until the n8n service is healthy. The first deploy builds a thin image on top of n8n's official one and runs database migrations, which takes a few minutes.
  2. Open the n8n service → Variables. Your login is N8N_INSTANCE_OWNER_EMAIL (default admin@example.com) and N8N_OWNER_PASSWORD (generated, 24 characters).
  3. Open the n8n service's public domain and sign in.

To use your own email, set N8N_INSTANCE_OWNER_EMAIL (before or after the first deploy) and redeploy. The owner is managed by these variables (N8N_INSTANCE_OWNER_MANAGED_BY_ENV=true): n8n creates or updates the account before it serves any page, so there is no setup page to claim, and the owner's email and password are changed here, not in n8n's settings. To manage the owner inside n8n instead, set N8N_INSTANCE_OWNER_MANAGED_BY_ENV=false after the first login and redeploy. Invalid values never break the deploy: an invalid email falls back to admin@example.com, and a password shorter than 8 characters locks the login until you set a valid one (the deploy log says so).

Keep N8N_ENCRYPTION_KEY. It encrypts every credential you save. Never change it after the first boot, and keep a copy outside Railway: restoring the database elsewhere needs it.

Custom domain. Add it in the n8n service's Settings → Networking, then set N8N_EDITOR_BASE_URL to https://{your-domain} and N8N_WEBHOOK_URL to https://{your-domain}/ and redeploy, so webhook and OAuth callback URLs use it.

Timezone. Schedule triggers use GENERIC_TIMEZONE (default Etc/UTC), for example Europe/Istanbul or America/New_York.

Files and community nodes. The n8n service has no volume, which keeps it cheap and allows zero-downtime redeploys. Files that workflows handle are stored in Postgres (N8N_DEFAULT_BINARY_DATA_MODE=database, up to 512 MiB per file), and community nodes are reinstalled automatically on boot.

Resources and plans. Measured on Railway (n8n 2.47.7, 2026-11-14): n8n uses about 0.5 GB of RAM at idle with no memory limit and up to about 0.85 GB while it runs its database migrations on the first boot; Postgres uses about 0.1 GB. That is roughly $6-7 a month at Railway's usage prices for a lightly used instance. Deployed from this template under a 0.5 GB limit (the Free plan's per-service cap), n8n completed its first boot (touching the limit during migrations), idled at about 0.43 GB and ran workflows with Code nodes, so Free works for small automations, but with little headroom: large files, big data sets or many parallel executions can run out of memory there. Trial (1 GB per service) and Hobby or Pro are the comfortable choices. CPU use at idle is close to zero.

What this template does not include. Code nodes run JavaScript only (Python Code nodes need n8n's external task runners). There is no queue mode, worker scaling or automatic backup. When one process is no longer enough, move to our n8n 2 Production Stack (Queue Mode, Workers, Python) template on Railway: deploy it, then copy your data over by exporting workflows and credentials with n8n export:workflow --all and n8n export:credentials --all --decrypted (Railway's service shell) and importing them there, or by restoring a pg_dump of this Postgres into the new one with the same N8N_ENCRYPTION_KEY. Treat decrypted exports as secrets.

Upgrading n8n. The version is pinned in services/n8n/Dockerfile (tag and digest). When this template is updated, Railway shows an update for the n8n service. To pick a version yourself, eject the service to your own GitHub repo and change the FROM line to another stable release. Read n8n's release notes first; database migrations run automatically on boot. Back up Postgres before major upgrades.

License. n8n is distributed under the Sustainable Use License: free for your own internal business, personal or non-commercial use, but not for reselling n8n as a hosted service. See NOTICE.md in the template repository. This is a community template, not affiliated with n8n GmbH.

Why Deploy n8n on Railway?

Railway runs n8n and its Postgres database in one project with a private network, HTTPS domains, logs and usage-based pricing. This template gives you a working, locked-down n8n in a few minutes, keeps the running cost low, and leaves a clear path to the queue-mode stack when your automations grow.


Template Content

More templates in this category

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

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

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

Railway Templates
868