n8n 2 Workflow Automation (Postgres)

Deploys n8n 2.47.7 as a single service with Postgres: editor, triggers, webhooks and JavaScript Code nodes in one process. The owner account is created at deploy so nobody else can claim the instance. A small, low-cost setup without queue mode.

What you get

  • One n8n service pinned by tag and digest, from the official image's stable channel
  • Postgres 18 on a volume holding workflows, credentials, executions and uploaded files (up to 512 MiB per file)
  • Owner login generated at deploy from N8N_INSTANCE_OWNER_EMAIL and N8N_OWNER_PASSWORD, so there is no open setup page
  • Old executions pruned to keep the database small; n8n waits for Postgres on a cold start
  • No volume on the n8n service, which allows zero-downtime redeploys; community nodes reinstall on boot

Good for

  • Webhook and API automations between SaaS tools such as Slack, Google Sheets, HubSpot, Stripe and Notion
  • Scheduled syncs, reports and data clean-up jobs
  • AI agent and chatbot workflows with OpenAI, Anthropic or other LLM nodes
  • A low-cost personal or team automation server to grow from

Cost

Measured on Railway (n8n 2.47.7): n8n uses about 0.5 GB of RAM at idle and up to about 0.85 GB during first-boot migrations, and Postgres about 0.1 GB. The template notes put a lightly used instance at roughly $6 to $7 a month at Railway's usage prices.

Services in this template

  • n8n · from baranberkay96/n8n-railway
  • Postgres · image ghcr.io/railwayapp-templates/postgres-ssl:18.6@sha256:4fc833b43d2aaf6ecc9b18615f5533602b723a32d0e2efe2dae8ca0f7217c863

Questions people ask

How do I log in?

Open the n8n service Variables tab. The login is N8N_INSTANCE_OWNER_EMAIL (default admin@example.com) and the generated N8N_OWNER_PASSWORD. Set your own email there and redeploy if you prefer. The owner is managed by these variables unless you set N8N_INSTANCE_OWNER_MANAGED_BY_ENV to false.

What drives the cost?

Mostly n8n's memory, plus a small Postgres service and its volume. CPU use at idle is close to zero. Larger files, big data sets or many parallel executions raise memory.

What must I back up?

Keep a copy of N8N_ENCRYPTION_KEY outside Railway and never change it after first boot: it encrypts every saved credential and is needed to restore the database elsewhere. The template includes no automatic backup, so back up Postgres yourself, especially before major upgrades.

What is not included?

No queue mode or worker scaling, and Code nodes run JavaScript only; Python Code nodes need n8n's external task runners. The template notes point to a separate queue-mode template for growth.

What licence applies?

n8n uses the Sustainable Use License: free for your own internal business, personal or non-commercial use, but not for selling n8n as a hosted service. Files with .ee in the name need an n8n Enterprise licence. Check the licence or ask n8n GmbH or a lawyer for customer-facing uses.

Full template README

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

Service Role Public
n8n Editor, REST API, triggers, webhooks, forms and the JavaScript task runner for Code nodes yes
Postgres Workflows, credentials, executions and binary data; private only, with a volume no

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.

Guides for this template

View n8n 2 Workflow Automation (Postgres) on railway.com

Similar templates

TemplateCategoryDeploymentsDeploys
N8N (w/ workers)
A powerful workflow automation tool for technical people
Automation114,737
n8n
n8n [Nov '26] (Workflows/Integrations/API Automation/AI Coding) Self Host
Automation17,560
Typebot
Build advanced chatbots visually
Automation8,968
n8n
n8n workflow automation on PostgreSQL, webhooks and secrets preconfigured
Automation5,850
n8n with workers
A complete setup for n8n with workers
Automation4,040
N8N (w/ webhook processors)
A powerful workflow automation tool for technical people
Automation3,386