Skip to main content

n8n on Railway vs Render: Why Free Hosting Fails and What Works

n8n on Railway or Render: why the free tiers lose your workflows, and the paid setup with Postgres, a volume and a fixed encryption key that works, with costs.

Founder of IImagined.ai

Published
Oct 11, 2026
Reading time
12 min read
Quick answer

n8n on Railway works once you pay: run n8n and Postgres in one Hobby-plan project, set a fixed encryption key, attach a volume with RAILWAY_RUN_UID=0, and keep Serverless off. Free hosting on Railway and Render fails for three reasons: the service sleeps or runs out of credit, the filesystem resets and takes SQLite with it, and the free database expires. Render's own n8n guide recommends paid Postgres and a 2 GB service, about $31 a month.

n8n on Railway works well once you pay for it: run n8n and Postgres in one project on the Hobby plan, set a fixed encryption key, attach a volume and leave Serverless off. Free hosting on Railway or Render fails for the same three reasons: the service sleeps or runs out of credit, the filesystem resets and takes the SQLite database with it, and the free Postgres database expires.

Checked on 11 October 2026 against Railway's docs on plans, the free trial, volumes, backups, Serverless, variables, PostgreSQL and image updates; Render's n8n deploy guide, free instance and disk docs and pricing; and n8n's database, encryption key, reverse proxy and backup docs. We did not deploy these stacks for this article; every setting below comes from those pages and was checked against them. n8n has no official Railway guide, so the Railway steps are assembled from the two sets of docs.

Both platforms make the first deploy easy, which is the trap. n8n comes up, you build a workflow, and a few days later it is gone or asleep. Nothing is wrong with the platform or with n8n: a free tier built for previews has met an app that must stay awake and write to disk. This guide explains the failure, then gives the paid configuration on each platform. For every other way to run n8n, see our n8n hub; for the wider free-tier picture, our free n8n hosting comparison.

n8n Render free hosting and Railway's free credit: why they fail

What the free tier does to n8n, and what the paid setup changes
On a free tier
  • The service stops when idle or when the credit is spent
  • Schedule Triggers cannot fire while it is stopped
  • SQLite lives on a filesystem that resets
  • The encryption key resets with it, so saved credentials cannot be read
  • The free Postgres database has an expiry date
On the paid setup
  • The service stays on around the clock
  • Workflows and credentials live in Postgres
  • A fixed encryption key is set as a variable
  • A volume or disk keeps the .n8n folder
  • Backups run on a schedule you choose

Render. Its docs say Render "spins down a Free web service that goes 15 minutes without receiving any inbound traffic", and add: "Whenever a service spins down, any changes to its local filesystem are lost". n8n's default database is a SQLite file in its .n8n folder, next to the key that encrypts your credentials. So on the free tier, a quiet quarter of an hour is a factory reset. Render's own n8n guide routes around this with Postgres, then states the catch: "free Render Postgres databases expire after 30 days".

Railway. There is no sleeping free tier to fight; there is a meter. The trial is a one-time $5 credit that lasts up to 30 days, after which the Free plan gives $1 of credit a month with 0.5 GB of memory per service. Memory is billed at $10 per GB a month, so half a gigabyte running all month is $5 of usage against $1 of credit. Railway also deletes volumes created by trial accounts 30 days after the credit expires.

RailwayRender
Free offer$5 trial credit for 30 days, then $1 of credit a monthFree web service (512 MB) and a free Postgres database
What stops itCredit runs out; 0.5 GB memory cap on the Free planSpins down after 15 idle minutes; free Postgres expires after 30 days
Persistent storageVolumes: 0.5 GB on Free and Trial, 5 GB on Hobby, 50 GB on ProDisks on paid services only, $0.25 per GB a month
Cheapest always-on setupHobby: $5 a month including $5 of usageSmallest paid service ($7) + smallest paid Postgres ($6) = $13
Sleep behaviour when paidServerless is opt-in; leave it offPaid services do not spin down
Built-in backupsVolume backups: daily kept 6 days, weekly 27, monthly 89Disk snapshots daily, kept at least 7 days; Postgres point-in-time recovery
Updating n8nChange the image tag, or use image auto updatesChange the tag in render.yaml, or Manual Deploy

What you will have at the end

The working setup, on either platform
  1. 01
    Platform proxy

    Terminates HTTPS on the platform domain or your own. No certificate work.

  2. 02
    n8n service

    The official image, pinned to a version, always on.

  3. 03
    Postgres service

    Workflows, credentials and executions, reached over the private network.

  4. 04
    Volume or disk

    The .n8n folder: community nodes and files. Optional on Render.

  5. 05
    Scheduled backups

    Of the database volume, plus your own exports now and then.

Prerequisites

Pre-flight checklist
  • A Railway account on the Hobby plan, or a Render account with a card added
  • A password manager entry ready for the n8n encryption key
  • A key generated on your own machine: openssl rand -hex 32
  • The n8n version you will pin, from n8n's GitHub releases page (2.42.6 when we checked)
  • A domain, if you want n8n on your own address instead of the platform one
  • An idea of your volume: how many workflows run, how often, and whether they move files

n8n Railway setup: the paid config that works

Step 1: create the project and add Postgres

In a new project, select + New and add a PostgreSQL database. Railway deploys it with its own volume and keeps it private to the project by default.

Expected result: a Postgres service on the canvas with PGHOST, PGUSER, PGPASSWORD and PGDATABASE in its variables.

Step 2: add n8n from the Docker image

Select + New again, choose Docker Image and enter n8nio/n8n:2.42.6, or whichever stable version is current. Pin a version, not latest: n8n ships a release most weeks and a major version changes behaviour on purpose.

Step 3: set the variables

Open the n8n service, go to Variables, choose the RAW Editor and paste this, with your own key and timezone. Postgres must match the name of your database service.

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=paste-your-own-64-character-key
N8N_WEBHOOK_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}/
N8N_PROXY_HOPS=1
GENERIC_TIMEZONE=Europe/Berlin
TZ=Europe/Berlin
N8N_USER_FOLDER=/home/node
RAILWAY_RUN_UID=0
VariableWhy it is there
DB_TYPE and the DB_POSTGRESDB_* linesPoint n8n at the Postgres service over Railway's private network instead of SQLite
N8N_ENCRYPTION_KEYA key you choose and store. Without it n8n generates one on the disk, and losing that file locks every credential
N8N_WEBHOOK_URL and N8N_PROXY_HOPSCorrect public webhook addresses behind Railway's proxy. N8N_WEBHOOK_URL needs n8n 2.35.0 or later
N8N_USER_FOLDERKeeps n8n's data folder at /home/node/.n8n, where the volume is mounted, whichever user the process runs as
RAILWAY_RUN_UID=0Railway mounts volumes as root; its docs say to set this for images that run as a non-root user, as n8n's does

Expected result: after the deploy, the n8n log shows database migrations running against Postgres, not a SQLite file.

Step 4: attach a volume

Right-click the canvas, create a volume, connect it to the n8n service and set the mount path to /home/node/.n8n. Railway's volume docs are specific about the next part: "Volumes are mounted as the root user. If you run an image that uses a non-root user, you should set" RAILWAY_RUN_UID=0. The n8n image runs as the node user, which is why that line is in the variables above.

Step 5: generate a domain and keep the service awake

In the n8n service, open Settings, Networking, Public Networking and select Generate Domain. Railway detects the port the app listens on; confirm the target port is 5678. For your own domain, add both the CNAME and the TXT record Railway shows, since it will not verify with only one. Then check that Serverless is off. With it on, Railway sleeps a service 5 to 10 minutes after its last outbound traffic, and the first request to a slept service "may return a 502 Bad Gateway response".

Expected result: the n8n owner setup screen on an HTTPS address. Create the owner account at once and enable two-factor authentication.

Step 6: turn on backups and a usage alert

Open the Postgres service's Backups tab and pick a schedule: daily backups are kept for 6 days, weekly for 27 and monthly for 89. Backups restore only into the same project and environment, and wiping a volume deletes its backups, so export your workflows from n8n now and then as a copy that lives elsewhere. On the workspace usage page, set an email alert. Be careful with the hard limit next to it: Railway takes all workloads offline when it is reached.

Step 7: keep it patched

A pinned version only helps if you move it on purpose. n8n recommends updating at least monthly, and its batch of security advisories on 30 September 2026, which included a SQL injection in the Microsoft SQL node (GHSA-5qpp-pqww-h7fp), was fixed in 2.42.1 and 2.41.4. Railway shows an update button in the service settings when a newer image exists, and its image auto updates can be limited to patch releases inside a maintenance window. Two more items from n8n's docs belong on the list once real credentials are stored: enable two-factor authentication, and read the task runner page, which says to run Code node runners in external mode in production. On a platform that means one more service.

Railway, at a glance
  1. 1
    Project and Postgres

    One project, Railway's PostgreSQL service.

  2. 2
    n8n from the image

    n8nio/n8n with a pinned version tag.

  3. 3
    Variables

    Database references, your encryption key, webhook URL.

  4. 4
    Volume

    Mounted at /home/node/.n8n, with RAILWAY_RUN_UID=0.

  5. 5
    Domain, Serverless off

    Target port 5678; owner account and 2FA.

  6. 6
    Backups and alert

    Scheduled volume backups; an email alert, not a low hard limit.

  7. 7
    Patch on a schedule

    Move the pinned tag monthly, sooner for security fixes.

The Render config that works

Render publishes its own n8n guide, so follow it and change three things. It recommends Postgres over a disk because a disk "prevents zero-downtime deploys" and can be used by only one instance.

  1. Open the render-examples/n8n template on GitHub and create your own repository from it.
  2. Edit render.yaml as below: paid plans for both resources, a pinned image, and the port.
  3. In the Render dashboard, choose New, Blueprint, connect the repository and deploy.
  4. On the service's Environment page, add N8N_WEBHOOK_URL with your onrender.com address and N8N_PROXY_HOPS set to 1. Render's guide shows the older WEBHOOK_URL name, which n8n deprecated in 2.35.0.
  5. Copy the generated N8N_ENCRYPTION_KEY value into your password manager. The template's own comment warns that changing it loses access to every stored credential.
# render.yaml from the render-examples/n8n template, with three changes
services:
  - type: web
    plan: 1c-2g                             # was: free
    runtime: image
    name: n8n-service
    image:
      url: docker.io/n8nio/n8n:2.42.6       # was: latest
    envVars:
      - key: N8N_ENCRYPTION_KEY
        generateValue: true
      - key: PORT                           # added: n8n's port
        value: "5678"
      # ...keep the DB_TYPE and DB_POSTGRESDB_* entries from the template

databases:
  - name: n8n-db
    plan: 0.1c-256mb                        # was: free

On sizing, Render is blunt: "we recommend running your web service on the 1c-2g compute plan or larger. Otherwise, n8n might encounter performance issues." The smallest paid service has 512 MB and will start, but that sentence is the reason not to plan on it. If you would rather keep SQLite, the same guide covers a paid service with a disk mounted at /home/node; Render snapshots disks daily and keeps them at least seven days.

What each option costs a month

Published monthly price of an always-on n8n setup (USD)
Railway Hobby, includes $5 of usage
from $5
Render: 512 MB service + Postgres
$13
Hostinger KVM 2 VPS, at renewal
$14.99
Render: 2 GB service + Postgres
$31

Railway bills usage beyond the included $5. For comparison, n8n Cloud Starter is €20 a month billed annually. Source: railway.com/pricing, render.com/pricing and hostinger.com/vps-hosting, checked October 2026

Railway is the one number you have to work out yourself. With illustrative inputs, not measurements: if n8n and Postgres together average 1 GB of memory and 0.2 vCPU across a month, with 2 GB of volumes, the published rates give $10 + $4 + $0.30 = $14.30. The Hobby plan's $5 is part of that total, not on top of it. Halve the memory and the same sum comes to $9.30. Watch the usage page for a week and replace these inputs with your own.

Our self-hosted n8n pricing breakdown runs the same comparison against VPS providers and n8n Cloud, including the hours of upkeep no invoice shows.

n8n Railway vs Hostinger: platform or server?

This is the choice most people are really making. Railway and Render are platforms: you get a dashboard, a proxy and managed backups, and you pay for what the containers use. A VPS is a server: a fixed price, far more memory per dollar, and an operating system that is yours to patch.

Railway or a Hostinger VPS for n8n
Railway fits when
  • You do not want to administer Linux
  • The instance is light, so usage billing stays low
  • You want volumes, backups and HTTPS from a dashboard
  • You may add workers or other services to the same project later
A Hostinger VPS fits when
  • You want one fixed monthly price whatever n8n uses
  • You need memory: KVM 2 lists 8 GB for $14.99 at renewal
  • You are comfortable with SSH, updates and a firewall
  • You want full control of the Docker Compose stack

If the right-hand column is you, our guide to hosting n8n on Hostinger covers the plan choice and the backup job, and the Docker Compose setup guide has the full production stack. Either way, the limits of the free Community Edition come with you; they are listed in n8n self-hosted limitations.

Troubleshooting

  • Credentials cannot be decrypted after a redeploy. n8n started with a new encryption key. This is preventable, not fixable: restore the original key if you saved it, otherwise re-enter the credentials.
  • Permission errors writing to the volume on Railway. RAILWAY_RUN_UID=0 is missing from the n8n service.
  • A 502 on the first request after a quiet spell. Serverless is enabled. Turn it off and redeploy; the setting applies when a container is created.
  • Webhook URLs show port 5678 or an internal address. N8N_WEBHOOK_URL is missing or points at the wrong domain.
  • Render's Blueprint fails to create the database. The workspace already has a free Postgres database; each workspace is limited to one.
  • Everything on Railway stopped mid-month. A hard usage limit was reached. Raise or remove it on the usage page.

One last check before you commit to either platform: what the instance is for. If it runs your own automations, the setup above is the end of the job. If it is becoming the backend of something customers use, the AI SaaS Builder program is the better next step. It has no n8n lessons; it covers building the product itself with Supabase and the Claude API, deploying it on Vercel and adding Stripe billing. And if you are still deciding whether to self-host at all, our n8n Cloud vs self-hosted guide prices that decision.

n8n on Railway and Render: FAQ

Can you run n8n on Railway?

Yes, and it works well on a paid plan. Create a project with Railway's PostgreSQL service and a second service from the n8nio/n8n Docker image, point n8n at the database with reference variables, set a fixed N8N_ENCRYPTION_KEY, attach a volume at /home/node/.n8n and generate a domain. Leave Serverless switched off so the service never sleeps. The Hobby plan is 5 dollars a month including 5 dollars of usage.

Is Railway free for n8n?

Not for long. New accounts get a one-time 5 dollar trial credit that expires after 30 days, then drop to the Free plan with 1 dollar of credit a month and a limit of 0.5 GB of memory per service. Railway bills memory at 10 dollars per GB a month, so an always-on n8n service outruns that credit. Volumes created on a trial are deleted 30 days after the credit expires.

Why does n8n lose its data on Render's free tier?

Because the default database is a SQLite file on the container's own disk, and Render's free web services have an ephemeral filesystem. Render spins a free service down after 15 minutes without inbound traffic, and local file changes are lost whenever that happens. Persistent disks need a paid service, and the free Postgres database that would hold the data instead expires 30 days after creation.

How much does n8n cost on Railway compared with Render?

Checked October 2026: Railway's Hobby plan is 5 dollars a month with 5 dollars of usage included, then memory at 10 dollars per GB and CPU at 20 dollars per vCPU a month. On Render, the smallest paid web service is 7 dollars and the smallest paid Postgres is 6 dollars, so 13 dollars a month; Render's own n8n guide recommends a 2 GB service at 25 dollars, which makes 31.

Do I still need a volume if n8n uses Postgres?

Workflows, credentials and executions live in Postgres, so the volume matters less, but the .n8n folder still holds the encryption key file, community nodes and any files stored in filesystem mode. Set N8N_ENCRYPTION_KEY as an environment variable so the key never depends on the disk, and attach a small volume if you install community nodes or handle files. On Render, its guide treats Postgres alone as enough.

Should I host n8n on Railway or Hostinger?

Railway if you want a platform: no Linux administration, usage billing and backups from a dashboard. Hostinger if you want a server: a fixed monthly price and far more memory for the money, with updates, firewall and backups in your hands. Light instances tend to suit Railway's billing; busy ones with AI or file workflows are easier to budget on a VPS.

All Access · all four programs · $99/mo

Deployed and awake. Now make it worth the bill.

AI SaaS Builder, included in All Access, is about what you build once hosting is solved: an app on Supabase with the Claude API behind it, deployed on Vercel, with Stripe taking payments. It teaches deployment and environment variables properly, though not on n8n. The other three programs, weekly coaching and the community come with the same subscription.

Start All Access — $99/mo →30-day money-back guarantee
Free

Stuck on a variable or a volume?

Paste the error into the free Discord and ask people running n8n on Railway and Render, or check the free-tier terms on every other host first.