MERN Stack hosting
MongoDB, Express, React and Node.js full-stack application. Deploy to a dedicated VPS in seconds — database auto-created, SSL installed, firewall locked down from the first boot.
Latest
Versions
MongoDB
Database
MERN
Category
What is MERN Stack?
MERN is a full-stack JavaScript application stack built from MongoDB, Express.js, React and Node.js. It allows developers to build the frontend, backend API and database integration using a JavaScript-based technology stack.
React is used to build the client-side user interface, while Node.js provides the server-side JavaScript runtime and Express.js provides the HTTP server and API framework. MongoDB provides document-oriented data storage.
A typical MERN application separates the frontend and backend responsibilities. React communicates with Express APIs over HTTP, Express runs on Node.js and the backend communicates with MongoDB through a MongoDB driver or database library.
SharkCluster provides the server environment for deploying the MERN application, including the Node.js runtime, application process management, domain configuration, reverse proxy and HTTPS.
Quick facts
- Version
- Latest
- Database
- MongoDB
- Category
- MERN
- SSL included
- Firewall locked
- DB auto-created
- Live in minutes
Why MERN Stack on SharkCluster?
Full-stack JavaScript
Use JavaScript or TypeScript across the frontend and backend instead of maintaining completely different application languages.
React frontend
Build interactive component-based user interfaces using React.
Node.js backend
Run server-side JavaScript for APIs, authentication, business logic, integrations and background processing.
Express API layer
Build HTTP APIs, middleware, authentication routes and backend services using Express.js.
MongoDB database
Store application data in MongoDB's document-oriented database model.
Rapid application development
Use the integrated stack and large JavaScript ecosystem to develop and deploy web applications efficiently.
REST API architecture
Separate the React frontend from backend services through REST APIs and HTTP-based communication.
Scalable architecture
The frontend, API and database layers can be scaled and optimized independently as application requirements grow.
What you get with MERN Stack
Latest MERN stack boilerplate
MongoDB integration
Express.js backend
React frontend
Node.js runtime
REST API scaffold
Frontend and backend structure
MongoDB database configuration
Environment variable configuration
API route configuration
Authentication support
JWT authentication support
CORS configuration
Production build support
Development hot reload
Process manager configuration
Application logs
nginx reverse proxy
Custom domain support
HTTPS with a free SSL certificate
Git-based deployment
Background worker support
Scheduled task support
Application port configuration
What MERN Stack is built for
SaaS applications
Build dashboards, subscription platforms, authentication systems and business applications using React, Express, Node.js and MongoDB.
Admin dashboards
Create interactive administration panels connected to REST APIs and MongoDB.
E-commerce applications
Build product catalogs, shopping interfaces, customer accounts, orders and backend APIs.
Business applications
Develop internal and customer-facing applications with React interfaces and Node.js APIs.
Social applications
Build profiles, feeds, messaging, notifications and other user-driven applications.
Real-time applications
Extend the MERN architecture with WebSockets or compatible real-time libraries for chat, notifications and live dashboards.
REST API platforms
Build Node.js and Express APIs that provide data and business functionality to React applications or external clients.
Startup MVPs
Use the integrated JavaScript stack to build and deploy application prototypes and production MVPs.
Server specs for
MERN Stack
Not sure which plan to pick? The panel warns you before you deploy so you can choose the right size the first time.
- Minimum specs shown before deploy
- Panel blocks deploy if server is undersized
- Upgrade path available inside the panel
- Node.js
- Node.js 18+ or a supported LTS version.
- React
- React version included with the selected MERN template.
- Express.js
- Express.js version included with the selected MERN template.
- MongoDB
- MongoDB 6.0+ recommended.
- Operating System
- Linux recommended for production.
- Web Server
- Nginx recommended for production deployments.
- Memory
- 2 GB RAM minimum; 4 GB+ recommended for production.
- Storage
- At least 10 GB recommended.
How MERN Stack fits together
Domain
Your application domain or subdomain points to the SharkCluster server through DNS.
nginx
nginx handles public HTTP/HTTPS traffic and routes requests to the appropriate frontend or backend application process.
React frontend
React provides the browser-based user interface. A production React frontend is normally built into static assets and served through the web server or an appropriate application setup.
Express API
Express runs the backend HTTP API, handles routes and middleware and processes requests from the frontend or external clients.
Node.js
Node.js provides the runtime used to execute the Express backend and other server-side JavaScript processes.
MongoDB
MongoDB stores application data as documents and collections and is accessed by the Node.js backend.
Process manager
A process manager such as PM2 can keep the Node.js/Express backend running and restart it when required.
Environment configuration
Environment variables configure database connections, API settings, authentication secrets, ports and other environment-specific values.
Match your stack to MERN Stack
Node.js compatibility
The Node.js version must satisfy the requirements of the selected Express version, backend dependencies and build tooling.
React compatibility
React, React DOM and frontend libraries should be kept compatible with the selected React version and application tooling.
Express compatibility
Check Express and middleware compatibility before performing major framework upgrades.
MongoDB compatibility
Use a MongoDB server version supported by the application's MongoDB driver and database libraries.
Dependency compatibility
Verify authentication libraries, ODMs, UI libraries, build tools and native Node.js modules before upgrading the stack.
Test the complete stack
Test the React frontend, Express APIs, Node.js runtime and MongoDB integration together after major version changes.
After your MERN Stack deploy
- 1
Choose a server
Select server resources based on frontend build requirements, API traffic, MongoDB workload, concurrent users and background processing.
- 2
Deploy the MERN project
Clone the MERN project from Git or upload the application source to the server.
- 3
Configure Node.js
Select a Node.js version compatible with the MERN application's dependencies.
- 4
Configure MongoDB
Create or connect the MongoDB database and configure the application's database connection string.
- 5
Install backend dependencies
Install the dependencies required by the Express and Node.js backend.
- 6
Install frontend dependencies
Install the React application's dependencies using the package manager and lockfile defined by the project.
- 7
Configure environment variables
Configure database URLs, API configuration, authentication secrets, application ports and other production settings.
- 8
Build frontend
Run the React production build command defined by the project.
- 9
Start backend
Start the Express/Node.js API using the project's production start command.
- 10
Configure process manager
Run the backend under a process manager such as PM2 so the API remains available after terminal sessions end.
- 11
Configure reverse proxy
Configure nginx to serve the frontend and route API requests to the backend application.
- 12
Enable HTTPS
Configure the SSL certificate and verify secure access through the application domain.
- 13
Test the complete application
Verify frontend routes, API requests, authentication, database operations, forms and important application workflows.
Ship MERN Stack your way
Deploy application source
Deploy the frontend and backend source code to the configured application environment.
Install dependencies
Install frontend and backend dependencies using the project's package manager and lockfiles.
Configure MongoDB
Create the MongoDB database and configure the backend with the correct MongoDB connection string.
Configure environment variables
Set production configuration such as database credentials, JWT secrets, API URLs and application ports.
Build React frontend
Generate the production frontend build using the project's configured build command.
Start Express backend
Start the Node.js/Express backend using the project's production start command.
Configure API port
Run the backend on an internal server port and expose it through the reverse proxy rather than unnecessarily exposing the Node.js port publicly.
Configure frontend
Serve the production React build using the configured web-server or frontend deployment setup.
Configure process manager
Use a process manager such as PM2 for the long-running Node.js backend process.
Configure nginx
Configure nginx to serve frontend traffic and proxy API requests to the Express backend.
Enable HTTPS
Enable SSL for the application domain and verify HTTP and HTTPS routing.
Test API integration
Verify that the production React frontend can communicate with the Express API and that API requests can access MongoDB.
Verify logs
Review frontend, backend, process-manager and reverse-proxy logs for deployment and runtime errors.
Keeping MERN Stack fast
Optimize React bundle
Remove unused dependencies, split large application modules where appropriate and avoid unnecessarily large client-side bundles.
Optimize MongoDB queries
Use appropriate indexes, efficient queries and suitable document structures for the application's access patterns.
Use connection pooling
Reuse MongoDB connections appropriately instead of creating unnecessary database connections for individual requests.
Cache repeated data
Use appropriate caching mechanisms when frequently requested data can safely be cached.
Avoid blocking Node.js
Move CPU-intensive or expensive synchronous workloads away from the main Node.js event loop when appropriate.
Compress responses
Use appropriate web-server or application compression for text-based HTTP responses where it improves transfer performance.
Optimize API responses
Return only the data required by the client and avoid unnecessarily large API payloads.
Use pagination
Paginate large MongoDB result sets instead of returning very large collections in a single API response.
Scale backend processes
MERN backends can use multiple application processes or instances when the application architecture supports shared state and concurrent processing.
Monitor the stack
Monitor Node.js CPU and memory usage, MongoDB performance, API response times and frontend errors.
Before you go live
MERN source code deployed
Compatible Node.js version selected
Frontend dependencies installed
Backend dependencies installed
Lockfiles verified
MongoDB database created
MongoDB connection configured
Environment variables configured
Authentication secrets configured
React production build completed
Express production start command verified
Backend application port configured
Process manager configured
Backend process running
nginx reverse proxy configured
Frontend served correctly
API routes tested
Frontend-to-API communication tested
Database operations tested
DNS configured
HTTPS certificate active
Application logs accessible
Ready your MERN Stack for launch
Use a supported Node.js LTS release
Use maintained React and Express dependencies
Use a supported MongoDB version
Keep package dependencies updated
Use lockfiles for reproducible deployments
Run a production React build
Run the Express backend in production mode
Keep secrets out of source control
Secure environment variables
Use a dedicated application user
Run backend behind a reverse proxy
Enable HTTPS
Configure process management
Configure automatic restart
Monitor Node.js processes
Monitor MongoDB
Monitor API errors
Use secure MongoDB credentials
Restrict MongoDB network access
Configure firewall rules
Validate API input
Configure authentication and authorization
Configure CORS appropriately
Use rate limiting for public APIs where appropriate
Configure backups
Test database restoration
Keep the operating system updated
Working with MERN Stack
Check Node.js version
Display the installed Node.js version.
node -vCheck npm version
Display the installed npm version.
npm -vInstall dependencies
Install project dependencies.
npm installClean dependency install
Install dependencies exactly from the package-lock.json lockfile.
npm ciBuild React frontend
Run the production build command defined by the project.
npm run buildStart backend
Start the production application using the project's start script.
npm startDevelopment mode
Run the project's development command with development features such as hot reload.
npm run devCheck outdated packages
Check project dependencies for available updates.
npm outdatedAudit dependencies
Check npm dependencies for reported security vulnerabilities.
npm auditList PM2 applications
Display applications managed by PM2.
pm2 listView PM2 logs
Display logs from PM2-managed applications.
pm2 logsRestart backend
Restart a PM2-managed Node.js/Express backend.
pm2 restart <app-name>Check listening ports
Display TCP ports currently listening on the server.
ss -lntpCommon MERN Stack issues & fixes
502 Bad Gateway
- Cause
- nginx cannot connect to the Node.js/Express backend.
- Solution
- Check the backend process, configured port, nginx proxy configuration and application logs.
React frontend loads but API fails
- Cause
- The frontend API URL may be incorrect or nginx may not be routing API requests to the Express backend.
- Solution
- Verify the production API URL, nginx routing, backend port and browser network requests.
Cannot connect to MongoDB
- Cause
- The MongoDB connection string, credentials, database service or network configuration may be incorrect.
- Solution
- Verify MongoDB is running, check the connection string and credentials and confirm that network access is allowed.
CORS error
- Cause
- The Express API is not allowing requests from the production frontend origin.
- Solution
- Configure CORS for the correct production frontend origin and avoid using unrestricted origins for sensitive APIs.
npm install fails
- Cause
- A dependency may be incompatible with the selected Node.js version or may require additional build dependencies.
- Solution
- Review the npm error, verify runtime compatibility and check native dependency requirements.
React build fails
- Cause
- The frontend may contain build errors, incompatible dependencies or missing environment variables.
- Solution
- Run the build manually, inspect the build output and verify frontend dependencies and environment configuration.
Express application exits
- Cause
- The backend may have a startup error, missing environment variable, invalid MongoDB connection or incorrect start command.
- Solution
- Run the backend manually, inspect logs and verify the start command, environment variables and database connection.
Port already in use
- Cause
- Another process is using the configured Node.js/Express port.
- Solution
- Identify the process using the port and stop it or configure the backend to use another available port.
Slow API responses
- Cause
- Slow MongoDB queries, inefficient application logic, external API calls or excessive payload sizes may be delaying responses.
- Solution
- Inspect API timings, optimize MongoDB queries and indexes and review expensive backend operations.
High MongoDB memory usage
- Cause
- Large working sets, indexes, concurrent queries or database workload can consume significant memory.
- Solution
- Monitor MongoDB resource usage, review indexes and queries and size the server appropriately for the workload.
Authentication does not work
- Cause
- JWT secrets, cookie configuration, CORS, API URLs or authentication middleware may be incorrectly configured.
- Solution
- Verify authentication configuration, cookies or authorization headers, frontend API URLs, CORS settings and backend logs.
Application works locally but not in production
- Cause
- Runtime versions, environment variables, API URLs, MongoDB configuration, build settings or filesystem paths may differ.
- Solution
- Compare local and production runtime versions, environment configuration, build output, database settings and API endpoints.
Hardened before your first request
Every deploy is locked down from boot — closed firewall, valid SSL, and restricted access by default.
Use a supported Node.js LTS release.
Keep React, Express and other dependencies updated.
Use a supported MongoDB version.
Run dependency security audits.
Keep secrets out of Git repositories.
Store database credentials and authentication secrets securely.
Run backend processes as a dedicated non-root user.
Enable HTTPS.
Use secure MongoDB credentials.
Restrict MongoDB network access.
Validate and sanitize API input.
Implement authentication and authorization.
Configure CORS for trusted origins.
Use rate limiting for publicly exposed APIs where appropriate.
Protect authentication endpoints against abuse.
Use secure cookie settings when cookies are used for authentication.
Keep the operating system updated.
Configure a firewall.
Monitor authentication and application logs.
Remove unused dependencies.
The data layer behind MERN Stack
MongoDB
MongoDB is the database component of the standard MERN stack. It stores application data using collections and BSON documents.
MongoDB connection
The Express/Node.js backend connects to MongoDB using the MongoDB Node.js driver, Mongoose or another compatible database library.
Database configuration
The MongoDB connection string should be stored in a secure environment variable rather than hard-coded in application source code.
Indexes
Create indexes for fields frequently used in queries, sorting and filtering while considering the storage and write overhead of additional indexes.
Connection management
Production applications should reuse database connections appropriately and avoid creating unnecessary MongoDB connections for individual requests.
Backups
Production MongoDB data should be backed up according to the application's recovery objectives and data retention requirements.
Alternative databases
MERN specifically uses MongoDB. A Node.js/Express/React application can technically be adapted to PostgreSQL, MySQL or another database, but that would no longer be the standard MERN database combination.
MERN Stack environment configuration
Production mode
Run the Express backend and React frontend using their production configurations. Do not expose development servers directly to the public internet.
Environment variables
Store MongoDB connection strings, JWT secrets, API keys and other sensitive configuration outside source control.
Frontend API URL
Configure the production frontend to use the correct public API URL and verify that it matches the reverse-proxy configuration.
CORS
Configure the Express API to allow only the origins required by the production frontend and trusted integrations.
Logging
Monitor Express, Node.js, process-manager and reverse-proxy logs for startup failures, API errors and unexpected process exits.
Graceful shutdown
The backend should handle termination signals and close database connections and other resources cleanly where appropriate.
Health checks
Provide an appropriate backend health endpoint or monitoring mechanism to verify that the API and its critical dependencies are available.
Automations that run on schedule
Scheduled jobs
MERN applications can use server-level cron jobs, application schedulers, queues or external scheduling systems for recurring tasks.
API-triggered jobs
A scheduler can securely trigger a backend endpoint when the application's architecture uses HTTP-based scheduled operations.
Background workers
Long-running or resource-intensive work should generally run in a separate worker process rather than blocking Express API requests.
Avoid duplicate execution
When multiple backend instances are running, scheduled tasks should use centralized scheduling or locking when duplicate execution could cause data or business problems.
Lock down MERN Stack from day one
Supported Node.js LTS release
Maintained React version
Maintained Express version
Supported MongoDB version
Dependencies audited
Secrets excluded from source control
Environment variables secured
Backend runs as non-root user
HTTPS enabled
MongoDB credentials secured
MongoDB access restricted
API input validation enabled
Authentication configured
Authorization configured
CORS restricted appropriately
API rate limiting configured where appropriate
Secure authentication cookies configured where applicable
Firewall configured
Operating system updated
Application logs monitored
Database backups configured
A safe MERN Stack upgrade path
- 1
Record current versions
Record the current Node.js, React, Express, MongoDB driver, Mongoose and other important dependency versions.
- 2
Review compatibility
Check compatibility between Node.js, React, Express, MongoDB, database drivers and frontend build tooling before upgrading.
- 3
Back up MongoDB
Create a verified database backup before performing significant production upgrades.
- 4
Back up application configuration
Back up environment configuration, uploaded files and other application data required for rollback.
- 5
Test frontend
Run the React build and test important frontend routes and interactions after dependency upgrades.
- 6
Test backend
Test authentication, API routes, database operations, external integrations and background jobs.
- 7
Test in staging
Deploy the upgraded stack to staging before changing the production environment.
- 8
Deploy carefully
Deploy the tested versions using a controlled release process and monitor the application after deployment.
- 9
Rollback
Keep the previous application build, dependency versions and database recovery procedure available in case the upgrade causes a critical issue.
Take a snapshot before every upgrade so a bad release can be rolled back in minutes.
We manage the server, you own the store
SharkCluster manages
- VPS infrastructure
- Node.js runtime
- Application deployment environment
- nginx reverse proxy
- Process manager
- SSL
- Firewall
- Server-level cron
- Server monitoring
- Backups where enabled
- MongoDB provisioning where included in the template
You manage
- React frontend code
- Express backend code
- Node.js application logic
- MongoDB schema and data model
- package.json
- Application dependencies
- Environment variables
- Authentication
- Authorization
- API routes
- Business logic
- Third-party integrations
Everything below the application line — from nginx to backups — is infrastructure. Your code, content and store configuration are always yours, and you keep full SSH and root access.
Frequently Asked Questions
The questions we hear most from people deploying MERN Stack on SharkCluster.
Contact supportMERN is a full-stack JavaScript stack consisting of MongoDB, Express.js, React and Node.js. React handles the frontend, Express and Node.js provide the backend API layer and MongoDB stores application data.
MERN stands for MongoDB, Express.js, React and Node.js.
Yes. MongoDB is the database component of the standard MERN stack. Replacing MongoDB with another database changes the stack from the standard MERN combination.
A React, Express and Node.js application can use PostgreSQL, but the database component would no longer be MongoDB, so it would not be the standard MERN stack.
React is used to build the frontend user interface and interactive components that run in the user's browser.
Express is commonly used as the backend HTTP framework for creating API routes, middleware, authentication endpoints and server-side application logic.
Node.js provides the server-side JavaScript runtime that executes the Express backend and other Node.js processes.
Yes. Express running on Node.js can provide REST APIs that communicate with the React frontend and MongoDB.
Yes. MERN applications can implement authentication using sessions, tokens such as JWTs, cookies and other authentication mechanisms.
Yes. React, Node.js and Express applications can be developed with TypeScript when the project's tooling and dependencies are configured for it.
Yes. Node.js applications can add WebSocket-based functionality using technologies such as Socket.IO or the WebSocket API.
Yes. A MERN application can be deployed on a VPS with Node.js, MongoDB, a production React build, an Express backend, a process manager and a reverse proxy such as nginx.
Yes. Multiple backend processes can run on different internal ports and use separate domains or subdomains through the reverse proxy, provided the server has sufficient resources.
Usually no. The Express backend can listen on an internal port while nginx handles public HTTPS traffic and proxies API requests to the backend.
A 502 commonly means the reverse proxy cannot connect to the Node.js/Express process. Check the process status, backend port, nginx configuration and application logs.
Common causes include an incorrect production API URL, CORS configuration, nginx routing or a backend process that is not running.
Check the MongoDB service, connection string, credentials, network access, database driver configuration and application logs.
Yes, but the target Node.js version must be compatible with the React build tooling, Express version, database drivers and other project dependencies. Test the change before production deployment.
Yes, but MongoDB server upgrades should be planned around the application's MongoDB driver, ODM, data compatibility and backup/restore procedures.
SharkCluster manages the server and deployment environment, while your application code, dependencies, API logic, React components, MongoDB data model and application-level configuration remain under your control.
From deploy to live in minutes
Stack configured
Runtime, process manager and config files set up for you.
MongoDB wired
Database created with a user and credentials in your config.
SSL + firewall
Free Let's Encrypt certificate and closed-by-default UFW rules.
Deploy anytime
Push with Git, or use the built-in file manager and ZIP upload.
How do you start
with SharkCluster?
To start with SharkCluster, create an account and your first server on DigitalOcean, Contabo or OVHcloud — no credit card or lock-in contract is needed. Every account includes free self-hosted business apps, free local backups, unlimited migrations and a dedicated DevOps manager.