
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
create-mern-cli
Advanced tools
A powerful CLI tool to effortlessly generate a MERN stack project (MongoDB, Express, React, Node.js) with Vite/Webpack, Tailwind/Bootstrap, and backend frameworks like Express.js. Ideal for developers looking to bootstrap full-stack JavaScript projects wi
A powerful CLI tool to scaffold full-stack MERN (MongoDB, Express, React, Node.js) applications with robust error handling and automatic cleanup.
npx create-mern-cli@latest
For global installation:
npm install -g create-mern-cli
create-mern-cli
Run the CLI and follow the interactive prompts:
npx create-mern-cli
You'll be asked to configure:
Your new project will include:
project-name/
โโโ client/ # React frontend
โ โโโ public/ # Static assets
โ โโโ src/ # Application code
โ โโโ package.json # Frontend dependencies
โ
โโโ server/ # Node.js server
โโโ controllers/ # Business logic
โโโ routes/ # API endpoints
โโโ models/ # Database models
โโโ .env # Environment variables
โโโ index.js # Server entry point
โโโ package.json # Backend dependencies
The CLI features robust error handling:
Example error scenario:
Error: Failed to install dependencies
๐งน Cleaning up created files and directories...
- Deleted file: /projects/test-mern/backend/package.json
- Deleted directory: /projects/test-mern/backend
โ ๏ธ Setup failed. All created files have been removed.
cd your-project-name
cd client && npm run dev # Frontend
cd server && npm run dev # Backend
http://localhost:3000
Backend .env
template:
PORT=5000
NODE_ENV=development
# MongoDB (if using Mongoose)
MONGO_URI=mongodb://localhost:27017/yourdb
# SQL (if using Sequelize)
DB_NAME=yourdb
DB_USER=root
DB_PASSWORD=
DB_HOST=localhost
The generated backend includes:
cd client
npm run build # Outputs to /dist
cd server
npm start # Production mode
Recommended hosting:
Q: What if installation gets interrupted?
A: The cleanup system will remove all partial files automatically.
Q: How do I add more backend routes?
A: Create new files in:
backend/routes/
for endpointsbackend/controllers/
for business logicQ: Can I use TypeScript?
A: Yes! Select TypeScript when prompted during Vite setup.
For issues, please:
node -v
)We welcome contributions! Please:
MIT ยฉ Prashant Sharma and Vikas Tiwari
FAQs
A powerful CLI tool to effortlessly generate a MERN stack project (MongoDB, Express, React, Node.js) with Vite/Webpack, Tailwind/Bootstrap, and backend frameworks like Express.js. Ideal for developers looking to bootstrap full-stack JavaScript projects wi
We found that create-mern-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socketโs new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.