Skip to content
VDS Panel
VDS Panel
Server Management
deployment 20 Nisan 2026 · 8 dk okuma

Running Node.js Projects in Production with PM2: Panel Guide

To put your Node.js and Express projects into production on VPS, set PM2 cluster mode, automatic restart, memory limit and log rotation settings on the panel.

#node.js #pm2 #deploy #express #nestjs
VDS Panel
VDS Panel Ekibi
Ürünü geliştiren ekip

Node.js is a runtime that works with an event loop on a single thread. This architecture has tremendous performance for API servers, but it has two limits: if there is a crash, the process dies, it does not work in parallel as many CPU cores. PM2 is a process manager designed to overcome these two limits. It is one of the leading tools used for Production Node.js deployment.

In this guide, we will explain what PM2 does in production, which settings you care about and why, and how you can manage these settings from the interface with VDS Panel.

Bir bakışta
99.9%
Uptime target
4-8×
throughput with cluster
<1sec
automatic restart
0
Downtime reload

What does PM2 do?

PM2 “daemonises” your Node.js processes. Well:

  • Restarts the process when it crashes
  • Opens more than one process and distributes the load (cluster mode)
  • Writes the logs to the file and rotates them
  • Manages uninterrupted traffic between restarts
  • Monitors Memory/CPU, restarts process that exceeds limits

It is also possible to run Node.js with systemd, but you need to install the above features one by one.

Why is cluster mode important?

Node.js runs single thread by default. If you are running a Node process on a 4-core VPS, your 75% CPU capacity remains idle. PM2 cluster mode opens as many worker processes as there are CPU cores and distributes the load among them:

P0

4-8×
more throughput
Cluster mode compared to single instance mode on 4-core VPS.

Classic installation vs via panel

Classical

Manual PM2 with terminal

  • npm install pm2 -g (global install)
  • Write ecosystem.config.js
  • Learn pm2 start/stop/reload commands
  • Log tracking with pm2 logs
  • Starting at boot with pm2 save + pm2 startup
  • SSH + manual reload for update
interface

with VDS Panel

  • Add project, select Node.js
  • Set the number of cluster instances with slider
  • Memory limit, auto-restart, log rotation automatic
  • Live log stream on the panel
  • Autostart on boot (already installed)
  • Git push → automatic zero-downtime reload

Step by step installation with panel

  1. 01
    Add the Node.js project
    Link or ZIP the GitHub repository. The panel detects package.json, uses 'scripts.start' or the entry point you specify.
  2. 02
    Set up cluster
    Slider for number of instances: 1 (fork mode) to the number of CPUs of your VPS. For most APIs, 2-4 is ideal.
  3. 03
    Set memory limit
    Like 256MB, 512MB, 1GB. The worker exceeding this limit will automatically restart. Memory leak is tolerated, the app continues to work.
  4. 04
    Enter env variables
    NODE_ENV=production, DATABASE_URL, API keys. It is not written to Git, it is stored in the panel secret vault and injected at runtime.
  5. 05
    Connect domain
    Custom domain name or subdomain. The panel automatically obtains the Let's Encrypt certificate and directs the nginx reverse proxy to your 3000 port.
  6. 06
    Press Deploy
    Your app is live in ~90 seconds. When you do a git push, zero-downtime reload is triggered.

Zero-downtime reload

One of PM2’s most powerful features is graceful reload. When you deploy new code:

  1. PM2 starts new workers
  2. New workers start listening
  3. Waits for old workers to finish their current requests (graceful shutdown)
  4. Old workers close down

The user does not feel any interruption. VDS Panel makes every deployment with this strategy.

Graceful shutdown signal

If your Node.js application is listening for the SIGINT or SIGTERM signal, when PM2 is shutting down, it gives your application 10 seconds to perform cleaning tasks such as closing open DB connections and flushing the cache. The panel sets this time by default.

Defense against memory leaks

Node.js memory leaks are common; especially when the event listener is forgotten and the global cache grows. The P0 setting of PM2 provides the solution:

P1

In the panel interface, this value is a slider. If you specified 512M, PM2 silently restarts a worker when it exceeds 512MB. Other workers continue to handle traffic.

DEV dependencies in Production

It installs with panel P0, dev dependencies are not installed. If you import a package in P1 at runtime, the production build will fail. You will see these errors in the panel build log.

Log management

PM2 writes P0 and P1 for each worker. Over time, these files become full. The panel automatically activates log rotation:

  • Rotate when file size reaches 100 MB
  • 5 old files are kept
  • Logs are streamed live from the panel UI (without opening a terminal)

Monitoring and alerts

For each PM2 process, the panel:

  • CPU and memory graph flows live
  • Number of restarts is monitored (too many restarts = bug signal)
  • Response time telemetry (if express-status-monitor or similar is added)
  • Automatic cpulimit daemon launch when CPU limit is exceeded (protecting neighboring projects)

Node.js frameworks

VDS Panel has been tested with and automatically detects the following frameworks:

  • Express, common, fast, simple
  • NestJS, enterprise-grade, TypeScript focused
  • Fastify, ultra-fast, built-in JSON-schema validation
  • Koa.js, the modern successor from the creators of Express
  • Hapi, configuration-oriented, wide plugin ecosystem
  • AdonisJS, Laravel-like MVC

The panel reads your P0, detects the correct framework, and selects the appropriate start script.

Conclusion

PM2 is a must for Node.js production. Cluster mode, automatic restart, memory limit, log rotation, zero-downtime reload, all come with a single daemon. VDS Panel allows you to manage these settings from the interface without memorizing the terminal command.

To get your Node.js project live, you can complete the panel setup in 8 minutes and see your first project by requesting a demo from our contact form.

Want to try it on your own server?

Reach out via the contact form and let's prepare a license and install plan tailored to your scenario.

Here when you're ready

Modern deploy experience on your own server, one contact message away.

Tell us about your usage scenario and we'll prepare the right license and install plan. Average response time is under 24 hours.