Skip to content

kuntalojha/CLI-TOOL

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-mern-backend 🛠️

npm version License: MIT

A zero-config CLI tool to scaffold production-ready MERN stack backend applications with best practices.


🚀 Features

  • Instant setup – Spin up a MERN backend project in seconds
  • 📁 Modular architecture – Clean and scalable folder structure
  • 🔐 Secure by default – Configured with CORS, dotenv, and Helmet
  • 🔌 MongoDB ready – Pre-wired database connection
  • 📦 Lightweight – Only essential dependencies included

📦 Installation

Quick Start (Recommended)

npx create-mern-backend@latest

Global Installation

npm install -g create-mern-backend
create-mern-backend

Project Structure 🌳

my-mern-backend/
├── config/
│   └── db.js          # MongoDB connection config
├── controllers/       # Route controllers
├── models/            # Mongoose models
├── routes/            # API route definitions
├── middlewares/       # Custom middleware
├── utils/             # Utility functions
├── .env               # Environment variables
├── .gitignore         # Git ignore rules
└── server.js          # Express server entry point

Generated Configuration ⚙️

server.js

const express = require("express");
require("dotenv").config();

const app = express();

// Middleware
app.use(express.json());
app.use(cors());

// Database connection
require("./config/db")();

// Basic route
app.get("/", (req, res) => res.send("MERN Backend Running"));

const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));

.env Template

# Server Configuration
PORT=5000

# MongoDB
MONGO_URI=your_mongodb_connection_string

# Authentication
JWT_SECRET=your_random_secret_key
JWT_EXPIRE=30d

Development Scripts 🛠️

After scaffolding:

cd your-project-name
npm install
npm start

Why Use This? 🤔

  • Saves hours of manual setup
  • Implements industry best practices
  • Easily extensible architecture
  • Perfect for:
    • Prototyping
    • Hackathons
    • Production applications
    • Learning MERN stack

Contributing 🤝

Pull requests are welcome! Please open an issue first to discuss changes.

License 📄

MIT © Vikash Bharal



About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%