Published in


What are Process Managers & How to use them with Strapi

The goal of software firms is to ship products that add value to customers at the right time. Whether the firm follows the agile or DevOps architecture, its purpose is to satisfy customers with its products. It can be a little daunting to achieve since firms need to make sure there are no downtimes when delivering products to users.

Downtimes are very destructive for the reputation of any business. Imagine that users try to log into your application but cannot access it because your servers are down. This downtime will ruin the customer’s trust in you, and they may not want to try out your product ever again.

It is no different for a headless CMS like Strapi. With production process managers, developers can keep applications alive forever, reload them without downtime, and facilitate common system admin tasks.

This article will explore what process managers are, what they’re used for, and the different types of project managers. Also, we’ll explore the process manager for Nodejs applications and how they can be used in a Strapi application.

What are Project Managers

Process management uses skills, tools, and knowledge to analyze, monitor, and meet process goals at a specific time. In contrast, process managers are tools and procedures that help actualize process goals at a particular time.

In software development, process managers help engineers build and ship products to users on time.

The demand for products from users increases daily. Therefore developers must embrace automation in the software development process. Project managers provide flexibility and allow you to ship and manage your application efficiently.

For instance, with process managers, you can keep your application alive so that users can access them without downtime. Also, process managers allow you to monitor, manage and collaborate on your application with other engineers.

In the next section, we’ll look at the importance of process management and why you should use one.

Why Process Managers are Important

Servicing across the internet all boils down to creating and shipping products that add value to customers at the right time. While numerous organizations ship products to users at the right time, they may release products that don’t add value to the customer.

As such, customers begin to complain about the low quality of products shipped to them. Other firms ship products that add quality to users but may ship them later.

These two methods will cause a decline in customer’s activity with the product. Let’s look at why software engineers love process managers and how it enables software firms to ship products that add value to customers at the right time.

  1. Process managers provide automation, and it helps developers ship products faster to users.
  2. With process managers, engineers can monitor users’ engagement. Hence, making shipping of products that add value to customers more possible.
  3. Process managers allow engineers to collaborate better in the development process.
  4. Process managers mitigate downtime from servers that are down as it keeps your application alive.
  5. Real-time logging and reporting is another advantage of using a project manager. It lets you detect errors and fix them quickly.

Types of Process Managers

In software development, there are numerous process managers for Nodejs-based applications. This section will look at the process managers for NodeJS-based applications, and they can be used in our Strapi application.

PM2 (Process Managers, 2) PM2, which can also be called process manager 2, is a process manager for NodeJS applications with a built-in load balancer and wherewith can use in a Strapi application. Let’s look at how this process manager helps you deploy, monitor, and manage your Strapi application.

Firstly, we will create a Strapi project that we will be using to test our process managers. To create a new Strapi project, make sure you have all the requirements, then run the following command on your CLI (Command Line Interface).

npx create-strapi-app my-project --quickstart

Log in to your Strapi admin panel: localhost:1337/admin/auth/login, and you will notice that your application is live.

Stop the server with CTRL + C, log in to your admin panel and you will notice that you're offline. The next step is to install PM2 globally in your working environment. Run the command below to install PM2.

/**install with npm**/
npm install pm2 -g
/**install with yarn**/
yarn global add pm2

Now, configure your Strapi application so that PM2 can have access to it. To configure your Strapi application, create a file in the root of your project and name it server.js.

const strapi = require('strapi');// start strapi application
└─── api
└─── build
└─── config
└─── extensions
└─── public
- favicon.ico
- package.json
- server.js

Since Strapi doesn’t have an entry point file like most Node.js applications, this code above creates an entry point for our Strapi application. To start your application, run the following command:

pm2 start server.js

Now, log in to your admin panel and you will notice that you’re live even when you stopped the server of your Strapi application. If you close down your CLI, you’ll see that your application is still running.

To stop your application from running, stop PM2 with the following command:

pm2 stop server.js

PM2 allows you to manage your application’s log. Logs are critical in the development stage of your application. They help engineers monitor how their applications behave and, to some extent, help detect the cause of an error.

To print the log of your Strapi application, run the following command on your CLI.

pm2 logs

Outputting logs without the means of aggregating or sorting them is a considerable challenge for developers. With PM2, you can sort, aggregate, or manage your logs to suit your needs.

To choose the option that suits you most in managing your logs, run the following command on your CLI.

pm2 logs -h

Also, you can clear your logs with PM2 by running the command below in your CLI.

pm2 flush

You can configure PM2 to run all of the operations we’ve done above without needing to run those commands on your CLI. PM2 saves a lot of time, and I recommend you use this method in your Strapi application.

To configure PM2, you need an ecosystem.config.js file. To generate this file automatically, run the command below in your CLI.

pm2 init

Next, we’ll input all of the commands we want PM2 to run on our application. For example, we can start our applications and send log details to an output file by replacing the content of ecosystem.config.js with the command below.

module.exports = {
apps: [
name: 'server',
script: 'npm',
args: 'start',
}, {
script: 'npm',
// seperate error logs
error_file: 'err.log',
out_file: 'out.log',
//combine error logs and other logs
log_file: 'combined.log',
time: true

You can deploy your application and also monitor CPU/memory usage with PM2. To monitor your application’s CPU usage, run the following command.

pm2 monit

Also, you can deploy your application from GitHub, hosting it in your environment with the following syntax.

"apps" : [{
"name" : "server",
"script" : "npm"
"deploy" : {
// "production" is the environment's name
"production" : {
"user" : "ubuntu",
"host" : [""],
"ref" : "origin/master",
"repo" : "",
"path" : "/var/www/my-repository",
"post-deploy" : "npm install; grunt dist"

PM2 allows integration with cloud providers like Heroku and Docker. You can use Nginx as an HTTP proxy, transpilers, and AWS Elastic Beanstalk.


Strapi supports integration with Forever. Forever is a process manager, just like PM2. Forever is a Node.js process manager that keeps your Node.js application alive forever. Most times, when you run a Node.js application, and there’s an unexpected error, your server stops. What if you’re not aware there’s an error and can’t restart your application?

Forever will restart your application whenever there’s an error that can stop your server, and it’ll keep your application alive forever. Without forever, you may need to run node index.js whenever your server shuts down unexpectedly.

Also, you can make use of your terminal while your application is running smoothly without the risk of shutting down your application.

To install forever globally in your working environment, run the following command on your CLI.

npm install forever -g

Next, please navigate to the Strapi application we initially created on your CLI. Notice that the server.js file is still intact as it'll be our entry point. Now, start your application by running the code below.

forever start server.js

Navigate to your admin panel and notice that your application is live. Just like PM2, you can make all configurations for your application in a single file. In this case, it’s a JSON file that you should create at the root of your folder.

For example, create a JSON file and name it development. You can output logs into a file by specifying them in your JSON file.

// Comments are allowed!
"uid": "my-project",
"append": true,
"watch": true,
"script": "server.js",
"sourceDir": "/home/myuser/my-project",
"command": /Users/myuser/.nvm/versions/node/v4.1.2/bin/node
"logFile": "/home/myuser/logs/forever.log",
"outFile": "/home/myuser/logs/out.log",
"errFile": "/home/myuser/logs/error.log"

Now you can run your application with this command.

forever start ./forever/development.json/**or**/
forever start /home/myuser/app/forever/development.json

To stop forever from keeping your application alive, run this command.

forever stop server.js

StrongLoop Process Manager

StrongLoop process manager is a Node.js production process manager that allows you to build, manage and deploy your Node.js application and keep your processes and clusters alive forever.

This process manager has built-in load balancing and allows you to view performance metrics on your application. It is an alternative to PM2.

To install this process manager, run the following command in your command-line interface.

npm install -g strongloop

After installation, navigate to your Strapi project’s location from your CLI. Run your application with the following command.

slc start

You can get a quick status overview of all worker PIDs, cluster IDs, other essential information about your application by running the command below.

slc ctl

Just like PM2 and forever, you can check logs from your application in the StrongLoop process manager. To do this, run the following command.

slc ctl log-dump my-project --follow

The goal of a process manager is to mitigate downtime. With StrongLoop process manager, you can update your environment with no downtime.

slc ctl env-set my-project NODE_ENV=production

StrongLoop process manager supports Ubuntu 12.04+, Red Hat Enterprise Linux, 7+, and Red Hat Enterprise Linux 5 and 6 environments for production use.

You can install StrongLoop process manager for production mode with the command below.

// install via npm
npm install -g strong-pm
// install via docker
curl -sSL | sudo /bin/sh

Build your application for production mode with slc build and deploy to your production host with the following syntax.

slc deploy

StrongLoop Process Manager runs one process per CPU. So, it will run your app in a four-process cluster on a four-core system. You can change the cluster size by running the command below.

slc ctl set-size my-project <size in number>


A Supervisor is a supervisor script for Node.js that runs your program and watches for code changes. It restarts your application and allows you to have hot-code reloading-ish behavior without worrying about memory leaks.

In Node.js, every code change means you’ll have to restart your application. Also, the supervisor restarts your application whenever there’s an unexpected error that stops your server.

To use supervisor in your Strapi application, first install it. To install, run the command below in your CLI.

npm i supervisor -g

Next, you’ll start our Strapi application by running the command below in your CLI.

supervisor start server.js

Notice that this command behaves like when you start your Strapi application with strapi start.

If you want to restart your server manually, you can do so by typing rs in your CLI. Watch as your server restarts.


Process managers are magnificent tools if you know how to use them properly. They’re vital if you want to ship features to users that add value to customers on time.

It is no different for Strapi, a headless CMS for NodeJS-based applications. Everyone wants automation that provides efficiency in an optimized manner; This is what process managers offer precisely.

In this article, we have looked at what process managers are, why you need them as engineers, and how to use different NodeJS-based process managers in a Strapi application.

First, we created a simple Strapi application and configured an entry point for our application so that process managers can interact with it. Strapi, like most NodeJS-based applications, supports numerous process managers.

If you’re finding it difficult to choose a project manager for your application, feel free to look at a comparison between PM2, StrongLoop process manager, and Forever here.

This article is a guest post by Ukpai Ugochi. She wrote this blog post through the Write for the Community program.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store