Log inSign up

Node.js guides

Node.js and npm, nvm, PM2, Express behind Nginx, bots and containers. 8 guides in this topic.

Install Node.js and npm

Put a current LTS release of Node.js and npm on Ubuntu, Debian, Rocky or Alma from the NodeSource repo, distro packages or dnf module streams.

Several Node.js versions with nvm

Install nvm for one user, keep several Node.js releases side by side, pin a version per project and use it from systemd and cron.

Upgrade Node.js safely

Move an app from one Node.js LTS line to the next: read the changes, test first, switch the repo or stream, rebuild native modules and keep a way back.

Keep Node.js apps running with PM2

Run Node.js apps under PM2 with restart on crash, start at boot, an ecosystem file for settings, rotated logs and cluster mode across vCPUs.

An Express app behind Nginx

Serve an Express app on 127.0.0.1, let Nginx handle static files and the public ports, and add a free Let's Encrypt certificate for HTTPS.

Deploy a MERN app

Install MongoDB with authentication, run the Express API on Node.js, build the React front end and serve both through Nginx with HTTPS.

Host a discord.js bot

Run a discord.js bot around the clock: token in a protected env file, slash commands, a systemd unit or PM2, and a Docker option.

Containerise a Node.js app

Package a Node.js app in a small multi-stage Docker image that runs as a non-root user, then run it with Docker Compose behind a local port.