MERN Stack

Deploying a MERN Stack Application on DomainIndia.com Shared Hosting : A Practical Guide

By the Domain India teamPublished 8 min read
Knowledge base article
Contents (7 sections)

A MERN application has four parts: a MongoDB database, an Express API running on Node.js, and a React front end. The React part is just static files and runs anywhere. The Node.js API runs on our cPanel and DirectAdmin shared servers through the control panel's Node.js tool. MongoDB is the part that does not fit shared hosting, so this guide shows what works where, and how to deploy each piece.

Key takeaways

Shared hosting runs the React build and a small Express API, but it has no MongoDB server, and the outbound firewall on our cPanel and DirectAdmin servers does not open MongoDB's port 27017, so an app there cannot be expected to reach MongoDB Atlas either. For a real MERN app, use a VPS (install MongoDB yourself) or the App Platform for the Node.js API. If you want to stay on shared hosting, keep React and Express and swap MongoDB for the MySQL database your plan includes.

1. Which part runs where

We checked our shared servers on 23 September 2026.

PartcPanel or DirectAdmin sharedWebuzo sharedApp PlatformVPS
React front end (static build)YesYesYesYes
Node.js and Express APIYes, through the Node.js app toolNo Node.js tool found; ask supportYes, detected and built automaticallyYes
MongoDB on the same hostNoNoNo; PostgreSQL is includedYes, you install it
Reaching MongoDB AtlasPort 27017 not open outboundAsk supportTest from your appYes
Background workersNoNoAsk supportYes

The honest summary: shared hosting is fine for learning React and Express, but a MongoDB-backed app belongs on a VPS, or on the App Platform with a database you can reach from there.

2. Build the React front end

Create React App is deprecated. Start new front ends with Vite:

bash
npm create vite@latest client -- --template react
cd client
npm install
npm run build

The build writes plain HTML, CSS and JavaScript to client/dist/. Point API calls at a relative path such as /api/... so the same build works on any domain. Put the API address in VITE_API_URL in a .env file if the API lives on a different domain. Anything prefixed VITE_ is compiled into public JavaScript, so never put a secret there.

3. Option A: a VPS, the complete MERN stack

A VPS gives you root access, so you install MongoDB, Node.js and a web server yourself, and run the API with a process manager such as PM2 or systemd. The outline:

  1. Install the stack.
    Install Node.js (a current LTS release) and MongoDB Community from MongoDB's official repository. Bind MongoDB to 127.0.0.1 and turn on authentication before you store any data.
  2. Deploy the API.
    Copy the server code, run npm ci --omit=dev, set MONGODB_URI and your secrets as environment variables, and start it with PM2 or a systemd service so it restarts after a crash or reboot.
  3. Serve React and proxy the API.
    Put dist/ behind nginx or Apache, and proxy /api to the Node.js port.
  4. Add HTTPS.
    Point your domain's A record at the VPS and get a free Let's Encrypt certificate with Certbot.
  5. Back up the database.
    Schedule mongodump and copy the dumps off the server.

Our VPS plans are self-managed: the operating system, security updates and backups are yours to run. The full walkthrough is in running MERN or MEAN on a clean VPS, and MongoDB setup is in installing MongoDB on a VPS.

4. Option B: the App Platform for the API

The App Platform runs your Node.js API in its own container. It detects a Node.js app and builds it automatically, serves it over HTTPS, and every plan includes a PostgreSQL database whose address arrives in DATABASE_URL. Deploy with Deploy Now from GitHub, or with a deploy token from your terminal or CI; there is no automatic deploy on push. There is no SSH.

Your app must listen on the PORT environment variable and bind to 0.0.0.0:

javascript
const port = process.env.PORT || 3000;
app.listen(port, '0.0.0.0');

If you keep MongoDB Atlas, test the connection from your deployed app before you rely on it, and ask support if it fails. Moving to the included PostgreSQL removes that question. See getting started with the App Platform.

5. Option C: stay on shared hosting (React, Express and MySQL)

If shared hosting suits you, drop MongoDB and use the MySQL database your plan includes. The front end and API stay the same apart from the data layer: replace Mongoose with a MySQL client such as mysql2, or an ORM such as Prisma or Sequelize.

  1. Create the database.
    In cPanel, open Manage My Databases, create a database and a user, and give the user all privileges on it. Connect to localhost.
  2. Create the Node.js app.
    Open Setup Node.js App, choose Node.js 22 or 24, set the application root to a folder outside public_html such as api, set the application URL to yourdomain.com/api, and name your startup file.
  3. Upload and install.
    Upload the API code with package.json, but without node_modules, then click Run NPM Install and Start App. Put secrets in the app's environment variables.
  4. Upload the front end.
    Upload the contents of client/dist/ to public_html.
  5. Route the single-page app.
    Add the .htaccess rules below so that React's routes load index.html.
apache
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/api/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.html [L]

The app runs behind Apache through Passenger, so never hard-code a port and do not start PM2: use process.env.PORT, and restart from the panel after each change. The detailed guides are deploying a Node.js app on shared hosting and Node.js with MySQL on shared hosting. On DirectAdmin the same Node.js selector is installed as a plugin; menu names may differ, so ask support if you cannot find it.

Jailed SSH is available on every shared hosting plan (cPanel, DirectAdmin, Webuzo). It is off by default; ask support to enable it for your account.

6. Test and troubleshoot

  • Blank page after deploy: open the browser's developer tools. A 404 on /assets/... means the files are in the wrong folder; a 404 on a React route means the rewrite rules are missing.
  • API returns 503: the Node.js app failed to start. Check the startup file and the log named on the app's page, then restart.
  • Database connection errors: check the host (localhost on shared hosting), database name and user, including the account prefix.
  • Old version still showing: our cPanel servers can serve a cached copy of a page for up to 120 minutes. Add ?t=1 to the URL to check.
  • CORS errors: serve React and the API from the same domain, or allow only your front end's origin in the API.

7. Where Domain India fits

Choose by the database: a VPS if you want MongoDB on your own server, the App Platform if you want us to run the API and are happy with PostgreSQL, and cPanel hosting if React, Express and MySQL are enough.

VPS Starter
₹552.65/mo + GST
  • 1 vCPU
  • 2 GB DDR4 RAM
  • 64 GB NVMe SSD Storage
  • 2 TB Monthly Bandwidth
See plan details
App Starter
₹100/mo + GST
  • 512 MB RAM per app
  • 1 vCPU
  • 5 GB NVMe SSD
  • PostgreSQL Database
See plan details
cPanel Growth
₹200/mo + GST
  • 50 GB NVMe SSD Storage
  • 100 GB Monthly Bandwidth
  • 5 Websites
  • 50 Email Accounts
See plan details

Prices on the cards are Domain India list prices and exclude 18% GST.

Can I host a MERN stack app on Domain India shared hosting?

Partly. The React build and an Express API run on cPanel and DirectAdmin shared hosting, but there is no MongoDB server on shared hosting, and the outbound firewall does not open MongoDB's port 27017. Use a VPS or the App Platform for a MongoDB-backed app, or use MySQL on shared hosting.

Is Node.js pre-installed on Webuzo hosting?

We could not find a Node.js app tool on our Webuzo servers, so ask support before you plan a Node.js app there. cPanel and DirectAdmin both have one.

Can I use PM2 on shared hosting?

No. On shared hosting the control panel's Node.js tool starts your app through Passenger and restarts it for you. PM2 is for a VPS.

Which database comes with the App Platform?

Every App Platform plan includes a PostgreSQL database, and your app receives its address in the DATABASE_URL environment variable.

Should I still use Create React App?

No. Create React App is deprecated. Start new React front ends with Vite and upload the contents of the dist folder it builds.

Ready to deploy? Read the Node.js on shared hosting guide, compare VPS plans and the App Platform, or open a support ticket if you are unsure which fits your app.

Run your MERN app where it fits

Deploy your Node.js API from GitHub or with a deploy token, with a PostgreSQL database and free SSL included.

See App Platform plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app