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.
By Livops team, the people who build and run LivopsUpdated
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.
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:
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 inpublic/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
- In the cabinet, click New project and choose the GitHub repository, upload the folder as a
.zip, or start from the Express + PostgreSQL template. - 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_URLandREDIS_URLare written into the app’s variables by themselves. - Put your own keys under Variables, marked as secret where they are secrets.
- Deploy. The log shows the install, the build and the start, and the app gets a
<name>.livops.appaddress with HTTPS.
What Livops reads from the repository:
- The type.
express(or another server library) inpackage.jsonmakes it a web app. - Install.
npm install, or pnpm, Yarn or Bun whenpackageManagerinpackage.jsonnames one. - Build.
npm run build, only whenpackage.jsonhas a build script — a TypeScript Express app compiles here. - Start.
npm run start. With no start script: aweb:line in aProcfile, the filemainnames, orindex.js,server.js,app.jsormain.js, also undersrc/. Whenstartis a development command —nodemon,--watch— and astart:prodscript exists, that runs instead. - Node version. Node 22, or Node 24 when
engines.node,.nvmrcor.node-versionasks for 24 or newer.
To set any of it yourself, put livops.json in the repository root:
{
"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.0andNODE_ENV=production. An app that listens onlocalhostcannot be reached, and the proxy answers 502 withapplication is not responding— see 502 Bad Gateway. - Proxy headers. The proxy sends
X-Forwarded-Proto: httpsandX-Forwarded-Hostwith the address the visitor typed, soapp.set('trust proxy', 1)is what makesreq.protocolsayhttpsand secure session cookies work. - WebSockets pass through the proxy, so
wsor Socket.IO on the same port works. - On a new push, the new version has a minute to answer on
PORT. Without ahealthPathany 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(theDATA_DIRvariable) survive restarts and deploys;/tmpand 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 for plans, which give more credits than they cost, Databases for Redis types and connection limits, and Frameworks and livops.json 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
- Node.js — net, server.listen() (nodejs.org). Checked .
- Express — Express behind proxies (expressjs.com). Checked .
- Express — Health checks and graceful shutdown (expressjs.com). Checked .
- Express — Production best practices, performance and reliability (expressjs.com). Checked .
- Express — express-session middleware (expressjs.com). Checked .
- Render — Pricing (render.com). Checked .
- Render — Deploy for free (render.com). Checked .
- Railway — Pricing (railway.com). Checked .
- Railway — Deployment regions (docs.railway.com). Checked .
- Fly.io — Resource pricing (docs.fly.io). Checked .
- Vercel — Express on Vercel (vercel.com). Checked .
- Vercel — Functions limits (vercel.com). Checked .
- Vercel — WebSockets (vercel.com). Checked .
- Vercel — Pricing (vercel.com). Checked .
- Vercel — Hobby plan (vercel.com). Checked .
- PM2 — Startup script (pm2.keymetrics.io). Checked .
- PM2 — Cluster mode (pm2.keymetrics.io). Checked .
- SmartCloud — VDS plans (smartcloud.uz). Checked .
Put your project online today
Connect GitHub or drop a folder. No card is asked for.
Deploy your Express appRelated
- Node.js hosting in 2026: how to deploy an Express appA Node.js server in production needs one long-running process that listens on the port it is given, restarts when it crashes and exits cleanly on SIGTERM. On Livops you push a repository with package.json and it runs as a web app for 39 credits a month (39,000 so'm). Here is what Node needs, and how a VPS, Render, Railway, Fly.io, DigitalOcean and Heroku compare.
- NestJS hosting in 2026: how to deploy a NestJS app, and whereA NestJS app in production is built to dist once and started with node dist/main, listens on process.env.PORT on every interface, answers a health check that respects its global prefix, and migrates its Prisma or TypeORM schema before it takes traffic. On Livops a Nest repository builds and starts from a push, for 39 credits a month (39,000 so'm). Here is how Render, Railway, Fly.io and a VPS with pm2 compare.
- Managed PostgreSQL hosting in 2026: the options comparedA production PostgreSQL needs backups you can restore, a connection limit your app stays under, the app in the same region, and a supported version. On Livops a PostgreSQL 15, 16 or 17 database runs inside your project, its DATABASE_URL is written into your services, and it is backed up every night; 500 MB is free, one per team, and 1 GB is 9 credits a month. Here is how Neon, Supabase, Render, Railway and a VPS compare.
- 502 Bad Gateway after deploying: what it means and how to fix itThe proxy in front of your app reached for it and got no valid answer: nothing was listening on the port it tried, or the process closed the connection mid-request. After a deploy that is almost always one of five things: the app listens on the wrong port or on 127.0.0.1, it crashed on start, it was still starting, it ran out of memory, or the proxy points at the wrong port. The app's own log says which.
- App not listening on $PORT: why the health check failed after deployThe platform started your app, tried the port it gave it, and nothing answered in time. Almost always the app listens on its own fixed port instead of the PORT variable, listens on localhost (127.0.0.1) instead of 0.0.0.0, or crashed or was still starting when the check gave up. Listen on 0.0.0.0 and the port in PORT, and it passes.
- ECONNREFUSED / Connection refused: why the app cannot reach its database after deployNothing was listening at the address your app tried. When the address is 127.0.0.1 or localhost, the app never read the database's real address: DATABASE_URL is not set, is not read, or is read during a build that has no database. Attach the database, read DATABASE_URL (or REDIS_URL, MYSQL_URL) at runtime, run migrations before the start rather than in the build, and keep the connection pool under the server's limit.
- Livops vs Vercel: which one to deploy on in 2026Pick Vercel for a Next.js or frontend app served to users around the world from its global network, paid by card. Pick Livops if your users are in Uzbekistan, you also run a Telegram bot or a backend that must stay up, and you want to pay through Payme or Click, with no card; static sites are free on both.