base on Node.js Production Process Manager with a built-in Load Balancer. <div align="center">
<br/>
<picture>
<source
srcset="https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-v4.png"
width=710px
media="(prefers-color-scheme: light)"
/>
<source
srcset="https://raw.githubusercontent.com/Unitech/pm2/development/pres/pm2-v4-dark-mode.png"
width=710px
media="(prefers-color-scheme: dark), (prefers-color-scheme: no-preference)"
/>
<img src="https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-v4.png" />
</picture>
<br/>
<br/>
<b>P</b>(rocess) <b>M</b>(anager) <b>2</b><br/>
<i>Runtime Edition</i>
<br/><br/>
<a title="PM2 Downloads" href="https://npm-stat.com/charts.html?package=pm2&from=2018-01-01&to=2023-08-01">
<img src="https://img.shields.io/npm/dm/pm2" alt="Downloads per Month"/>
</a>
<a title="PM2 Downloads" href="https://npm-stat.com/charts.html?package=pm2&from=2018-01-01&to=2023-08-01">
<img src="https://img.shields.io/npm/dy/pm2" alt="Downloads per Year"/>
</a>
<a href="https://badge.fury.io/js/pm2" title="NPM Version Badge">
<img src="https://badge.fury.io/js/pm2.svg" alt="npm version">
</a>
<br/>
<br/>
<br/>
</div>
PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
Starting an application in production mode is as easy as:
```bash
$ pm2 start app.js
```
PM2 is constantly assailed by [more than 1800 tests](https://github.com/Unitech/pm2/actions/workflows/node.js.yml).
Official website: [https://pm2.keymetrics.io/](https://pm2.keymetrics.io/)
Works on Linux (stable) & macOS (stable) & Windows (stable). All Node.js versions are supported starting Node.js 12.X.
### Installing PM2
With NPM:
```bash
$ npm install pm2 -g
```
You can install Node.js easily with [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) or [FNM](https://github.com/Schniz/fnm).
### Start an application
You can start any application (Node.js, Python, Ruby, binaries in $PATH...) like that:
```bash
$ pm2 start app.js
```
Your app is now daemonized, monitored and kept alive forever.
### Managing Applications
Once applications are started you can manage them easily:
![Process listing](https://github.com/Unitech/pm2/raw/master/pres/pm2-ls-v2.png)
To list all running applications:
```bash
$ pm2 list
```
Managing apps is straightforward:
```bash
$ pm2 stop <app_name|namespace|id|'all'|json_conf>
$ pm2 restart <app_name|namespace|id|'all'|json_conf>
$ pm2 delete <app_name|namespace|id|'all'|json_conf>
```
To have more details on a specific application:
```bash
$ pm2 describe <id|app_name>
```
To monitor logs, custom metrics, application information:
```bash
$ pm2 monit
```
[More about Process Management](https://pm2.keymetrics.io/docs/usage/process-management/)
### Cluster Mode: Node.js Load Balancing & Zero Downtime Reload
The Cluster mode is a special mode when starting a Node.js application, it starts multiple processes and load-balance HTTP/TCP/UDP queries between them. This increase overall performance (by a factor of x10 on 16 cores machines) and reliability (faster socket re-balancing in case of unhandled errors).
![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/cluster.png)
Starting a Node.js application in cluster mode that will leverage all CPUs available:
```bash
$ pm2 start api.js -i <processes>
```
`<processes>` can be `'max'`, `-1` (all cpu minus 1) or a specified number of instances to start.
**Zero Downtime Reload**
Hot Reload allows to update an application without any downtime:
```bash
$ pm2 reload all
```
[More informations about how PM2 make clustering easy](https://pm2.keymetrics.io/docs/usage/cluster-mode/)
### Container Support
With the drop-in replacement command for `node`, called `pm2-runtime`, run your Node.js application in a hardened production environment.
Using it is seamless:
```
RUN npm install pm2 -g
CMD [ "pm2-runtime", "npm", "--", "start" ]
```
[Read More about the dedicated integration](https://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/)
### Host monitoring speedbar
PM2 allows to monitor your host/server vitals with a monitoring speedbar.
To enable host monitoring:
```bash
$ pm2 set pm2:sysmonit true
$ pm2 update
```
![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/vitals.png)
### Terminal Based Monitoring
![Monit](https://github.com/Unitech/pm2/raw/master/pres/pm2-monit.png)
Monitor all processes launched straight from the command line:
```bash
$ pm2 monit
```
### Log Management
To consult logs just type the command:
```bash
$ pm2 logs
```
Standard, Raw, JSON and formated output are available.
Examples:
```bash
$ pm2 logs APP-NAME # Display APP-NAME logs
$ pm2 logs --json # JSON output
$ pm2 logs --format # Formated output
$ pm2 flush # Flush all logs
$ pm2 reloadLogs # Reload all logs
```
To enable log rotation install the following module
```bash
$ pm2 install pm2-logrotate
```
[More about log management](https://pm2.keymetrics.io/docs/usage/log-management/)
### Startup Scripts Generation
PM2 can generate and configure a Startup Script to keep PM2 and your processes alive at every server restart.
Init Systems Supported: **systemd**, **upstart**, **launchd**, **rc.d**
```bash
# Generate Startup Script
$ pm2 startup
# Freeze your process list across server restart
$ pm2 save
# Remove Startup Script
$ pm2 unstartup
```
[More about Startup Scripts Generation](https://pm2.keymetrics.io/docs/usage/startup/)
### Updating PM2
```bash
# Install latest PM2 version
$ npm install pm2@latest -g
# Save process list, exit old PM2 & restore all processes
$ pm2 update
```
*PM2 updates are seamless*
## PM2+ Monitoring
If you manage your apps with PM2, PM2+ makes it easy to monitor and manage apps across servers.
![https://app.pm2.io/](https://pm2.io/img/app-overview.png)
Feel free to try it:
[Discover the monitoring dashboard for PM2](https://app.pm2.io/)
Thanks in advance and we hope that you like PM2!
## CHANGELOG
[CHANGELOG](https://github.com/Unitech/PM2/blob/master/CHANGELOG.md)
## Contributors
[Contributors](http://pm2.keymetrics.io/hall-of-fame/)
## License
PM2 is made available under the terms of the GNU Affero General Public License 3.0 (AGPL 3.0).
For other licenses [contact us](mailto:
[email protected]).
", Assign "at most 3 tags" to the expected json: {"id":"11774","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"