Skip to content
🚀 Unlimited+ €3.99/month! Get unlimited credits, auto-renewals, one-click max-out, +5 Discord bot slots, up to 8GB RAM & 200% CPU, +5 email addresses/domain & +2 email domains!
X Systems Hosting
X Systems Hosting
X Systems Help Center

Deploy a Node.js website or API

Configure package.json, dependency installation, the build step and the public listening port.

Help Center / Web Hosting
On this page
  1. Upload the project
  2. Configure startup
  3. Minimal Node.js example
  4. Common problems

Upload the project

Choose Node.js. Upload package.json, the source files and the appropriate lockfile into the project root. Keep generated dependencies from another operating system out of the upload; let the hosting runtime install them.

When dependency installation is enabled, the runtime uses npm ci when package-lock.json is present, otherwise npm install. A lockfile that does not match package.json can make npm ci fail; fix and commit a matching lockfile rather than repeatedly restarting.

Configure startup

  1. 1Open Startup in the website panel.
  2. 2Keep Install dependencies on startup enabled when dependencies need to be installed.
  3. 3Set the application Startup command variable to the project’s documented production command, commonly npm start.
  4. 4If the Build command variable is available and your project needs it, set the documented build command, commonly npm run build.
  5. 5Ensure the app uses PORT or SERVER_PORT and binds to 0.0.0.0.
  6. 6Start the website and read the first error if startup fails.

Minimal Node.js example

package.json
{"name":"my-website","version":"1.0.0","private":true,"scripts":{"start":"node server.js"}}
server.js
const http = require('node:http');
const port = Number(process.env.PORT || process.env.SERVER_PORT);
http.createServer((req, res) => {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('My Node.js website is online\n');
}).listen(port, '0.0.0.0');

Common problems

  • Do not hardcode port 3000 when the allocated port is different.
  • Binding only to localhost or 127.0.0.1 prevents the external gateway from reaching the app.
  • A one-off build command that exits is not the persistent server process.
  • Check whether package.json uses CommonJS or ES modules before copying an example.
  • Configure framework host-header/base-URL settings for your connected domain.