Deployment

Ship It — Render, Fly, Railway, or Your Cloud

Deployment

The modern Node deploy landscape. PaaS platforms, containers, or serverless — and how to choose.

4 min read Level 1/5 #nodejs#deployment#paas
What you'll learn
  • Pick a platform
  • Ship your first deploy
  • Handle env, secrets, health checks

Three styles of Node deployment in 2026: PaaS, container host, serverless. All work. Pick the one that matches your stage.

PaaS — Easy Mode

You push, they run. Auto-build from git, env vars in a UI, basic metrics included.

  • Render — straightforward, generous free tier
  • Railway — slick UI, fast iteration
  • Fly.io — global edge regions, Postgres included
  • Heroku — the original

A typical Render deploy:

  1. Connect GitHub repo
  2. Build command: npm ci && npm run build (if you have one)
  3. Start command: npm start
  4. Add env vars in the dashboard
  5. Done

Container Hosts

You build a Docker image (next lesson). Push to a registry. Run on:

  • Cloud Run (Google) — pay-per-request, scales to zero
  • ECS / Fargate (AWS)
  • DigitalOcean App Platform
  • Kubernetes — power user mode

Used when you’ve outgrown PaaS or want fine control.

Serverless

Functions that spin up per-request:

  • Vercel (full-stack Next.js / Astro)
  • Netlify Functions
  • AWS Lambda
  • Cloudflare Workers — V8 isolates, not Node, but Node-compatible

Use when most of your code is HTTP request handlers, not long-running processes. Cold starts and Node’s slow boot can be issues — Workers / Bun on the edge solve this for some cases.

Health Checks

Every deploy needs a /healthz endpoint:

app.get("/healthz", (req, res) => {
  // simple: is the process alive?
  res.json({ ok: true });
});

app.get("/readyz", async (req, res) => {
  // deeper: can we actually serve traffic?
  try {
    await db.query("SELECT 1");
    res.json({ ok: true });
  } catch {
    res.status(503).json({ ok: false });
  }
});

Load balancers / Kubernetes use these to decide if you’re alive (liveness) and ready (readiness).

Graceful Shutdown

async function shutdown() {
  console.log("draining...");
  server.close();      // stop accepting new connections
  await db.disconnect();
  process.exit(0);
}

process.on("SIGTERM", shutdown);
process.on("SIGINT",  shutdown);

Containers send SIGTERM. You have a few seconds to finish open work and exit cleanly. Without this, in-flight requests get cut off.

Secrets

Never commit them. Set env vars on the platform. For multi-env:

  • Render / Railway — env vars per service
  • Vercel — env vars per environment (dev/preview/prod)
  • AWS — Secrets Manager / Parameter Store
  • K8s — Sealed Secrets, ESO
Docker →