Node.js hosting - How to choose it and deploy Express or NestJS

A Node.js app differs from a traditional PHP site in one way: it is a process that must keep running. PHP runs when a request arrives, while Node.js keeps a server open. So Node.js hosting has to keep that process alive, restart it when it stops, and route internet traffic to the right port.
What Node.js hosting should provide
- The Node.js version you choose.
- A process that keeps running, without sleeping.
- A reverse proxy and HTTPS in front of the app.
- Environment variables managed separately from code.
- Access to logs when something goes wrong.
- A reachable database, ideally on the same network.
On a VPS you assemble these yourself with PM2 or Docker and Nginx. A deployment platform already includes them.
Four changes that make an app server-ready
1. Read the port from the environment
const port = process.env.PORT || 3000;
app.listen(port, "0.0.0.0", () => console.log(`Listening on ${port}`));
Listening on 0.0.0.0 matters. An app bound only to localhost inside a container cannot receive outside connections, and you will see failures even though the logs say it started.
2. Have a start script (and build for TypeScript)
{
"scripts": {
"build": "tsc",
"start": "node dist/index.js"
},
"engines": { "node": ">=20" }
}
Do not use nodemon or ts-node-dev in start. Those are for development.
3. Move configuration to environment variables
Database passwords, JWT secrets and API keys should all come from process.env. Add an .env.example listing the names so the deployment knows what to ask for, and never commit your real .env.
4. Add a health endpoint
It is optional, but a simple route confirms the app is alive:
app.get("/health", (req, res) => res.json({ status: "ok" }));
Deploy on VibeVN
- Push your code to GitHub, public or private.
- Open a new deployment and choose the repository.
package.jsonis read to detect Express, NestJS or Fastify. The port comes from your code or.env.example, otherwise 3000. - Fill in the environment variables, choose CPU and RAM, then deploy.
If your code uses pg, mysql2 or mongoose, the database is detected and created for the site, with connection variables already set. Files persist only in /app/data; everything else is replaced on redeployment.
Unusual projects can bring their own Dockerfile. Make sure EXPOSE matches the port the app listens on. The whole process is in how to deploy a vibe coded website.
Common Node.js errors
| Message | Cause | Fix |
|---|---|---|
Cannot find module 'express' | Not in package.json | Run npm install express and commit the lockfile |
Cannot find module './Routes' | Wrong upper or lower case | Match the file name exactly |
EADDRINUSE | Port already in use, often listen called twice | Check your startup code |
ECONNREFUSED 5432 | Cannot reach PostgreSQL | Use the connection variable, not localhost |
JavaScript heap out of memory | Out of RAM | Add RAM or look for a memory leak |
Many of these also apply to Next.js, see fixing Next.js build errors.
Real-time features and background jobs
WebSockets and scheduled jobs need a long-running process, which is where server hosting differs from serverless. If you run cron inside the app, note that jobs stop while the app restarts during a deployment, so design them to be safe to run again.
If you are still deciding how to get your code online, hosting a website from GitHub compares the options.
Frequently asked questions
Does shared hosting support Node.js?
Some plans do, usually through a Node.js application setup, but they often limit versions and resources and may not suit WebSockets. Ask the provider before buying.
Do I need PM2?
On a VPS you manage yourself, yes. On a deployment platform the process is already managed, so node dist/index.js is enough.
How much RAM does a Node.js app need?
A small API often runs in a few hundred MB, depending on its libraries and the data it handles. Check actual usage after launch, then pick a plan on the pricing page.


