Deploy Your MERN Stack App to Vercel or Render (2025 Step-by-Step Guide)
You've built your MERN app locally β now itβs time to go live. In 2025, platforms like Vercel and Render make deploying full-stack apps easier than ever.
This guide walks you through deploying a MERN app (MongoDB, Express, React, Node) to Vercel or Render, step-by-step.
π Deployment Options at a Glance
Feature | Vercel | Render |
---|---|---|
Ideal for | Frontend (React/Next) | Full-stack, backend |
Server support | API Routes only | Full Express backend |
Auto Deploy | β GitHub integration | β GitHub integration |
Free Tier | β Generous | β Generous |
π Folder Structure
mern-app/
βββ client/ # React frontend
βββ server/ # Express backend
βββ .env
βββ README.md
π‘ Make sure your frontend and backend are clearly separated for Render, or merge them into one for Vercel.
π§ Preparing for Deploy
-
Push your code to GitHub
-
Create a
.env
file with:MONGO_URI
JWT_SECRET
PORT=5000
-
Add
start
script inserver/package.json
:
"scripts": { "start": "node index.js" }
- Optional (for combined deploy):
Inclient/package.json
, add:
"proxy": "http://localhost:5000"
π Deploy to Render (Recommended for Full-Stack)
- Go to https://render.com
- Create Web Service
- Connect GitHub repo
- Set root directory to
server/
- Add environment variables (MONGO_URI, etc.)
- Choose Node version + region
- Click Deploy
β React frontend can be deployed separately via Static Site on Render or Netlify.
β‘ Deploy to Vercel (Recommended for Frontend)
- Go to https://vercel.com
- Connect GitHub repo
- Set root to
client/
- Add
.env
vars if needed (Vercel β Project Settings) - Click Deploy
π For backend, use Render, Railway, or Vercelβs Serverless API routes.
π§ Tips for Clean Deployment
- Donβt commit your
.env
file - Use
.env.production
for live secrets - Add CORS setup in Express:
const cors = require("cors"); app.use(cors({ origin: "https://yourfrontend.vercel.app" }));
β Summary
Deploy Platform | Best For |
---|---|
Vercel | React (client only) |
Render | Full backend + frontend |
Your MERN app is ready to go global. Choose the right platform, link your repo, and go live in minutes β not days.
Published on: 2025-06-18