%%
date:: [[2023-05-13]]
parent:: [[DigitalOcean]], [[NodeJS]]
%%
# [[Deploy a NodeJS app on DigitalOcean]]
### Use the 1-click droplet on the marketplace
To deploy a [[NodeJS]] app on [[DigitalOcean]], use [this NodeJS 1-click droplet](https://marketplace.digitalocean.com/apps/nodejs). It automatically installs:
- Node.js
- [[Node Package Manager|NPM]]
- [[Nginx]]
- [[PM2]]
Go through the prompts to create your server.
### Clone the repository
Log into your droplet and do a [[Git]] [[Cloning a remote repo with Git|clone]] of the repository for the app you want to run.
### Install dependencies
Do a
```
npm install
```
to install all the dependencies of the app, as specified in the `package.json`.
### Start the app
Find the [[JavaScript]] file that contains the main app logic. Let's say this is called `app.js`. Now run:
```
pm2 start app.js
```
This starts your app, but within [[PM2]]. The app is shown running when you do a:
```
pm2 list
```
Depending on the app, you may need to [[PM2#Update environment variables|update environment variables]].