Node.js app
With a Node.js hosting plan your Node.js or Next.js app runs on our server, with its own database and Redis. You manage it from the dashboard: Hosting → website name → Application.
Before you start
- Your
package.jsonneeds a start script (for example"start": "node server.js"), or a start command you choose. - The app must listen on the port it gets in the PORT variable (
process.env.PORT), on address0.0.0.0. - Next.js: you choose it when you buy the plan. It needs the
build(next build) andstart(next start) scripts.
When the website is created you find a starter “Site under construction” app (package.json and server.js): replace it with yours.
Upload the app
Two ways:
- FTP: upload the files to the website's www folder (FTP). Do not upload the
node_modulesfolder: we install the dependencies. - Git: connect the repository (Git deploy). On every update we install the dependencies and restart the app by ourselves. A www folder with only the starter app inside counts as empty: you can connect the repository without emptying it.
Install and start
After uploading the app click Install and start. In order:
- we install the dependencies:
npm ciif there is apackage-lock.json, otherwisenpm install; - if
package.jsonhas abuildscript, we runnpm run build; - we start the app with the start command.
It can take a few minutes: the page refreshes by itself until it finishes. Next to the title you see the app status: Running, Starting or Stopped. If the installation fails, open Show the installation output to read the npm error.
Repeat Install and start whenever you change the dependencies or the code to build (with Git we do it for you).
Version and start command
In Version and start:
- Node.js version: 20, 22 or 24. When you change it the app reinstalls itself with the new version.
- Start command: for example
npm startornode server.js. Letters, digits, spaces and the characters. _ / : = @ -are allowed.
Environment variables
In Environment variables add API keys and settings: we save them in the .env file of the www folder, readable only by the website.
- Next.js reads
.envby itself. - Node.js reads it with
node --env-file=.env server.js, or with the dotenv package.
Variables apply from the next Restart. Those Next.js uses at build time apply from the next Install and start. A value cannot contain both single quotes and double quotes (or backslashes).
Database and Redis
Every app has its own MySQL (MariaDB) database and Redis, already connected: the app gets them as environment variables.
DB_HOST,DB_NAME,DB_USER,DB_PASSWORDREDIS_HOST,REDIS_PORT,REDIS_PASSWORD
You also find the database credentials in the dashboard, in Databases.
Restart
Restart starts the app again, for example after changing the environment variables.
If the app does not start
- Check that it listens on
process.env.PORT: with a different fixed port visitors do not reach it. - Check the start command and the
startscript inpackage.json. - Read the output of the last installation and the app log, the website's
logs/node.logfile, which you find via FTP or in the dashboard under Files → File Manager.