Deploy a sample Express.js app on Cloudways Velocity — managed Node.js hosting with NGINX, PM2, SSL, and Git-based deploys.
Velocity is built for Node.js frameworks, so you do not need Apache mod_proxy, .htaccess rewrites, or manual SSH/PM2 setup used on classic Cloudways Flexible servers.
This repository is a starter template from Cloudways. Use it as a sample, then replace routes and views with your own application.
| File / folder | Purpose |
|---|---|
server.js |
App entry point (listens on port 3000 — Velocity’s app port) |
src/ |
Express app, routes (/, /api, /health), middleware |
public/ |
Cloudways-branded sample home page and static assets |
package.json |
Dependencies and npm start / npm run dev scripts |
package-lock.json |
Locks dependency versions for reproducible deploys |
.env.example |
Example environment variables for local runs |
ecosystem.config.cjs |
Optional PM2 config for local / non-Velocity hosts |
Build and start commands used by Velocity:
npm install # install dependencies (or use Velocity’s built-in install)
npm start # → node server.jsThere is no compile/bundle step. If Velocity already runs npm install before your build command, you can leave Build empty in the dashboard; either approach is fine.
- A Cloudways account with Velocity access
- This repository pushed to GitHub (or another Git provider Velocity can connect to)
- A domain (optional at first; Velocity provides a default URL)
- Node.js 18.x+ (22.x or 24.x LTS recommended; selectable per app in Velocity)
git clone https://github.com/YOUR_USERNAME/cloudways-sample-express-app.git
cd cloudways-sample-express-app
cp .env.example .env
npm install
npm run devOpen http://127.0.0.1:3000.
| Endpoint | Description |
|---|---|
GET / |
Cloudways-branded sample home page |
GET /api |
API metadata (JSON) |
GET /health |
Health check (uptime) |
If you forked or cloned this repo locally:
git clone https://github.com/YOUR_USERNAME/cloudways-sample-express-app.git
cd cloudways-sample-express-app
git remote -v # confirm origin points at your GitHub repo
git push -u origin mainVelocity deploys from Git — keep package.json and package-lock.json on the branch you will connect (usually main).
- Open the Cloudways platform and go to Velocity.
- Click Get Started / create a new application.
- Connect your Git provider and select this repository.
- Choose branch
main(or your deploy branch). - Set framework to Express (or Custom / Node.js if Express is not listed).
- Select Node.js 22.x or 24.x (or another LTS your app supports).
- Confirm build and start commands:
- Build:
npm install(or leave empty if Velocity already installs deps) - Start:
npm start
- Build:
- Pick a plan size and deploy.
Velocity handles NGINX reverse proxy, PM2 process management, OS patching, and SSL for the default hostname. Your app only needs to listen on port 3000.
In the Velocity app settings, add environment variables as needed.
| Variable | Default | Notes |
|---|---|---|
NODE_ENV |
production |
Use production on Velocity |
PORT |
3000 |
Must stay 3000 on Velocity |
HOST |
127.0.0.1 |
Bind locally; NGINX proxies public traffic |
APP_NAME |
Cloudways Express Sample App |
Shown in /api responses |
Redeploy or restart the app after changing variables so the process picks them up.
- In Velocity, open your application → Domains (or equivalent).
- Add your domain / subdomain.
- Point DNS (A/CNAME) as instructed by Cloudways.
- Wait for SSL provisioning.
- Open
https://your-domain/and confirm the sample home page loads.
- Open the Velocity app URL (or your custom domain).
- Confirm the Cloudways-branded sample page at
/. - Check
https://your-app-url/healthreturns JSON with"status":"ok". - Check
https://your-app-url/apifor API metadata. - In Velocity logs, confirm the process is running and listening on port
3000.
-
Change code locally (routes, views, dependencies).
-
Commit and push to the connected branch:
git add . git commit -m "Describe your change" git push
-
Let Velocity auto-deploy from Git, or trigger a manual redeploy in the dashboard.
.
├── server.js # Entry point
├── package.json # Scripts and dependencies
├── .env.example # Local env template
├── ecosystem.config.cjs # Optional PM2 (non-Velocity)
├── public/ # Sample home page + static assets
└── src/
├── app.js # Express app setup
├── config/ # Environment config
├── middleware/ # Error handling
└── routes/ # Route handlers
- Add routes in
src/routes/. - Register them in
src/routes/index.js. - Add middleware in
src/app.js. - Replace
public/index.htmlwith your own UI (or serve an API-only app). - Update
APP_NAMEvia Velocity env vars or.envlocally.
This template also runs on other Node hosts. Set PORT from the platform and run npm start.
For platforms that require binding to all interfaces:
HOST=0.0.0.0
PORT=3000On non-Velocity hosts you may manage the process yourself (for example with the included ecosystem.config.cjs and PM2).
| Symptom | What to check |
|---|---|
| App won’t start | Velocity build/start logs; Node version ≥ 18; npm install succeeds |
| Blank page / 502 | Process must listen on 3000; confirm start command is npm start |
| Wrong env values | Set variables in the Velocity dashboard and redeploy/restart |
| Static assets 404 | Confirm public/ is in the repo and deployed with the app |
| Out of memory | Upgrade Velocity plan (more RAM) |
MIT — see LICENSE.
PRs welcome. Fork, branch, and open a pull request.
Use this repo as a GitHub template: click Use this template on GitHub to create your own project from this starter.