Node.js
A Node.js application runs your app as its own process, behind Nginx. Netkeel keeps it running and restarts it for you. Create a Node.js server first, then add an application to it.
Create the application
Section titled “Create the application”When you add a Node.js application, you also choose:
- Node.js version: 20, 22 or 24. Node.js 22 is recommended.
- Start command: the command that starts your app, such as
npm startornode server.js. It runs in the app’s folder as the application’s own user. Up to 512 characters, on one line. The default isnpm start. - Health check path: a page on your app, such as
/or/health. It starts with/. Netkeel requests it before the app counts as started. The default is/. - Whether to Create a database. It is ticked at first; untick it if the app doesn’t need a database.
- The database engine is the one chosen when the server was created, MySQL (MariaDB), MySQL 8 or PostgreSQL. It can’t be changed later. See PostgreSQL databases.
The application starts with a placeholder app (package.json and server.js) that npm start runs. You can change all of these later, except the database, under Node.js › App settings.
Put your code on the application
Section titled “Put your code on the application”You can deploy from Git, or upload with SFTP or the file manager into htdocs and then click Restart at the top of the page or under Node.js › App.
Deploy from Git
Section titled “Deploy from Git”Open Deployments and connect your repository. The Node.js preset fills in:
- Build commands:
npm ciandnpm run build --if-present. They run with the application’s Node.js version. If the repository has nopackage-lock.json(ornpm-shrinkwrap.json), the server runsnpm installinstead ofnpm ciand says so in the deploy log. Commit a lockfile for repeatable builds. - Shared paths:
.env, kept between releases. - Publish directory: empty, the repository root.
When you connect the repository, the environment variables you set under Node.js › Environment are carried over to Git deploy. You still edit them under Node.js › Environment; from then on they apply from the next deployment.
The health check after each deploy
Section titled “The health check after each deploy”After a new release is built and switched to, Netkeel restarts the app and requests its health check path. The app must answer with a success or redirect status (HTTP 200 to 399) within the Startup time allowed, 30 seconds unless you change it.
If it doesn’t, the application goes back to the previous release and the app runs again from it. The deploy shows Failed with Not switched to: the previous release is still live. Click Log: it ends with the health check’s result, such as the app is not listening yet or the status code it got, and the app’s last output.
Common causes:
- The app listens on a fixed port instead of
PORT. - The health check path needs a login or returns an error. Choose a path that answers without one.
- The app needs an environment variable that isn’t set under Node.js › Environment.
If the app is stopped when you deploy, the new release goes live but the app is not started. Click Start under Node.js › App.
The Node.js group
Section titled “The Node.js group”A Node.js application’s menu has a Node.js group with three pages: App, Environment and App settings. When a Git repository is connected, the header’s main button is Deploy; otherwise it is Restart.
The Status card shows whether the app is Running, Starting, Stopped, Paused or Failed, with its Uptime, Memory, Restarts, Node.js version, where it is Listening on and the App folder. It refreshes every 10 seconds while the page is open. Paused means a restore or import is running; the app starts again by itself when it finishes.
- Start starts a stopped app.
- Restart restarts it, for example after you upload new files.
- Stop stops it. The application shows an error page until you start the app again.
Anyone with access to the application can start, stop and restart the app.
Recent log shows the app’s latest output. Values of your environment variables are hidden. Click Refresh to read it again. The Logs section also has the app’s output under App output, with search and download.
App settings
Section titled “App settings”The Owner and Super admins can click Edit settings to change:
- the Node.js version, Start command and Health check path;
- Startup time allowed: how long the app may take to answer its health check path after a start or deploy, 10 to 300 seconds. Raise it if the app runs migrations before it listens;
- Largest request: bigger uploads are refused before they reach the app, 1 to 2048 MB.
Click Save and restart: the app restarts when what it runs changes. If the app doesn’t start on a new Node.js version, the previous version is put back. Keep secrets out of the start command, because the server’s process list shows it; put them in environment variables instead.
Environment
Section titled “Environment”The Owner and Super admins can set environment variables here. They are passed to the app, and saving restarts it with them. Saved values are never shown again; to keep one, leave it empty when you edit the list.
When the application is deployed from Git, this page edits the variables kept with the repository. They are written to .env for every release, and saving restarts the app with them.
Connect to the database
Section titled “Connect to the database”Connect through localhost or the database’s socket, never 127.0.0.1, which is blocked inside the application.
- MySQL (MariaDB): the database name, user and password are under Database › Databases. Add them under Environment, for example as
DB_HOST=localhost,DB_NAME,DB_USERandDB_PASSWORD. - PostgreSQL: the app already has
DATABASE_URL,PGHOST,PGPORT,PGDATABASE,PGUSER,PGPASSWORDandPGSOCKET, with nothing to add. Variables you set under Environment override them. See PostgreSQL databases.
What is not available yet
Section titled “What is not available yet”Node.js applications don’t run PHP. Staging, cloning, moving to another server and import and export are WordPress-only for now. Backups work as for every application.