Host your Express API without touching a server
Express is the most common thing people deploy on DployHub, and detection is tuned for it. Because express is in your dependencies, we treat the project as a Node server even if it also has a front-end build step. We read your port from the start script or from .listen() in the entry file and run it with zero-downtime releases.
Free staging (0.25 vCPU · 256 MB · 1 GB) · Live from ₹118.50/month, billed hourly · No servers to manage
Sensible Express defaults, no config files.
When you connect the repository we read it and fill in the build settings below. Every value can be changed in the app’s settings — see build settings.
- Runtime
- Node.js 20
- Port
- From process.env.PORT || 4000 or .listen(4000) in the entry file, else 3000
- Build command
- npm run build — only if you have a build script
- Start command
- npm start, else node server.js / index.js / app.js
Deploy Express in minutes.
- 1
Listen on the PORT we set
Write
app.listen(process.env.PORT || 4000, '0.0.0.0'). We setPORTfor you, and the literal fallback tells detection which port to expect. - 2
Add a health route
Add
app.get('/health', (req, res) => res.send('ok'))and set Health check path to/health. A release goes live once it answers with any status below 500. - 3
Create the app
In New app pick your repo and branch. Leave How to build it on Figure it out for me unless you want to force the Node.js option.
- 4
Set secrets
Add
DATABASE_URL,JWT_SECRETand friends in the Environment variables tab, separately for staging and live, so staging never touches production data. - 5
Deploy, test, go live
Hit your staging URL with curl or Postman, then click Go live. If something breaks later, roll back to any of the last five builds in seconds.
Running Express well in production.
Staging is free
Every app gets a staging copy in a free, lightweight Docker container (0.25 vCPU · 256 MB · 1 GB). It pauses after 7 days without a deploy — one click starts it again.
- Set
app.set('trust proxy', 1)soreq.protocol,req.ipand secure cookies behave correctly behind our HTTPS front door. - Handle
SIGTERMby callingserver.close(). During a release the old container is removed only after the new one is healthy, so a clean shutdown avoids cutting off in-flight requests. - Serving a React or Vue build from Express is fine: build it in your
buildscript and useexpress.static('dist'). Because Express is present, the whole project runs as one Node server. - Save uploaded files under
/data(for example with multer'sdest: '/data/uploads'). Everything else in the container is wiped on each deploy. - Unhandled promise rejections crash Node 20. If the Deployments tab shows 'Your app stopped right after starting', check the last 50 log lines it attaches for the stack trace.
Trigger
git push
Promote
same image
Rollback
1 click
Express questions.
My server.js is in src/. Will you find it?
Yes. We look at `main` in `package.json`, then `server.js`, `index.js`, `app.js`, `src/index.js` and `src/server.js`. A `start` script always wins.
Can I run WebSockets or Socket.IO?
Your Express process runs as a normal long-lived Node server, so libraries like Socket.IO run inside it as usual. Test on staging first.
How do I size an Express API?
Most small APIs run well on 0.5 vCPU and 512 MB (₹255 a month with 5 GB storage). Check CPU and memory in the Metrics tab and adjust in Settings, Resources.
Ship your Express app today.
Create an account, connect your repository and get a free staging copy plus a live HTTPS address in minutes.