
There are four realistic ways to host a Node.js app: shared hosting that has a Node.js selector, a VPS where you run the app under a process manager, a platform service that builds and runs it for you, and an edge runtime such as Cloudflare Workers. Pick a platform service if nobody on the team wants to manage a server. Pick a VPS if you need full control or run several apps. Use shared hosting only for small apps, and an edge runtime only when the code is written for one.
Here is what each option involves, with the commands and the limits you should know about before you commit.
What a Node.js App Needs From a Host
A PHP site is a set of files that the web server runs on demand. A Node.js app is a program that listens on a port and has to keep running. So every hosting option has to answer the same five questions:
- What starts the app and restarts it after a crash or a reboot?
- What sits in front of it to handle HTTPS and pass requests to its port?
- Which Node.js version runs, and who keeps it on a supported release? As of November 2026 the supported lines are 26, 24 and 22.
- Where do secrets live? Database passwords and API keys belong in environment variables, not in the code.
- Where do the logs go when something breaks?
The four options differ mainly in who answers those questions: you, or the host.
Option 1: Shared Hosting With a Node.js Selector
Many cPanel hosts let you run a Node.js app from the control panel. In cPanel itself the feature is called Application Manager, and it runs your app through Phusion Passenger, an add-on to the Apache web server. You upload the code, register the app against a domain or path, and Passenger starts and manages it.
Things to know before you rely on it:
- Passenger looks for a startup file named
app.js. Use that name unless your host documents a different setting. - Passenger decides the port. Your app does not choose its own.
- Restarting is done with a file. In cPanel's guide you create a
tmpfolder in the app directory and runtouch tmp/restart.txtafter each change. - Versions can be old. The cPanel documentation lists Node.js 16, 18, 20 and 22 packages. Of those, only 22 is still supported by the Node.js project, and that ends on April 30, 2027. Ask your host which versions they offer.
Good for: a small internal tool, a webhook receiver or a simple API next to an existing site. Not good for: anything that needs a current Node.js version, background workers or tight control over memory.
Option 2: A VPS With a Process Manager
On a VPS you install Node.js yourself and choose how the app runs. This is the most flexible option and the one with the most upkeep. The usual setup has three parts.
1. Install an LTS version of Node.js and your app
nvm install 26
git clone https://github.com/your-org/your-app.git
cd your-app
npm ci
npm run build
The build step applies only if your project has one. The Node.js documentation says to always run production apps with NODE_ENV=production set.
2. Keep it running with a process manager
If you start the app with node app.js in a terminal, it stops when you log out. A process manager such as PM2 keeps it alive:
npm install pm2@latest -g
pm2 start app.js --name my-api
pm2 startup
pm2 save
pm2 startup generates the script that relaunches PM2 when the server boots, and pm2 save records which apps to bring back. Day to day you will use:
pm2 list
pm2 logs
pm2 reload my-api
pm2 reload is PM2's zero-downtime restart for networked apps. On a server with several CPU cores, pm2 start app.js -i max runs one copy per core and balances requests between them. A systemd service does the same job as PM2 if you would rather use what the operating system already provides.
3. Put a reverse proxy in front
Do not expose the app's port to the internet. Let Nginx accept traffic on ports 80 and 443 and pass it on. A minimal server block looks like this:
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
The last two headers let WebSocket connections through. Add a TLS certificate before you go live. Our guide to reverse proxy servers explains the idea, and what Nginx is covers the software.
Good for: agencies and hosts that run several apps, anything with background jobs or WebSockets, and teams that need to choose the exact Node.js version. The cost: you patch the operating system, renew certificates, rotate logs and harden the server. A managed VPS plan moves some of that to the host.
Option 3: A Platform Service
With a platform service you connect a Git repository and the platform does the rest. It installs dependencies, builds the app, runs it, issues the certificate and redeploys on every push. Process management, the proxy and operating system patches are all handled for you.
These services come in two styles, and the difference matters:
- Container or always-on platforms such as Render, Railway, Fly.io and Google Cloud Run run your app as a long-running service or container. Most Node.js apps work with little or no change.
- Function-based platforms such as Vercel run your server code as functions that start in response to requests. They suit framework apps such as Next.js very well. An app that expects one permanent process, for example one holding WebSocket connections or running timers, may need changes.
You choose the Node.js major version in the project settings. Vercel, for instance, currently offers 26.x as the default plus 24.x and 22.x, and applies minor and patch updates itself.
Good for: most business sites and apps, small teams and agencies that want predictable deployments. Watch for: usage-based billing that grows with traffic, and features that tie the code to one provider.
Option 4: An Edge Runtime
Edge runtimes run your code in data centers close to each visitor. Cloudflare Workers is a widely used example. The important detail is that Workers is not Node.js. According to the Cloudflare documentation, it provides a subset of the Node.js APIs.
That subset is now large. Projects with a compatibility date of August 4, 2026 or later have Node.js compatibility switched on by default, and modules such as fs, http, net and crypto are supported. Others, including child_process and worker_threads, can be imported but do nothing. An app that shells out to other programs will not work as written.
Good for: APIs, redirects, personalization and sites built with a framework that has a Workers adapter. Not good for: moving an existing Express app across without testing every dependency first.
How to Choose
| Option | You manage | Host manages | Choose it when |
|---|---|---|---|
| Shared hosting with Node.js selector | Code and dependencies | Server, web server, Node.js versions | The app is small and you already pay for the plan |
| VPS with a process manager | Everything from the operating system up | Hardware and network | You need control, background jobs or several apps on one server |
| Platform service | Code and settings | Build, runtime, HTTPS, scaling | You want deployments without server work |
| Edge runtime | Code written for that runtime | Everything else | The app is light, global and does not need full Node.js |
If you are still unsure, ask one question: who will be on call when the app goes down? If the honest answer is nobody, choose a platform service. For more reading, see our host infrastructure articles and the rest of our Node.js articles.
Before You Go Live
- The app runs on a supported LTS version, and that version is pinned in the project.
NODE_ENV=productionis set.- Secrets are in environment variables, and no
.envfile is committed to the repository. - The app comes back by itself after you reboot the server. Test this once.
- HTTPS works and plain HTTP redirects to it.
- You know where the logs are and have looked at them.
- The database has backups that you have restored at least once.
