Skip to content

Run a Node.js app

You can run a Node.js application, such as an Express or Next.js app, on a website. The web server passes visitors’ requests through to your app.

  1. Upload your app’s files to the website with SFTP.

  2. Make sure the app listens on address 0.0.0.0 and reads its port from the setting you will choose below, often through the PORT environment variable.

  3. Install its dependencies over SSH, for example with npm install in the app’s folder.

The Deploy Node.js form with Automatic (Production) selected, Node version stable, npm start as the startup command and HTTP Proxy switched on with port 3000. Marker 1 is beside the Automatic and Manual choice, marker 2 beside Node version, marker 3 beside Startup command, marker 4 beside Working directory and marker 5 beside the HTTP Proxy settings.
  1. Open the website, select Advanced in its navigation bar, then Node.js, then Deploy app.

  2. Choose how the app runs marker 1:

    • Automatic (Production) starts the app for you and restarts it if it stops. Use this for a live site.
    • Manual (Development) sends traffic to the app but does not start it; you start it yourself over SSH. The form shows the command to set up Node in your SSH session.
  3. Choose the Node version marker 2. stable is the current stable release.

  4. Enter the Startup command marker 3, such as npm start or node server.js.

  5. If the app is not in the website’s home folder, enter its folder in Working directory marker 4.

  6. Under HTTP Proxy marker 5, leave the switch on so the website’s primary domain sends visitors to the app:

    • Path: leave it empty to send the whole website to the app, or enter a path such as /app to use the app only there.
    • Port: the port your app listens on.
    • Tick Allow web socket proxy upgrade if your app uses WebSockets.
  7. Select Deploy.

The app is listed on the Node.js page, where you can change or remove it.