# Express.js hosting in 2026: the options compared

> An Express app in production needs one long-running Node process that listens on process.env.PORT on every interface, trusts exactly the proxy in front of it, exits cleanly on SIGTERM, and keeps sessions and data in a database rather than in memory. On Livops an Express repository deploys from a push for 39 credits a month (39,000 so'm). Here is how Render, Railway, Fly.io, Vercel and a VPS with pm2 compare.

Source: https://livops.dev/en/hosting/express-hosting

By Livops team, the people who build and run Livops. Updated 25 November 2026.

Express is a small library on top of Node's HTTP server, so hosting it well is mostly about the process around it: where it listens, what it believes about the proxy in front of it, how it stops, and where it keeps anything that has to outlive one request. This page covers each with the code that does it, compares Render, Railway, Fly.io, Vercel and a VPS with pm2 using each provider's own numbers, and ends with exactly what Livops reads from an Express repository.

## What does an Express app need in production?

### `app.listen` on `process.env.PORT`, on every interface

A platform tells the app which port to use in `PORT` and sends traffic there. Listen on it, and on every interface: `'0.0.0.0'` says so explicitly, and leaving the host out does the same, since Node then accepts connections on `::` when IPv6 is available and on `0.0.0.0` otherwise[1]. A host of `'localhost'` or `'127.0.0.1'` makes the app reachable from inside its own container only.

```js
const express = require('express')
const app = express()

app.set('trust proxy', 1)
app.get('/healthz', (req, res) => res.send('ok'))

const server = app.listen(process.env.PORT || 3000, '0.0.0.0', () => {
  console.log(`listening on ${process.env.PORT || 3000}`)
})
```

### `trust proxy`, set to the proxy you actually have

On a platform the visitor's HTTPS connection ends at a proxy, which forwards plain HTTP to your app and says what really happened in `X-Forwarded-Proto`, `X-Forwarded-Host` and `X-Forwarded-For`. Express ignores those headers until the `trust proxy` setting says to believe them; with it, `req.protocol` comes from `X-Forwarded-Proto`, `req.hostname` from `X-Forwarded-Host`, and `req.ip` from `X-Forwarded-For`[2]. Without it, `req.secure` is false on an HTTPS site, redirects you build from `req.protocol` point at `http://`, and express-session's `cookie: { secure: true }` never sends the cookie — its documentation shows `app.set('trust proxy', 1)` for exactly that case[5].

Set it to a number of hops, not `true`. A number trusts that many proxies counted from the app[2]; `true` takes the left-most `X-Forwarded-For` entry as the client, which a visitor can write themselves unless the last proxy overwrites the header[2]. If anything rate-limits or logs by `req.ip`, check the hop count against your host's setup before relying on it.

### A clean exit on SIGTERM

Before a new version replaces the old one, the old process receives SIGTERM; Express's guide says it should stop accepting requests, finish the ones in progress, close its database connections and exit[3]. `server.close()` does the first two. Give it a deadline shorter than your platform's, so a hung connection does not end in a hard kill:

```js
process.on('SIGTERM', () => {
  server.close(async () => {
    await pool.end()        // the database pool, if you have one
    process.exit(0)
  })
  setTimeout(() => process.exit(1), 20_000).unref()
})
```

### Sessions and state off the local process

Anything kept in the process's memory disappears on every restart and deploy, and is invisible to a second copy of the app. Express's guide is explicit that separate instances do not share memory, so you cannot keep state in the application code, and points to a store such as Redis for session data[4]. express-session's default `MemoryStore` is, in its own words, not designed for production: it leaks memory under most conditions and does not scale past a single process[5]. Use a store — `connect-redis` is listed among the compatible ones[5] — and keep uploads in object storage rather than on the container's disk.

### A database, reached through a small pool

Users, orders and sessions belong in PostgreSQL or Redis, with the address in an environment variable such as `DATABASE_URL`, never in the repository. Open one pool per process at start-up and reuse it; a pool per request runs a small database out of connections quickly.

### `NODE_ENV=production` and something that restarts it

With `NODE_ENV=production`, Express caches view templates and generates less verbose errors; its guide cites tests showing up to three times the performance from that alone[4]. A crashed app stays down until something starts it again: Express recommends a process manager or, now by preference, the operating system's init system[4]. On a platform this is the platform's job. A `/healthz` route that answers without touching the database is what a platform's health check, or a load balancer, should probe[3].

## The options at a glance

| Option | What it is | Smallest paid always-on process | PostgreSQL | What you still maintain |
| --- | --- | --- | --- | --- |
| Livops | A platform; servers in Uzbekistan | From 39 credits (39,000 so'm) a month | 500 MB free, one per team; 1 GB for 9 credits a month | Your code |
| A VPS with pm2 | A virtual machine with root | 82,000 so'm a month: 1 vCPU, 2 GB, 30 GB HDD (SmartCloud)[18] | Whatever you install | The system, Node, pm2 and its startup script, a reverse proxy, HTTPS, backups, deploys |
| Render | A platform with web services | $7 a month: 0.5 CPU, 512 MB[6] | From $6 a month: 256 MB[6] | Your code |
| Railway | A platform billed by usage | Hobby: $5 a month, including that much usage; then about $10 per GB of memory and $20 per vCPU a month[8] | A service billed by the same usage[8] | Your code |
| Fly.io | Virtual machines billed by the second | $2.19 a month for shared-cpu-1x with 256 MB; $3.69 with 512 MB[10] | Managed Postgres from $4 a month (Developer)[10] | Your code, and its Docker image |
| Vercel | Functions; the Express app becomes one function | No always-on process: billed by active CPU and memory; Pro is $20 a month with $20 of usage included[14] | Not compared here | Your code, within the function limits |

Other providers' prices are from each provider's own page, read on 25 November 2026; the dates are in Sources below. Livops prices are the ones the cabinet bills today.

## Each option

### Livops

An Express repository is recognised from `package.json` and runs as a web app with an address and HTTPS; every `git push` ships a new version, and recent versions stay one click away for a rollback. The proxy in front sends `X-Forwarded-Proto: https`, WebSockets pass through it, and PostgreSQL or Redis is one click away with its address written into the app's variables. Payment is in so'm through Payme or Click, with no card. The servers are in Uzbekistan: close to users there, farther from users in Europe or America. You do not get root, one app's memory stops at 2 GB, and PostgreSQL takes 20 connections at once with no built-in pooler yet; for more than that, a VPS or a bigger platform database fits better.

### A VPS with pm2

The most machine for the money: SmartCloud's cheapest 2 GB plan is 82,000 so'm a month[18], and several Express apps fit on it. pm2 is the usual process manager: cluster mode runs the app across every CPU with no code changes, and `pm2 reload` restarts it with zero downtime[17]; `pm2 startup` and `pm2 save` bring the list back after the machine reboots[16]. Cluster mode is also where in-memory sessions break first, because each process has its own memory[4]. Everything around the app is yours: Node itself, nginx or Caddy in front (and the `trust proxy` hop count that matches it), a certificate, the database and its backups, the deploy script, and the system's security updates.

### Render

The smallest paid web service is $7 a month for 0.5 CPU and 512 MB, PostgreSQL starts at $6 for 256 MB, and a Redis-compatible Key Value store at $10 for 256 MB[6] — fixed prices, easy to plan around. The Hobby workspace is $0 plus compute; Pro, with horizontal autoscaling, is $25 a month plus compute[6]. Render takes credit and debit cards[6].

### Railway

The Hobby plan is a $5 monthly minimum that includes that much usage; past it, memory is $0.00000386 per GB a second and CPU $0.00000772 per vCPU a second[8], about $10 per GB and $20 per vCPU over a 30-day month. Hobby services are always on, with managed Postgres, Redis and more[8]. Paid plans need a credit card[8]. Its regions are California, Virginia, Amsterdam and Singapore[9].

### Fly.io

The lowest dollar price for a process that never stops: $2.19 a month for shared-cpu-1x with 256 MB and $3.69 for 512 MB, billed by the second while it runs[10]. Managed Postgres starts at $4 a month on the Developer plan, which includes storage[10]. Fly.io's page says every organisation apart from linked ones needs a credit card on file[10].

### Vercel

Vercel runs an existing Express app with zero configuration: a file such as `app.js`, `index.js` or `src/server.js` that imports Express and either exports the app or calls `app.listen`[11]. The whole app becomes a single Vercel Function on Fluid compute and scales up and down with traffic[11] — the best fit on this page for spiky traffic you do not want to pay for while it is idle. The trade-offs are the function's:

- **Static files.** `express.static()` is ignored; static assets go in `public/` and are served from the CDN[11].
- **Size and errors.** The app is one bundle with a 250 MB limit, and Vercel warns that Express's own 500 pages can keep a function in an undefined state unless errors are handled properly[11].
- **Duration and memory.** Hobby: 300 seconds and 2 GB at most; Pro: 300 seconds by default, up to 800, and 4 GB[12].
- **Bodies.** Requests up to 4.5 MB by default, and responses up to 4.5 MB unless streamed[12].
- **WebSockets** work on all plans, but a connection is pinned to one function instance and closes when the function reaches its maximum duration, so clients must reconnect[13].

Anything kept in one instance's memory, sessions included, is per instance, which makes the store above mandatory rather than advisable. On pricing, Hobby is $0; Pro is $20 a month with $20 of usage credit, and functions are billed by active CPU time and provisioned memory[14].

## VPS or platform: what do you maintain?

On a VPS, Express is the easy part. The work is around it: a process manager that survives a reboot, a reverse proxy and the `trust proxy` setting that matches it, certificates that renew, a deploy that installs, migrates and reloads in the right order, database backups, and the updates nobody reminds you about. In return you get root, any system package, and as many apps on one machine as it holds. On a platform you hand over a repository and get an address; the restart, the HTTPS and the rollback are the platform's. On a function platform such as Vercel you also hand over the process itself, and design around its limits. If running servers interests you, a VPS teaches you more and costs less per app once you run several. If the app is the point, use a platform.

## Where can you host an Express app for free?

- **Livops** has no free tier for apps. On an account that has not paid yet, the first bot or app runs for 15 minutes on a zero balance, once, so you can call it. Static sites are free, and one 500 MB database per team is free once the account has credits.
- **Render** gives each workspace 750 free instance hours a month. A free web service spins down after 15 minutes without inbound traffic and takes about a minute to start again, its local files are lost when it spins down, and a free PostgreSQL database expires 30 days after it is created[7].
- **Railway** has a Free plan with $1 of usage a month and up to 1 vCPU and 0.5 GB per service, whose services sleep when idle and wake on request; a trial gives $5 of credit for the first 30 days, with no card[8].
- **Fly.io** starts every new account on a Free plan: $1 of credit with no card, and $5 of usage a month once a card is added, with limits such as up to 3 Machines[10].
- **Vercel** Hobby is free, with monthly allowances of function usage; once a limit is exceeded you usually wait until 30 days have passed to use that feature again[15].

## Deploy Express on Livops

1. In the cabinet, click **New project** and choose the GitHub repository, upload the folder as a `.zip`, or start from the **Express + PostgreSQL** template.
2. Under **Databases**, add PostgreSQL, and Redis if you keep sessions there — choose the **Cache** type for sessions and caches only, or the default **Persistent** one if they must survive a restart. `DATABASE_URL` and `REDIS_URL` are written into the app's variables by themselves.
3. Put your own keys under **Variables**, marked as secret where they are secrets.
4. Deploy. The log shows the install, the build and the start, and the app gets a `<name>.livops.app` address with HTTPS.

What Livops reads from the repository:

- **The type.** `express` (or another server library) in `package.json` makes it a web app.
- **Install.** `npm install`, or pnpm, Yarn or Bun when `packageManager` in `package.json` names one.
- **Build.** `npm run build`, only when `package.json` has a build script — a TypeScript Express app compiles here.
- **Start.** `npm run start`. With no start script: a `web:` line in a `Procfile`, the file `main` names, or `index.js`, `server.js`, `app.js` or `main.js`, also under `src/`. When `start` is a development command — `nodemon`, `--watch` — and a `start:prod` script exists, that runs instead.
- **Node version.** Node 22, or Node 24 when `engines.node`, `.nvmrc` or `.node-version` asks for 24 or newer.

To set any of it yourself, put `livops.json` in the repository root:

```json
{
  "kind": "web",
  "start": "node server.js",
  "healthPath": "/healthz",
  "memory": 512
}
```

When the app runs:

- **The environment** has `PORT` (3000 unless you change it), `HOSTNAME=0.0.0.0` and `NODE_ENV=production`. An app that listens on `localhost` cannot be reached, and the proxy answers 502 with `application is not responding` — see [502 Bad Gateway](https://livops.dev/en/guides/error-502-bad-gateway).
- **Proxy headers.** The proxy sends `X-Forwarded-Proto: https` and `X-Forwarded-Host` with the address the visitor typed, so `app.set('trust proxy', 1)` is what makes `req.protocol` say `https` and secure session cookies work.
- **WebSockets** pass through the proxy, so `ws` or Socket.IO on the same port works.
- **On a new push**, the new version has a minute to answer on `PORT`. Without a `healthPath` any HTTP answer counts; with one, that path must answer 2xx or 3xx. Only then does traffic move to it. The old version keeps running for 15 seconds so requests in flight finish, then gets SIGTERM and 30 seconds to exit — the deadline the shutdown code above stays under. If the new one never answers, the old one keeps serving.
- **Migrations** go in the **pre-deploy command** in the settings, such as `npx knex migrate:latest`: if it fails, the new version does not start and the old one keeps serving.
- **If it crashes**, it is started again. Ten crashes inside 15 minutes and it is stopped, and you are told with its last lines.
- **Connections.** PostgreSQL accepts 20 connections at once and a built-in pooler (PgBouncer) is not offered yet, so keep the pool small, for example `new pg.Pool({ connectionString: process.env.DATABASE_URL, max: 5 })`.
- **Memory** is a tier of 256, 512, 1024 or 2048 MiB, 384 MB by default for a web app; the tier is part of what you pay for. An app killed for memory says so in the log.
- **Files** written to `/app/data` (the `DATA_DIR` variable) survive restarts and deploys; `/tmp` and files next to the code do not.

An Express app is **from 39 credits a month (39,000 so'm)**. One credit is 1,000 so'm, and bought credits never expire. See [Pricing](https://livops.dev/en/docs/pricing) for plans, which give more credits than they cost, [Databases](https://livops.dev/en/docs/databases) for Redis types and connection limits, and [Frameworks and livops.json](https://livops.dev/en/docs/frameworks) for every field.

## Questions

**Which port and host should app.listen use?**

The port in the PORT variable, and every interface: app.listen(process.env.PORT || 3000, '0.0.0.0'). Leaving the host out also works, because Node then listens on :: or 0.0.0.0. Passing localhost or 127.0.0.1 makes the app reachable only from inside its own container, so the platform's proxy cannot reach it.

**Do I need app.set('trust proxy') on a hosting platform?**

Yes, whenever a proxy terminates HTTPS in front of the app, which is the case on every platform on this page. Without it req.protocol says http, req.secure is false and express-session will not send a cookie marked secure. Set it to the number of proxies in front of you, usually 1, rather than true, which would let a visitor choose their own IP address.

**Can I keep sessions in memory?**

Not in production. express-session's own documentation says its default MemoryStore leaks memory, does not scale past a single process and is meant for development. Every restart and every deploy also logs everybody out. Put sessions in Redis or PostgreSQL with a session store.

**Does Express run on Vercel?**

Yes. Vercel turns the whole app into one Vercel Function, with no configuration. express.static is ignored, so static files go in public, and the function limits apply: a 4.5 MB request body by default, 300 seconds of duration on Hobby, and WebSocket connections that close when the function reaches its maximum duration.

**Do I need pm2 on Livops?**

No. Start node directly. The platform starts the app again when it exits, and pm2 start puts the app in the background and returns, so the container would end as soon as it started.

**How much does an Express app cost on Livops?**

From 39 credits a month, which is 39,000 so'm at 1,000 so'm a credit; the memory tier is part of the price. One 500 MB PostgreSQL database per team is free. There is no free tier for apps; on an account that has not paid yet, the first app runs for 15 minutes on a zero balance, once.

**Who wrote this comparison?**

The Livops team. Every price and limit of another provider on this page links to that provider's own page, with the day we read it.

## Sources

1. [Node.js — net, server.listen()](https://nodejs.org/api/net.html). Checked 25 November 2026.
2. [Express — Express behind proxies](https://expressjs.com/en/guide/behind-proxies.html). Checked 25 November 2026.
3. [Express — Health checks and graceful shutdown](https://expressjs.com/en/advanced/healthcheck-graceful-shutdown.html). Checked 25 November 2026.
4. [Express — Production best practices, performance and reliability](https://expressjs.com/en/advanced/best-practice-performance.html). Checked 25 November 2026.
5. [Express — express-session middleware](https://expressjs.com/en/resources/middleware/session.html). Checked 25 November 2026.
6. [Render — Pricing](https://render.com/pricing). Checked 25 November 2026.
7. [Render — Deploy for free](https://render.com/docs/free). Checked 25 November 2026.
8. [Railway — Pricing](https://railway.com/pricing). Checked 25 November 2026.
9. [Railway — Deployment regions](https://docs.railway.com/reference/deployment-regions). Checked 25 November 2026.
10. [Fly.io — Resource pricing](https://docs.fly.io/about/pricing). Checked 25 November 2026.
11. [Vercel — Express on Vercel](https://vercel.com/docs/frameworks/backend/express). Checked 25 November 2026.
12. [Vercel — Functions limits](https://vercel.com/docs/functions/limitations). Checked 25 November 2026.
13. [Vercel — WebSockets](https://vercel.com/docs/functions/websockets). Checked 25 November 2026.
14. [Vercel — Pricing](https://vercel.com/pricing). Checked 25 November 2026.
15. [Vercel — Hobby plan](https://vercel.com/docs/plans/hobby). Checked 25 November 2026.
16. [PM2 — Startup script](https://pm2.keymetrics.io/docs/usage/startup/). Checked 25 November 2026.
17. [PM2 — Cluster mode](https://pm2.keymetrics.io/docs/usage/cluster-mode/). Checked 25 November 2026.
18. [SmartCloud — VDS plans](https://smartcloud.uz/cloud-services/vds/). Checked 25 November 2026.
