Deploy a Node.js (Express / Fastify / NestJS) API
Pick your framework, clone from Git, install dependencies, and run the API under process supervision so it restarts on crash and survives a reboot.
What you'll build
- An Express / Fastify / Koa / Hapi / NestJS API running on your node
- PM2-style supervision: auto-restart on crash, start on boot
- A clean env_vars + package_file convention you can reuse
Before you begin
- A registered node
- A Node.js API repo with a start script in package.json
- Knowing your framework and the port it listens on
Connect the repository
Open Development → Deploy → Node.js. Steps 1–2 set the target node and the Git source, exactly like the other wizards.
Deploy Node.js — Application source
Pick your framework and Node version
Step 3 is the one that differs from the frontend wizards: choose the framework. This sets the right start command and health-check defaults — nestjs expects dist/main.js, express expects your entry file, and so on.
Deploy Node.js — Node.js configuration
Framework options
express, fastify, koa, hapi, nestjs, or plain for a hand-rolled HTTP server.Set the entry point, package file, and env
Step 4 — point at the right package_file (handy for monorepos), set the app port, and paste environment variables one KEY=value per line. These are injected at process start, not baked into the image.
Deploy Node.js — Application settings
Read PORT from the environment
Hard-coding a port is the #1 cause of “deploy succeeded but nothing responds”. Bind toprocess.env.PORT.Deploy with process supervision
Allocate resources and deploy. The runtime wraps your process in PM2-style supervision so a crash triggers an automatic restart and the API comes back after a node reboot.
- Clone repository20%
- npm install50%
- npm run build (if present)70%
- Start under supervision + Nginx proxy95%
- Health check on /100%
Confirm it’s up and self-healing:
$ curl -s https://orders-api.<node-domain>/health{"status":"ok"}$ # Kill the process on the box — supervision brings it straight back$ ssh ubuntu@<node-ip> "pkill -f node; sleep 3; curl -s localhost:3000/health"{"status":"ok"}Resilient API live
Crash-restart and boot-persistence are on. To add a managed database, continue with the FastAPI + Postgres tutorial — the Postgres half applies to any runtime.Nice work — you're done!
You completed Deploy a Node.js (Express / Fastify / NestJS) API. Keep the momentum going with the next walkthrough, or jump back to the full catalog.