DEV Community

Cover image for Cheapest Way to Host a Node.js + Postgres App in 2026
devstack-blog
devstack-blog

Posted on Edited on Originally published at leanstack.pages.dev

Cheapest Way to Host a Node.js + Postgres App in 2026

Originally published at LeanStack.

Every week someone asks the same question on Reddit: what is the cheapest way to host a Node.js API with a Postgres database that is not a toy? The honest answer depends on how much downtime and maintenance you can accept, so this guide gives you real 2026 prices for five options and tells you which one fits which situation.

Short answer:

  • About $3/month: a PC you already own + Cloudflare Tunnel (you pay only electricity and the domain). Fast, but you are the ops team. I ran my production app this way for 12 days (full setup here).
  • $0/month, always on: Google Cloud's free e2-micro, if 1 GB of RAM, a shared CPU and a U.S. region are acceptable. My app runs there now.
  • About $6/month: one small VPS running both Node.js and Postgres. The cheapest always-on option if you can do basic Linux admin.
  • About $13/month: Render with a paid web service and database. No servers to manage, predictable bill.
  • $5 and up: Railway, billed by usage. Great for small, spiky apps; watch the meter.
  • Free database: Neon's permanent free Postgres pairs well with any of the above.

Quick comparison

Prices checked on November 8, 2026 on each provider's official pricing page. Taxes not included.

Monthly cost to keep a Node.js + Postgres app online: Google Cloud e2-micro $0, home PC about $3, DigitalOcean $6, Railway about $6.15, Hostinger $6.49 rising to $11.99 at renewal, Render $13

Option Monthly cost Always on? You manage Best for
Home PC + Cloudflare Tunnel ~$3 (electricity + domain) Only while your PC and internet are up Everything Side projects, pilots
Google Cloud e2-micro (Always Free) $0 within free limits Yes OS, Postgres, backups Low-traffic apps, U.S. regions only
DigitalOcean Droplet 1 GiB $6 Yes OS, Postgres, backups Cheapest reliable always-on
Hetzner CPX02 (EU only) €6.49 + VAT Yes OS, Postgres, backups EU users
Hostinger KVM 1 (4 GB RAM) $6.49 intro (24-month prepay), $11.99 renewal Yes OS, Postgres, backups Most RAM per dollar up front
Render web + Postgres $7 + $6 = $13 Yes Nothing No-ops, fixed bill
Railway Hobby $5 incl. $5 usage, then metered Yes Nothing Small or spiky apps
Neon Free (database only) $0 Scales to zero after 5 min idle Nothing Free Postgres that does not expire

Where these numbers come from

Prices come from each provider's official pricing page and documentation on November 8, 2026; I did not open a paid account on every platform just to collect invoices. The home-PC and small-VM numbers come from my own production app, a multi-school exam platform built with Node.js, Express and PostgreSQL: it ran for 12 days on a laptop at home, and now runs on a 1 GB cloud VM. Where I estimate a bill, I show the math so you can plug in your own usage.

There is also one more $0 option that stays always on: Google Cloud's Always Free e2-micro (2 shared vCPUs, 1 GB RAM, 30 GB standard disk, 1 GB of egress per month from North America) in us-west1, us-central1 or us-east1. That is where my app runs today; the catches are a weak shared CPU and U.S.-only regions.

Option 1: A PC you already own + Cloudflare Tunnel (~$3)

If you have a spare PC or laptop, Cloudflare Tunnel publishes a local app on your domain without opening router ports, and the tunnel is free. My production exam platform ran this way on a laptop CPU from 2016 and handled 1,000 simulated users with zero errors and p95 around 100 ms. Electricity and the domain came to about $3 a month.

The catch is uptime: sleep, Windows Update reboots, power cuts and ISP outages all take your app down, and backups are entirely on you. In 12 days my laptop went to sleep twice and the app was offline for about 12 hours in total. I wrote up the whole setup, the load test and the risks in Hosting a Node.js + Postgres App From a Home PC.

Option 2: One small VPS for both Node.js and Postgres (~$6)

This is the cheapest option that stays online when your laptop is closed. You rent a small Linux server, install Node.js and PostgreSQL on it, and run your app with a process manager like PM2 or systemd.

What you get for about $6 a month:

Provider Plan vCPU RAM Disk Traffic Price
DigitalOcean Basic Droplet 1 1 GiB 25 GiB SSD 1,000 GiB $6
Hetzner CPX02 (Germany/Finland) 1 1 GB 20 GB NVMe 20 TB €6.49 + VAT
Hostinger KVM 1 1 4 GB 50 GB NVMe 4 TB $6.49 intro, $11.99 renewal

Things the price tables do not tell you:

  • Hetzner's US locations cost much more. The cheapest cloud plan in Ashburn or Hillsboro was CPX11 at €17.99/month when I checked, versus €6.49 for CPX02 in Europe. If your users are in the U.S., latency to Germany matters.
  • Hostinger's $6.49 requires paying 24 months up front, and the plan renews at $11.99/month.
  • 1 GB of RAM is tight for Node.js plus Postgres. It works for small apps if you lower Postgres memory settings and add a swap file; 2 GB is more comfortable (DigitalOcean's 2 GiB Droplet is $12).

How tight is 1 GB in practice? My app runs on a 1 GB VM (Google Cloud's free e2-micro) with Node.js in cluster mode (2 workers), PostgreSQL 16 and cloudflared. With Postgres set to shared_buffers = 128MB and max_connections = 40, plus a 2 GB swap file, free -m shows:

               total        used        free      shared  buff/cache   available
Mem:             969         519         373          26         239         450
Swap:           2047          32        2015
Enter fullscreen mode Exit fullscreen mode

About half the RAM is used and swap is barely touched, so 1 GB is enough for a small app if you tune Postgres down. It will not be enough if you add Redis, a search engine or a big in-memory cache.

Memory on a 1 GB VM: 519 MB used and 450 MB available with Node.js, PostgreSQL and cloudflared running; 32 MB of a 2 GB swap file in use

Do not skip backups on a VPS. A cron job running pg_dump to another machine or cloud storage every night is the minimum. Most providers also sell automatic server snapshots for a small extra fee.

Option 3: Render (~$13, fully managed)

Render runs your app from a Git repo and handles TLS, deploys and restarts. The Hobby workspace itself is free; you pay per service:

Render service Specs Price
Web service (free) 512 MB $0, spins down after 15 min idle
Web service 0.5 CPU, 512 MB $7/month
Postgres (free) 256 MB, 1 GB storage $0, expires after 30 days
Postgres 0.1 CPU, 256 MB $6/month + $0.30 per GB storage

So the realistic floor for an always-on app with a database you keep is $13/month. The free tier is fine for demos, but two details bite people:

  • A free web service sleeps after 15 minutes without traffic and takes about a minute to wake up.
  • A free Postgres database expires 30 days after creation. You get a 14-day grace period to upgrade; after that Render deletes it, data included.

Render's docs put the wake-up at about a minute, and community reports go higher for bigger apps. Since February 2026, a free service also stays awake while it receives WebSocket messages, not only HTTP requests. Free services lose any files written to local disk when they spin down, so keep uploads in a database or object storage.

Option 4: Railway (from $5, usage-based)

Railway bills by the second for the resources your services actually use. The Hobby plan costs $5/month and includes $5 of usage. Beyond that:

  • Memory: about $10 per GB per month
  • CPU: about $20 per vCPU per month
  • Volume storage (for Postgres data): about $0.15 per GB per month
  • Egress: $0.05 per GB

You can estimate your bill as average RAM (GB) × $10 + average CPU (vCPU) × $20 + storage. An app and database that together average a few hundred MB of RAM and little CPU can stay close to the $5 included credit. A busy app, or one with a memory leak, will not.

A worked example using my own app's real footprint: Node.js plus Postgres use about 0.5 GB of RAM together and almost no CPU when idle. On Railway that is roughly 0.5 GB × $10 = $5 for memory, plus perhaps 0.05 vCPU × $20 = $1 for CPU, plus 1 GB of Postgres volume at $0.15. That is about $6.15 a month, or $1.15 above the included $5. An exam with 1,000 students logging in at once would push CPU, and the bill, up for that hour.

There is also a free plan with $1 of usage per month and a one-time $5 trial credit, which is enough to try it but not to run anything permanent.

Option 5: A free managed database with Neon

If the database is what pushes you onto a paid plan, Neon offers serverless Postgres with a permanent free plan:

  • 100 compute-hours per project per month (autoscaling up to 2 compute units)
  • 1 GB storage per project (20 GB across up to 100 projects)
  • Scales to zero after 5 minutes idle, which adds a short delay on the first query after a pause

The paid Launch plan has no monthly minimum: $0.106 per compute-hour and $0.35 per GB-month of storage. Neon's own estimate for a small database with intermittent load is about $15/month.

A common cheap combination: Node.js on Render's free web service or a small VPS, with the database on Neon's free plan. Just remember both the free web service and the free database go to sleep, so the first request after a quiet period is slow.

How slow is slow? Neon describes its cold starts as subsecond, around 500 ms on average, which is far less painful than Render's one-minute wake-up. Still, set your Postgres client's connection timeout to a few seconds (the pg default is no timeout, but many ORMs use shorter ones) so the first query after a pause does not fail.

Which one should you choose?

  • Learning, demo or early pilot: home PC + Cloudflare Tunnel, or Render free + Neon free. Accept the sleeps and the downtime.
  • First paying users, and you know some Linux: a $6 VPS (DigitalOcean for U.S. users, Hetzner for Europe) with nightly pg_dump backups. Cheapest always-on option by far.
  • You never want to SSH into a server: Render at about $13/month for a fixed, predictable bill.
  • Small app with uneven traffic: Railway, as long as you check the usage graph in the first weeks.
  • Database is the expensive part: move it to Neon's free plan first and see if that is enough.

My own path: I started on a home laptop at about $3 a month, then moved to Google Cloud's free e2-micro once sleep-related outages started to matter. When my exams outgrow it, I will pay for a VPS with 2–4 vCPUs rather than a managed platform, because my bottleneck is password hashing, and that needs cores, not convenience.

Common problems

  • "My free database disappeared." Render free Postgres expires after 30 days. Export it with pg_dump before then or move to a paid plan.
  • "The first request takes 30–60 seconds." That is a sleeping free web service waking up. Pay for an always-on instance, or use a VPS.
  • "My VPS bill went up." Many providers repriced in 2026, and intro prices like Hostinger's renew higher. Check the renewal price before you prepay.
  • "Out of memory on a 1 GB VPS." Lower Postgres shared_buffers and max_connections, add a 1–2 GB swap file, or move up to 2 GB RAM.

Some links are affiliate links; see the disclosure.

Top comments (0)