# How to put a Node.js app online

https://netrun.io/en/blog/nodejs-prilozhenie

_October 5, 2026 · 4 min read_

> To put a Node.js app online, list the dependencies and the start command in package.json, listen on the port from the PORT variable, and upload the code without node_modules. Netrun detects Node.js, installs the dependencies, starts the app and, for a web service, gives you an HTTPS link — no pm2, nginx or Dockerfile needed. Keys and tokens go into secrets, and if the app crashes it restarts on its own.

- A Node.js app's package.json should list its dependencies and specify the start command.
- A Node.js web service has to listen on 0.0.0.0 and the port from process.env.PORT.
- Fastify listens only on 127.0.0.1 by default, so to serve the internet it needs host: "0.0.0.0" set explicitly.
- There is no need for the pm2 process manager on Netrun: the platform restarts the app itself if it crashes.
- Netrun stores keys, tokens and the database connection string encrypted and passes them to the app as environment variables.

The classic way to run a Node.js service means renting a VPS, installing Node, a process manager like pm2, a reverse proxy through nginx and a certificate for HTTPS. A lot of manual setup for a single app.

With Netrun you upload your code, and we take the build, the start and the restarts off your hands. Here is how, step by step.

## 1. Prepare your project

Your package.json should list the dependencies and the command to start the app. Keep secrets — keys, tokens, the database connection string — in environment variables rather than in the code.

## 2. Upload your code

As a ZIP archive or by importing a GitHub repository, private ones included. You do not need to include the node_modules folder.

## 3. Netrun builds and runs it

The platform detects Node.js, installs the dependencies and starts the app — no Dockerfile and no process setup needed.

## 4. Add secrets if you need them

When Netrun asks about environment variables, fill in the values for your keys and tokens. They are stored separately from the code.

## 5. Get your link

For a web service Netrun gives you a public address with HTTPS. Logs and status are visible in your dashboard, and if something fails the app restarts automatically.

On the Free plan a project sleeps when idle — for a service that has to respond at all times, pick a paid plan that runs without downtime. [Try Netrun](https://netrun.io/).

## Common questions

### How do I listen on the right port in Express and Fastify?

In Express, app.listen(process.env.PORT || 3000) is enough: it listens on all addresses by default. In Fastify you have to set the address explicitly: fastify.listen({ port: Number(process.env.PORT), host: "0.0.0.0" }), otherwise the app is reachable only from inside the server.

### Do I need pm2 or systemd?

No. The platform handles restarts after a crash, and the app logs are visible in your dashboard. A plain start command such as node index.js in the start script is enough.

### Does Netrun work for a TypeScript app?

Yes, as long as package.json has a build script that compiles the TypeScript and a start command for the compiled code. Make sure the project builds locally with the same command: build errors on Netrun show up in the dashboard logs.

### Can I run a Telegram bot on Node.js?

Yes, Netrun runs telegraf or grammY bots as a background process with no public link. On the Free plan a bot runs for a limited time; around the clock takes the Pro plan.

### Why is the service slow to respond after a pause?

On the Free plan a web service sleeps when there are no requests and wakes on the first one, so the first response after a pause takes a few seconds. On the Pro plan the project does not sleep.
