Skip to content
By stack3 min read

Express.js hosting: from code to a live API on your domain

Short answer

An Express.js app runs on ArabyHost's AI/Developer plans as a Node.js app created in Setup Node.js App, served by Phusion Passenger behind LiteSpeed with free SSL. Make it listen on process.env.PORT, set trust proxy and your environment variables, then install packages and restart.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. What Express needs in production
  2. A production-ready startup file
  3. Which plan fits Express?
  4. Deploying, in short
  5. Common problems after deploying
  6. What every account includes
  7. Limits to know
  8. On ArabyHost

Express is the most widely used framework for servers and APIs on Node.js, and it’s simple enough that moving from your laptop to a server is easy: provided you get a handful of production settings right. Since it’s a Node.js app, it runs on ArabyHost’s AI/Developer plans; the general picture is on the Node.js hosting page.

What Express needs in production

Requirement Why On ArabyHost
Node.js 18 or newer Express 5 won’t run on older versions Node.js 20 and 24; 24 recommended
Port from the environment The platform decides the port Passenger passes PORT automatically
trust proxy The app sits behind the web server LiteSpeed terminates HTTPS
NODE_ENV=production Hides error details, enables view caching Set in the app’s screen
A session store MemoryStore loses sessions on every restart MySQL/MariaDB; no per-account Redis
An error handler So one exception doesn’t take the app down Logs readable over SSH

A production-ready startup file

const express = require('express');
const app = express();

app.set('trust proxy', 1);           // running behind LiteSpeed
app.use(express.json());

app.get('/api/health', (req, res) => res.json({ ok: true }));

app.use((err, req, res, next) => {   // catch-all error handler
  console.error(err);
  res.status(500).json({ error: 'Internal error' });
});

app.listen(process.env.PORT || 3000);

In Express 5, errors thrown in async handlers reach the error handler automatically, so you don’t need try/catch around every route. For sessions, use a MySQL-backed store such as the express-mysql-session package instead of the default.

Which plan fits Express?

AI/Developer plans only, as they’re the plans that run Node.js apps. You get Node.js 20 and 24, SSH jailed in CageFS, Git, npm, MySQL/MariaDB and cron for workers. If your front end is React or Vue, put its built files in public_html and run the API on a subdomain such as api.example.com, as described on the React hosting page.

Deploying, in short

  1. Clone the project from GitHub over SSH, or follow the deploy from GitHub guide.
  2. In Setup Node.js App, create an app: Node.js 24, the project folder, the domain or subdomain, and the startup file app.js.
  3. Add NODE_ENV=production, the database credentials and API keys as environment variables (what they are).
  4. Click Run NPM Install, then Restart.
  5. Open /api/health to confirm the app responds.

The detailed steps are in the Node.js deployment guide. After every update, run npm ci and restart the app.

Common problems after deploying

  • 502 error or a Passenger error page: the app crashed on startup, usually a missing package or an empty environment variable.
  • EADDRINUSE: the app listens on a hard-coded port. Use process.env.PORT.
  • ECONNREFUSED ::1:3306 connecting to the database: Node.js resolves localhost to IPv6 first. Use 127.0.0.1 as the host, and make sure the username carries your account prefix (error explained).
  • Routes work locally but 404 on the server: if you mounted the app under a sub-path, your routes must include it; a subdomain is simpler.

What every account includes

  • LiteSpeed in front of the app, with free SSL issued automatically.
  • Each account isolated in CloudLinux CageFS, daily JetBackup backups and Imunify360 security.
  • Claude Code and Codex on the server over SSH, and deploys from Claude or Cursor through Araby MCP.
  • The Araby AI assistant, which reads error logs and explains the fix, plus support in Arabic.

Limits to know

  • No root access, no Docker, and no public port of your own for the app.
  • No per-account Redis, so use MySQL for sessions and queues.
  • Memory and process counts are limited per plan, so don’t load large files into memory in one go.
  • Passenger may stop the app after a quiet spell, making the next request a little slower.

On ArabyHost

Pick one of the AI/Developer plans, create your Express app on Node.js 24 and attach it to a subdomain for the API. If your app runs on another host today, ask for free migration help.

FAQ

Should I use Express 4 or Express 5?

Express 5 for new projects. It requires Node.js 18 or newer, so it runs on 20 and 24. When upgrading from 4, check your route patterns: a bare * wildcard now needs a name, such as /*splat.

Why does req.ip show the wrong visitor address?

The app sits behind the web server, so requests arrive from it rather than from the visitor. Add app.set('trust proxy', 1) so Express reads the real address and secure cookies work over HTTPS.

Can React and Express share one domain?

Yes. Either let Express serve the built front end with express.static, or put the front end in public_html and run the API on a subdomain such as api.example.com with CORS configured.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.