What's installed on your MERN server?
- A React project made with Vite, in /home/app/uygulama/istemci
- Express 5 and Mongoose 9 in sunucu/server.js, with an /api/saglik route that really writes to MongoDB
- Node.js 26 (NodeSource repository) and PM2
- MongoDB 8.0 listening only on 127.0.0.1, protected by a user and password
- Caddy, which gets its own HTTPS certificate for an sslip.io address, so a domain is optional
- A 2 GB swap file and a firewall with only ports 22, 80 and 443 open
What size do you need for MERN?
There's no official RAM figure for MERN. Node.js, MongoDB and React builds share the same memory on this server, and MongoDB's cache is 512 MB at 2 GB and 1.5 GB at 4 GB. As a rule of thumb, 2 GB is a good start for a demo or small project, and 4 GB for a project with real users. The smallest size is 2 GB of RAM, 1 CPU and a 20 GB disk. RAM and CPU can go up or down, the disk only grows, and your data and IP address stay the same.
| Use | Size | Price | Choose |
|---|---|---|---|
| Starter | 2 GB RAM · 1 vCore · 40 GB NVMe | $4.01/mo | |
| Medium | 4 GB RAM · 2 vCore · 60 GB NVMe | $6.89/mo | |
| Powerful | 8 GB RAM · 4 vCore · 120 GB NVMe | $13.62/mo |
Who is it for?
- Anyone who wants a React front end and an Express API on one server
- Developers publishing a React app built with AI tools on their own server
- Small teams shipping a demo, a first version or an internal tool
What happens after you order?
- Set the size and complete your payment.
- Your server starts and the MERN stack installs itself. This took about 4 minutes in our real-server tests.
- Open the Site address from the Overview tab. The sample page says MongoDB: OK.
- Connect over SSH and type su - app. Put your project under ~/uygulama, with React in istemci and Express in sunucu.
- Build from the istemci folder: npm run build -- --outDir ../sunucu/public --emptyOutDir
- Run pm2 restart uygulama and check the change at your Site address.
With every server
- Daily backups included in the price
- Unlimited traffic
- Full root access
- Scale RAM and CPU up or down later, and grow the disk
- Location: Istanbul · IST-1.
Good to know
- By ordering, you accept MongoDB's Server Side Public License (SSPL) terms.
- Caddy forwards requests to 127.0.0.1:3000. Listen on that port in your own server file, and read the database address from MONGO_ADRES in sunucu/.env.
- Variables starting with VITE_ are written into your code at build time and are visible in the browser. Don't put secrets in them, and rebuild when a value changes.
- If your entry file isn't server.js, redefine the process: pm2 delete uygulama, pm2 start FILE --name uygulama, pm2 save.
- There's a single MongoDB node. For transactions or change streams with Mongoose, you set up a replica set.
- Keeping Node.js, MongoDB and your npm packages up to date is your responsibility.
MERN questions and answers
How do I deploy my MERN stack project?
Switch with su - app and put your Express code in ~/uygulama/sunucu and your React code in ~/uygulama/istemci. Run npm install in both, build from istemci with npm run build -- --outDir ../sunucu/public --emptyOutDir, then run pm2 restart uygulama.
How much RAM does a MERN stack need?
A MERN stack has no official RAM figure. As a rule of thumb, 2 GB is a good start for a demo or small project, and 4 GB for a project with real users.
Do I need to set up CORS?
Not with this layout. React is built, Express serves the output, and the API sits at the same address, so your front end calls paths starting with /api directly. If you host the front end somewhere else, you set up CORS in Express yourself.
Does React Router give a 404 when I refresh a page?
No. The sample server.js returns index.html for any unknown path, and React Router takes it from there. If you write your own server file, keep this behaviour and define your API routes before it.
Can I connect to MongoDB from outside?
On this MERN server, MongoDB listens only inside the server. To use Compass, open an SSH tunnel with ssh -L 27017:127.0.0.1:27017 root@IP.
Does my app come back after a reboot?
Yes. PM2 runs under the pm2-app service, which restores the saved process list at startup. After changing your processes, save the list with pm2 save.