# Deploy a Node.js application
Source: https://docs.webgee.com/en/wordpress-cloud/nodejs-apps









WordPress Cloud can run a Node.js application in the same container as your
website, with the web server forwarding traffic to it. Applies to all WordPress
Cloud packages.

Go to **Advanced** → **Node.js**.

<img alt="The Node.js page before any application is defined" src="__img0" />

Select **Deploy app**.

## Choose how it starts [#choose-how-it-starts]

<img alt="The Deploy Node.js form, showing the automatic and manual modes" src="__img1" />

**Automatic (Production)** — the platform starts your application and restarts it
if it exits. Use this for anything live.

**Manual (Development)** — the application is proxied but not started for you.
Initialise the Node environment yourself over
[SSH](/en/wordpress-cloud/ssh-access):

```bash
/usr/bin/install_nvm_and_node.sh
```

Then start the process when you want it. Useful while you are iterating, because
the platform will not restart a process you deliberately stopped.

## Configure it [#configure-it]

| Field                 | Notes                                                                  |
| --------------------- | ---------------------------------------------------------------------- |
| **Node version**      | `stable` by default; pin a specific version if your app needs one      |
| **Startup command**   | For example `npm start`                                                |
| **Working directory** | The directory to change into first. Leave blank for the home directory |

## Configure the proxy [#configure-the-proxy]

<img alt="The proxy section, with path, port and web socket options" src="__img2" />

**Proxy enabled** is on by default, and forwards traffic from your primary
domain to the application.

* **Path** — leave blank to proxy the whole site, or enter a path such as `api`
  to proxy only `example.com/api`. Leave it blank only if Node is serving
  everything; on a site that also runs WordPress, use a path.
* **Port** — `3000` by default. Your application must listen on `0.0.0.0` on
  this port, not on `127.0.0.1`, or the proxy cannot reach it.
* **Allow web socket proxy upgrade** — tick this if your application uses
  WebSockets. Without it, the upgrade request is not passed through and the
  connection silently falls back or fails.

Select **Deploy**.

## Verify [#verify]

* The path you proxied returns your application rather than a 502.
* Restarting the container leaves the application running, if you chose
  **Automatic**.
* WebSocket features connect, if you enabled the upgrade.

## Related [#related]

* [PHP versions and settings](/en/wordpress-cloud/php-settings)
* [SSH access and keys](/en/wordpress-cloud/ssh-access)
