๐ŸŽ‰ Limited-time Hostinger deal โ€” up to 75% off + extra with codeWEBHOST2026Get my link โ†’
H
Comparisons

Cheapest way to host a Node.js API

10 min read

Free tiers, $7 PaaS plans and $6 VPS boxes compared on what they actually cost once your API needs to stay awake โ€” plus a three-line Caddy setup with automatic HTTPS.

The question behind the question

'Cheapest' depends entirely on one thing: whether your API is allowed to fall asleep. Free tiers are free because they suspend your process when traffic stops, and waking it takes several seconds. For a hobby dashboard you check twice a week, that is fine. For anything a user waits on, a multi-second cold start is worse than no API.

Once you rule out sleeping, the field narrows quickly and the prices converge around $5โ€“7/month. What differs is what you get for it.

What the options cost in September 2026

The free-tier landscape has tightened considerably. Fly.io no longer offers a free tier to new accounts and requires a card. Railway has no permanent free tier. Render still offers a genuinely free web service, with the cold-start caveat.

OptionRealistic monthly costWhat you actually get
Render free$0512 MB, no card required, sleeps after inactivity. Cold starts measured in seconds.
Render Starter~$7 per serviceAlways-on 512 MB, managed deploys from Git, zero server admin.
Railway Hobby~$5โ€“7 for a small always-on APIUsage-based, widely considered the best developer experience of the three.
Fly.io~$5โ€“12Card required, no free tier for new users. Worth it specifically for multi-region or edge deployment.
Entry VPS (e.g. KVM 1)~$6.49 on a long term1 vCPU, 4 GB RAM, 50 GB NVMe, root access โ€” and it hosts every other project you own at no extra cost.

The pricing model matters more than the price

Here is the part that decides it for most people. Managed platforms bill per service. Your API is one service; add a worker and that is two; add a staging environment and that is three. At roughly $7 each, three services is $21/month and climbing.

A VPS bills per machine. The second API on that box costs nothing. So does the third, the cron worker, the Postgres instance and the staging copy. A 4 GB server absorbs a surprising number of small Node processes before it complains.

So the honest answer is: for exactly one API, a PaaS is cheaper once you price your own time. For three or more things, a VPS wins on cost and keeps winning.

The fastest VPS setup: Caddy instead of Nginx

If you only need a reverse proxy with HTTPS, Caddy does in three lines what Nginx plus Certbot does in about forty. It obtains and renews Let's Encrypt certificates automatically, with no cron job and no separate tool. For a small API this is the correct default.

Start with Node 24 LTS โ€” the Active LTS line as of September 2026 โ€” and PM2 to keep the process alive.

On a fresh Ubuntu server:
bash
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs

sudo npm install -g pm2

cd /var/www/api
npm ci --omit=dev
pm2 start server.js --name api
pm2 save
pm2 startup systemd
# run the sudo command PM2 prints, then 'pm2 save' again
Bind to loopback so only the proxy can reach your API:
js
const PORT = process.env.PORT || 5000;

app.listen(PORT, "127.0.0.1", () => {
  console.log("API on 127.0.0.1:" + PORT);
});
Install Caddy:
bash
sudo apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' \
  | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' \
  | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt-get update && sudo apt-get install -y caddy
/etc/caddy/Caddyfile โ€” this is the whole config
caddyfile
api.example.com {
    reverse_proxy 127.0.0.1:5000
}
Reload, and HTTPS is live:
bash
sudo systemctl reload caddy
curl -I https://api.example.com

Adding a second API costs you one block

This is the whole argument for a VPS, expressed in configuration. Another PM2 process on another port, another three lines in the Caddyfile, another certificate issued automatically. Your bill does not move.

bash
cd /var/www/api-two
PORT=5001 pm2 start server.js --name api-two
pm2 save
caddyfile
api.example.com {
    reverse_proxy 127.0.0.1:5000
}

api2.example.com {
    reverse_proxy 127.0.0.1:5001
}

Things that quietly cost money later

The sticker price is rarely the final price. These are the line items that show up in month three.

  • Bandwidth. Most VPS plans include several terabytes; managed platforms are often stingier and bill overage. If your API serves files or images, check this number first.
  • Backups. Included weekly on many VPS plans; a 20โ€“30% surcharge at some cloud providers.
  • The database. A free Atlas or Postgres tier is fine until it is not, and managed database pricing tends to exceed the compute it serves.
  • Cold starts on free tiers. They cost user patience rather than dollars, which is easy to under-price until someone complains.
  • Renewal rates on promotional VPS pricing. Introductory rates roughly double on renewal โ€” budget for the real number, not the launch offer.

Pick in one line

Reduced to a single sentence each:

  • One API, occasional traffic, zero ops appetite โ†’ Render's free tier, and accept the cold starts.
  • One API that must stay awake and you would rather not own a server โ†’ Render Starter or Railway, around $7.
  • Two or more services, or a database you want on the same box โ†’ an entry VPS, and the marginal cost of each addition is zero.
  • Multi-region or edge latency requirements โ†’ Fly.io, which is the one case where it clearly beats the others.

If you go the VPS route

An entry KVM plan with 4 GB of RAM handles a Node API, a database and several other small projects at once, which is what makes the per-machine pricing model pay off. Coupon WEBHOST2026 applies automatically through the links on this site, and longer terms carry the lower monthly rate.

Ready to save with coupon WEBHOST2026?

Get my discount link โ†’

Ready to claim your Hostinger discount?

Generate your personalised cart link with coupon WEBHOST2026 attached โ€” it takes 20 seconds.