Where you host a Node.js app depends on what kind of app it is. A long-running API or WebSocket server needs a platform that keeps a process alive; a request-driven API can run as serverless functions; a static front end needs neither. This guide groups the main options by that difference, with pricing and free-tier limits taken from each provider’s own pages in October 2026.
I have not benchmarked these platforms against each other, so there are no ratings here. The 2024 version of this post had several entries that no longer work for Node.js apps: Heroku’s free plan ended in 2022, Glitch ended project hosting on July 8, 2025, GitHub Pages and Surge only serve static files, and Deta’s site did not load when I checked. Those are removed or corrected below.
First, Pick the Hosting Model
| Model | How your code runs | Good for | Watch out for |
|---|---|---|---|
| Platform as a service (PaaS) | A long-running process or container you deploy from Git | APIs, WebSockets, background workers, most apps | Free tiers that sleep; paying for idle time |
| Serverless functions | Your handlers run per request | Spiky or low traffic, APIs next to a front end | Execution limits, cold starts, no in-memory state |
| Edge runtimes | Lightweight isolates close to users | Fast, small request handlers | Only a subset of Node.js APIs |
| Containers on a cloud | Your Docker image on a managed service | Teams already on AWS, Google Cloud or Azure | More setup and cloud billing to learn |
| Virtual private server | Your own Linux machine | Full control, predictable cost | You patch, secure and monitor everything |
Platforms That Run a Long-Lived Node.js Server
Render
Render deploys web services from Git or a Docker image. Its free web services are meant for testing: Render’s docs say a free service spins down after 15 minutes without traffic and takes about a minute to spin up again, each workspace gets 750 free instance hours a month, and Render says not to use free instances for production. Paid instances stay on and can use persistent disks.
Railway
Railway bills per second for CPU and memory. Its pricing page lists a free trial with $5 of credit for 30 days, a Free plan with $1 of monthly usage credit, and the Hobby plan at $5 a month including $5 of usage. It is quick to set up and also hosts databases next to your app.
Fly.io
Fly.io runs your app as lightweight virtual machines in regions you choose, billed by the second while they run. The smallest shared-CPU machine with 256 MB of memory was listed at $0.0030 an hour (about $2.19 a month in Ashburn), and there is no fixed plan to buy up front. A good fit when you want to run close to users in several regions.
Heroku
Heroku is the original Git-push platform and is still easy to use, but it no longer has a free plan. Eco dynos cost $5 a month and sleep after 30 minutes of inactivity; Basic dynos at $7 a month are always on.
DigitalOcean App Platform
DigitalOcean App Platform offers free hosting for up to three static sites, and Node.js services in containers from $5 a month for a shared 1 vCPU, 512 MiB instance.
Serverless and Edge Platforms
Vercel
Vercel is built around front-end frameworks such as Next.js, with Node.js code running as Vercel Functions. The Hobby plan is free but limited to personal, non-commercial use; Pro is $20 a month with usage-based billing beyond included credit. Use it when your Node.js code is request-driven and lives alongside a front end.
Netlify
Netlify works on credits: the free plan includes 300 credits a month, Personal is $9 a month and Pro $20. Node.js runs as Netlify Functions, which suit APIs and form handlers next to a static site.
Cloudflare Workers
Cloudflare Workers runs code at Cloudflare’s edge. The free plan includes 100,000 requests a day with 10 ms of CPU time per request; the paid plan starts at $5 a month. Workers support a subset of Node.js APIs, and modules such as child_process and worker_threads are not fully available, so it is not a drop-in home for a traditional Express server.
Containers on the Big Clouds
If your organization already uses a major cloud, run your container there: Google Cloud Run (containers that scale to zero), AWS (App Runner, or ECS on Fargate), or Azure Container Apps. They have free tiers or credits, but pricing is usage-based and detailed, so use each provider’s calculator rather than a blog post’s numbers. For a full AWS example, see deploying a container to AWS Lambda.
Quick Comparison
| Platform | Runs a long-lived server | Free option | Paid from |
|---|---|---|---|
| Render | Yes | Free web services that sleep after 15 min idle | See pricing page |
| Railway | Yes | $5 trial credit; $1/month credit on Free | $5/month (Hobby) |
| Fly.io | Yes | No free allowance listed | ~$2.19/month smallest machine |
| Heroku | Yes | None | $5/month (Eco, sleeps); $7 (Basic) |
| DigitalOcean App Platform | Yes | Static sites only | $5/month |
| Vercel | Functions | Hobby, non-commercial only | $20/month |
| Netlify | Functions | 300 credits/month | $9/month |
| Cloudflare Workers | No (edge isolates) | 100,000 requests/day | $5/month |
Prices change often; check the linked pages before you decide.
Make Your App Deploy-Ready Anywhere
Whichever platform you choose, the same few habits make deployment smooth. This small server shows them:
import http from 'node:http';
// Platforms tell your app which port to use; never hard-code it.
const PORT = Number(process.env.PORT ?? 3000);
let shuttingDown = false;
const server = http.createServer(async (req, res) => {
if (req.url === '/healthz') {
// Health checks let the platform route traffic only to healthy instances.
res.writeHead(shuttingDown ? 503 : 200, { 'Content-Type': 'application/json' });
return res.end(JSON.stringify({ ok: !shuttingDown }));
}
if (req.url === '/slow') await new Promise(r => setTimeout(r, 1500)); // simulates real work
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello from Node.js\n');
});
server.listen(PORT, '0.0.0.0', () => console.log(`Listening on ${PORT}`));
// Platforms send SIGTERM before stopping or replacing an instance (deploys, scaling, restarts).
// Stop accepting connections, finish in-flight requests, then exit.
process.on('SIGTERM', () => {
shuttingDown = true;
console.log('SIGTERM received, draining connections');
server.close(() => {
console.log('All requests finished, exiting');
process.exit(0);
});
server.closeIdleConnections();
setTimeout(() => process.exit(1), 10_000).unref(); // hard stop if something hangs
});- Read the port from
PORT. Platforms assign it. - Listen on
0.0.0.0so the platform’s router can reach the process inside its container. - Expose a health check such as
/healthzso the platform only sends traffic to healthy instances. - Shut down gracefully on SIGTERM. Platforms send it before replacing an instance during deploys and scaling.
I tested the shutdown path locally: with a 1.5-second request in flight, sending SIGTERM stopped new connections, let the slow request finish with status 200, and then exited cleanly.
$ PORT=4180 node server.js &
$ curl localhost:4180/slow & # in flight
$ kill -TERM <pid>
SIGTERM received, draining connections
Hello from Node.js # the slow request still completes
All requests finished, exitingFor container-based platforms, a minimal Dockerfile that runs as a non-root user:
FROM node:24-slim
ENV NODE_ENV=production
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
USER node
EXPOSE 3000
CMD ["node", "server.js"]The Dockerfile passed hadolint with one informational note about using a named user; I did not build the image here because Docker was not installed. Pin the Node.js major version in package.json engines and in the base image so every platform runs the same runtime. For automated deploys, see building a CI/CD pipeline with Docker.
How to Choose
- Hobby project or demo: Render’s free tier (accept the spin-down) or Railway’s trial.
- Small production API: an always-on instance on Render, Railway, Fly.io, Heroku Basic or DigitalOcean.
- Front end with some API routes: Vercel or Netlify Functions.
- Global, latency-sensitive request handling: Cloudflare Workers or Fly.io regions, if your code fits their limits.
- Company already on a big cloud: its container service.
Conclusion
Start from the shape of your app: long-running servers need a PaaS, containers or a VPS; request-driven code fits serverless; edge runtimes suit small, fast handlers. Free tiers are for experiments, and most sleep or cap usage. Build your app to read PORT, report health and shut down gracefully, and moving between platforms becomes easy. For the wider toolchain, see DevOps tools for each stage.
FAQs
Is there free Node.js hosting in 2026?
Yes, with limits. Render offers free web services that sleep after 15 minutes without traffic, Railway gives trial and small monthly credits, and Vercel, Netlify and Cloudflare have free tiers for serverless or edge code. Heroku no longer has a free plan.
Can I host a Node.js app on GitHub Pages?
No. GitHub Pages serves static files only. You can host a front end there and run your Node.js API on another platform.
What happened to Glitch hosting?
Glitch ended project hosting and user profiles on July 8, 2025, so it is no longer an option for hosting apps.
Can I run Express on Cloudflare Workers?
Not as a traditional long-running server. Workers support a subset of Node.js APIs in a request-driven model, so apps usually need adapting to the Workers fetch handler.
Why does my free Node.js app take a long time to respond at first?
Many free tiers stop idle apps. On Render, a free service spins down after 15 minutes without traffic and takes about a minute to start again on the next request.
What does a Node.js app need to deploy on most platforms?
Read the port from the PORT environment variable, listen on 0.0.0.0, provide a health check endpoint, shut down gracefully on SIGTERM, and pin your Node.js version.








