Deploy simple nestJs application on Server

1: install Node

curl -sL -o



apt install nodejs

node -v

npm -v

apt install build-essential

npm audit

2:install mongo

curl -fsSL | apt-key add -

curl -fsSL | sudo apt-key add -

echo “deb [ arch=amd64,arm64 ] focal/mongodb-org/4.4 multiverse” | tee /etc/apt/sources.list.d/mongodb-org-4.4.list

apt update

apt install mongodb-org

systemctl start mongod.service
systemctl status mongod

systemctl enable mongod

mongo — eval ‘db.runCommand({ connectionStatus: 1 })’

3:Create a project folder and connect it to Git

Cd /usr/src
mkdir app

Cd app

Git init

git remote add origin****

git pull origin main

git checkout -b dev

git branch — show-current

git pull origin dev

4: The project is now in the corresponding folder

Npm i

5: You can take the code under the correctness test

Npm run start:dev

6: Now we have to build the project

npm i -g @nestjs/cli

npm install pm2@latest –g

npm run build

pm2 start dist/main.js — name ***

7: And the end
The project can now be viewed at the link below





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