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
- 1Open Startup in the website panel.
- 2Keep Install dependencies on startup enabled when dependencies need to be installed.
- 3Set the application Startup command variable to the project’s documented production command, commonly npm start.
- 4If the Build command variable is available and your project needs it, set the documented build command, commonly npm run build.
- 5Ensure the app uses PORT or SERVER_PORT and binds to 0.0.0.0.
- 6Start the website and read the first error if startup fails.
Minimal Node.js example
{"name":"my-website","version":"1.0.0","private":true,"scripts":{"start":"node 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.
Related guides
Website hosting: start here
Choose free or premium website hosting, understand the dashboards, and follow the right setup guide.
Create your free website
A complete walkthrough of the free website wizard, from choosing a runtime to your first public page.
Premium website plans and checkout
Choose a monthly website plan, review the cart, and understand delivery and renewal.
Choose Static HTML, PHP, Node.js or Python
Match your project to a website type before creating the server.