Deploy Nest JS App using PM2 to Linux Server

$ curl -sL | sudo -E bash -
$ sudo apt-get install -y nodejs
$ sudo npm i -g @nestjs/cli
$ sudo npm install pm2@latest -g
$ git clone
$ cd projectname
$ npm install
$ npm run build
$ pm2 start dist/main.js --name <application_name>
$ pm2 startup systemd
$ pm2 save




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Learn these neat JavaScript tricks in less than 5 minutes

The Javascript war

Incrementally migrating a legacy jQuery web application to a Vue.js SPA

Complete Guide to Web Scraping with Nodejs and Puppeteer

Is out now

LeetCode 13. Roman to Integer [JavaScript]

How to implement JS class and Inheritance

Migrating from Angular to Vue: A Dashboard’s Story

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
Daniel Santoso

Daniel Santoso

More from Medium

CRUD API in 3 lines using NestJS

Database with Prisma ORM, Docker and Postgres — NestJs with Passport #02

Hot Reload Node-Typscript with Docker!

Implementing a Generic Repository Pattern Using NestJS