HF PanelDocsv1.0.0

Deploy a Node.js app from Git

Clone a Node.js project from GitHub or GitLab, create the app, build and deploy it, and ship updates with Pull updates and Build & deploy.

This tutorial puts a Node.js app (Next.js, Nuxt, Express, NestJS, a Vite build or any other) live on app.example.com straight from its Git repository. Updates are then two clicks: Pull updates and Build & deploy.

You need:

  • a hosting account on a server with Node.js installed (the Node.js apps screen does not say Node.js isn't installed on this server yet)
  • the domain or subdomain the app will answer on, for example app.example.com, added under Domains
  • the repository's https:// address. For a private repository, a personal access token from GitHub or GitLab.

1. Clone the repository

  1. Open Control Panel › Software › Git.

  2. Under New repository, fill in:

    Field What to enter
    Clone from https://github.com/you/app.git. Private: https://TOKEN@github.com/you/app.git (the token is not stored with the address)
    Branch main, or leave empty for the default branch
    Name app
    Deploy to leave empty: the Node.js app runs from the repository itself
  3. Click Create.

The code is now in ~/web/repositories/app. See Git.

2. Create the app

  1. Open Software › Node.js apps.

  2. Under New app, enter the App name app and choose the Domain app.example.com.

  3. Enter the App folder web/repositories/app (where package.json is).

  4. Click Detect from package.json. The framework is recognised and the fields are filled in. Check them:

    Field Typical value
    Node.js the version your project needs
    Type Server app for Next.js, Nuxt, Express and other servers; Static site for a Vite, React or Vue build
    Install dependencies npm ci (uses package-lock.json) when the repository has a lock file
    Build script build
    Start command server apps: for example npm start or node dist/main.js
    Mode Production
  5. Add your settings under Environment variables, one NAME=value per line, for example DATABASE_URL=….

  6. Click Create app.

Important: a server app must listen on process.env.PORT. PORT, HOST and NODE_ENV are set for you.

3. Build and deploy

Click Build & deploy next to the app. A window shows every step: installing dependencies, building, and putting it live. A server app starts and shows Running; it restarts by itself if it crashes.

4. Get SSL and open it

Open Domains › SSL/TLS and check that app.example.com has a certificate (click Get free SSL if not). Then open https://app.example.com.

If a server app doesn't come up, click Log file, or read ~/logs/node-app.log in the File Manager.

5. Ship an update

After you push new commits:

  1. On Software › Git, click Manage on the repository, then Pull updates.
  2. On Software › Node.js apps, click Build & deploy.

6. Add a database (optional)

Create one under Databases: MySQL, PostgreSQL or MongoDB. Put its connection details in the app's Environment variables with Settings, then click Build & deploy again.