mern-cli-start 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # 🚀 Mern-Cli-Start
2
+
3
+ This project was generated using **mern-cli-start** — a production-ready MERN stack starter.
4
+
5
+ ---
6
+
7
+ ## 📦 Tech Stack
8
+
9
+ ### Frontend
10
+ - React (Vite)
11
+ - Modern folder structure
12
+ - Component-based architecture
13
+
14
+ ### Backend
15
+ - Node.js
16
+ - Express.js
17
+ - MVC Architecture
18
+ - REST API ready
19
+
20
+ ---
21
+
22
+ ## 📁 Project Structure
23
+
24
+ ```
25
+
26
+ root/
27
+
28
+ ├── backend/ # Node.js + Express API
29
+ │ ├── src/
30
+ │ │ ├── controllers/
31
+ │ │ ├── models/
32
+ │ │ ├── routes/
33
+ │ │ ├── middleware/
34
+ │ │ └── app.js
35
+ │ └── server.js
36
+
37
+ ├── frontend/ # React + Vite App
38
+ │ ├── src/
39
+ │ │ ├── components/
40
+ │ │ ├── pages/
41
+ │ │ └── App.jsx
42
+ │ └── index.html
43
+
44
+ └── README.md
45
+
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 🌐 Default Ports
51
+
52
+ - Frontend → http://localhost:5173
53
+ - Backend → http://localhost:8000
54
+
55
+ ---
56
+
57
+ ## 📌 Features
58
+
59
+ - Clean folder structure
60
+ - Scalable architecture
61
+ - Easy to customize
62
+ - Fast development setup
63
+ - Auto dependency install
64
+
65
+ ---
66
+
67
+ ## 🛠️ Customization Guide
68
+
69
+ Add new API route : ``` backend/src/routes/ ```
70
+
71
+ Add new controller : ``` backend/src/controllers/ ```
72
+
73
+ Add frontend page : ``` frontend/src/pages/ ```
74
+
75
+ Add reusable components : ``` frontend/src/components/ ```
76
+
77
+ ---
78
+
79
+ ## 🔐 Environment Variables
80
+
81
+ Create a .env file in backend/:
82
+ ```
83
+ PORT=8000
84
+ MONGO_URI=your_mongodb_connection
85
+ JWT_SECRET=your_secret_key
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 👨‍💻 Created By
91
+
92
+ Adarsh Shaw
93
+
94
+ - 💼 Developer | MERN Stack Enthusiast
95
+ - 🚀 Passionate about building scalable and real-world applications
96
+ - 🛠️ Creator of create-mern-pro
97
+ - 🔗 Connect with me
98
+ - [GitHub](https://github.com/adarsh-279)
99
+ - [Linkedin](https://www.linkedin.com/in/adarsh-shaw279/)
100
+ - [Portfolio](https://adarshshaw.vercel.app)
101
+
102
+ ---
103
+
104
+ ## 🤝 Contributing
105
+
106
+ Contributions are welcome! 🎉
107
+ Open issues, suggest features, or submit pull requests to make even better.
108
+
109
+ ---
110
+
111
+ ## ⭐ Support
112
+
113
+ If you like this project, give it a ⭐ on GitHub!
package/index.js ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createProject } from "./lib/createProject.js";
4
+
5
+ const name = process.argv[2];
6
+
7
+ if (!name) {
8
+ console.log("Please provide project name");
9
+ console.log("Example: npx mern-app myApp");
10
+ process.exit(1);
11
+ }
12
+
13
+ createProject(name);
@@ -0,0 +1,33 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ import { execSync } from "child_process";
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ export function createProject(name) {
10
+ const templatePath = path.join(__dirname, "../templates/base");
11
+ const targetPath = path.join(process.cwd(), name);
12
+
13
+ if (fs.existsSync(targetPath)) {
14
+ console.log("Folder already exists");
15
+ process.exit(1);
16
+ }
17
+
18
+ fs.cpSync(templatePath, targetPath, { recursive: true });
19
+
20
+ console.log("📦 Installing backend dependencies...");
21
+ execSync("npm install", {
22
+ cwd: path.join(targetPath, "backend"),
23
+ stdio: "inherit",
24
+ });
25
+
26
+ console.log("📦 Installing frontend dependencies...");
27
+ execSync("npm install", {
28
+ cwd: path.join(targetPath, "frontend"),
29
+ stdio: "inherit",
30
+ });
31
+
32
+ console.log(`\n ${name} created successfully!\n`);
33
+ }
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "mern-cli-start",
3
+ "version": "1.0.0",
4
+ "description": "CLI to generate production-ready MERN apps",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/adarsh-279/mern-start.git"
12
+ },
13
+ "keywords": [
14
+ "mern",
15
+ "cli",
16
+ "starter",
17
+ "boilerplate"
18
+ ],
19
+ "bin": {
20
+ "mern-start": "index.js"
21
+ },
22
+ "directories": {
23
+ "lib": "lib"
24
+ },
25
+ "files": [
26
+ "templates",
27
+ "index.js",
28
+ "lib"
29
+ ],
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "preferGlobal": true,
34
+ "author": "Adarsh Shaw",
35
+ "license": "MIT",
36
+ "type": "module",
37
+ "bugs": {
38
+ "url": "https://github.com/adarsh-279/mern-start/issues"
39
+ },
40
+ "homepage": "https://github.com/adarsh-279/mern-start#readme"
41
+ }
@@ -0,0 +1,113 @@
1
+ # 🚀 Mern-Cli-Start
2
+
3
+ This project was generated using **mern-cli-start** — a production-ready MERN stack starter.
4
+
5
+ ---
6
+
7
+ ## 📦 Tech Stack
8
+
9
+ ### Frontend
10
+ - React (Vite)
11
+ - Modern folder structure
12
+ - Component-based architecture
13
+
14
+ ### Backend
15
+ - Node.js
16
+ - Express.js
17
+ - MVC Architecture
18
+ - REST API ready
19
+
20
+ ---
21
+
22
+ ## 📁 Project Structure
23
+
24
+ ```
25
+
26
+ root/
27
+
28
+ ├── backend/ # Node.js + Express API
29
+ │ ├── src/
30
+ │ │ ├── controllers/
31
+ │ │ ├── models/
32
+ │ │ ├── routes/
33
+ │ │ ├── middleware/
34
+ │ │ └── app.js
35
+ │ └── server.js
36
+
37
+ ├── frontend/ # React + Vite App
38
+ │ ├── src/
39
+ │ │ ├── components/
40
+ │ │ ├── pages/
41
+ │ │ └── App.jsx
42
+ │ └── index.html
43
+
44
+ └── README.md
45
+
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 🌐 Default Ports
51
+
52
+ - Frontend → http://localhost:5173
53
+ - Backend → http://localhost:8000
54
+
55
+ ---
56
+
57
+ ## 📌 Features
58
+
59
+ - Clean folder structure
60
+ - Scalable architecture
61
+ - Easy to customize
62
+ - Fast development setup
63
+ - Auto dependency install
64
+
65
+ ---
66
+
67
+ ## 🛠️ Customization Guide
68
+
69
+ Add new API route : ``` backend/src/routes/ ```
70
+
71
+ Add new controller : ``` backend/src/controllers/ ```
72
+
73
+ Add frontend page : ``` frontend/src/pages/ ```
74
+
75
+ Add reusable components : ``` frontend/src/components/ ```
76
+
77
+ ---
78
+
79
+ ## 🔐 Environment Variables
80
+
81
+ Create a .env file in backend/:
82
+ ```
83
+ PORT=8000
84
+ MONGO_URI=your_mongodb_connection
85
+ JWT_SECRET=your_secret_key
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 👨‍💻 Created By
91
+
92
+ Adarsh Shaw
93
+
94
+ - 💼 Developer | MERN Stack Enthusiast
95
+ - 🚀 Passionate about building scalable and real-world applications
96
+ - 🛠️ Creator of create-mern-pro
97
+ - 🔗 Connect with me
98
+ - [GitHub](https://github.com/adarsh-279)
99
+ - [Linkedin](https://www.linkedin.com/in/adarsh-shaw279/)
100
+ - [Portfolio](https://adarshshaw.vercel.app)
101
+
102
+ ---
103
+
104
+ ## 🤝 Contributing
105
+
106
+ Contributions are welcome! 🎉
107
+ Open issues, suggest features, or submit pull requests to make even better.
108
+
109
+ ---
110
+
111
+ ## ⭐ Support
112
+
113
+ If you like this project, give it a ⭐ on GitHub!
File without changes
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "backend",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "server.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "type": "module",
13
+ "dependencies": {
14
+ "bcryptjs": "^3.0.3",
15
+ "cookie-parser": "^1.4.7",
16
+ "cors": "^2.8.6",
17
+ "dotenv": "^17.4.2",
18
+ "express": "^5.2.1",
19
+ "jsonwebtoken": "^9.0.3",
20
+ "mongoose": "^9.4.1"
21
+ }
22
+ }
@@ -0,0 +1,7 @@
1
+ import dotenv from "dotenv";
2
+ dotenv.config();
3
+
4
+ import app from "./src/app.js";
5
+ import connectDB from "./src/db/database.js";
6
+
7
+ connectDB();
@@ -0,0 +1,19 @@
1
+ import dotenv from "dotenv";
2
+ dotenv.config();
3
+
4
+ import express from "express";
5
+
6
+ const app = express();
7
+
8
+ app.use(express.json());
9
+ app.use(cookieParser());
10
+
11
+ app.get("/", (req, res) => {
12
+ res.send("Default Route");
13
+ });
14
+
15
+ app.listen(process.env.PORT, () => {
16
+ console.log(`Server is running on port: https://localhost:${process.env.PORT}`);
17
+ });
18
+
19
+ export default app;
@@ -0,0 +1,15 @@
1
+ import mongoose from "mongoose";
2
+
3
+ async function connectDB() {
4
+ return mongoose
5
+ .connect(process.env.MONGODB_URL)
6
+ .then(() => {
7
+ console.log("Connected to db");
8
+ })
9
+ .catch((err) => {
10
+ console.log("Not connected :", err);
11
+ throw err;
12
+ });
13
+ }
14
+
15
+ export default connectDB;
@@ -0,0 +1,16 @@
1
+ # React + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
@@ -0,0 +1,29 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import { defineConfig, globalIgnores } from 'eslint/config'
6
+
7
+ export default defineConfig([
8
+ globalIgnores(['dist']),
9
+ {
10
+ files: ['**/*.{js,jsx}'],
11
+ extends: [
12
+ js.configs.recommended,
13
+ reactHooks.configs.flat.recommended,
14
+ reactRefresh.configs.vite,
15
+ ],
16
+ languageOptions: {
17
+ ecmaVersion: 2020,
18
+ globals: globals.browser,
19
+ parserOptions: {
20
+ ecmaVersion: 'latest',
21
+ ecmaFeatures: { jsx: true },
22
+ sourceType: 'module',
23
+ },
24
+ },
25
+ rules: {
26
+ 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27
+ },
28
+ },
29
+ ])
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Mern Start</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.jsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "frontend",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "lint": "eslint .",
10
+ "preview": "vite preview"
11
+ },
12
+ "dependencies": {
13
+ "@tailwindcss/vite": "^4.2.2",
14
+ "axios": "^1.15.0",
15
+ "react": "^19.2.4",
16
+ "react-dom": "^19.2.4",
17
+ "react-router-dom": "^7.14.0",
18
+ "tailwindcss": "^4.2.2"
19
+ },
20
+ "devDependencies": {
21
+ "@eslint/js": "^9.39.4",
22
+ "@types/react": "^19.2.14",
23
+ "@types/react-dom": "^19.2.3",
24
+ "@vitejs/plugin-react": "^6.0.1",
25
+ "eslint": "^9.39.4",
26
+ "eslint-plugin-react-hooks": "^7.0.1",
27
+ "eslint-plugin-react-refresh": "^0.5.2",
28
+ "globals": "^17.4.0",
29
+ "vite": "^8.0.4"
30
+ }
31
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react'
2
+ import Routing from './routes/Routing'
3
+
4
+ const App = () => {
5
+ return (
6
+ <>
7
+ <Routing />
8
+ </>
9
+ )
10
+ }
11
+
12
+ export default App
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,10 @@
1
+ import { createRoot } from 'react-dom/client'
2
+ import './index.css'
3
+ import App from './App.jsx'
4
+ import { BrowserRouter } from 'react-router-dom'
5
+
6
+ createRoot(document.getElementById('root')).render(
7
+ <BrowserRouter>
8
+ <App />
9
+ </BrowserRouter>,
10
+ )
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+
3
+ const Home = () => {
4
+ return (
5
+ <div className="min-h-screen flex flex-col items-center justify-center p-6">
6
+ <h1 className="text-4xl font-bold mb-2">MERN Pro App</h1>
7
+ <p className="text-lg mb-6 text-gray-600">
8
+ Project created successfully using create-mern-pro
9
+ </p>
10
+
11
+ <div className="bg-gray-100 p-4 rounded-lg w-full max-w-md mb-4">
12
+ <h2 className="font-semibold mb-2">Project Structure</h2>
13
+ <ul className="list-disc ml-5">
14
+ <li>Backend (Node + Express)</li>
15
+ <li>Frontend (React + Vite)</li>
16
+ </ul>
17
+ </div>
18
+
19
+ <div className="bg-gray-100 p-4 rounded-lg w-full max-w-md">
20
+ <h2 className="font-semibold mb-2">Start</h2>
21
+ <p>Run: npm run dev</p>
22
+ </div>
23
+ </div>
24
+ );
25
+ };
26
+
27
+ export default Home
@@ -0,0 +1,13 @@
1
+ import React from 'react'
2
+ import {Route, Routes} from "react-router-dom"
3
+ import Home from '../pages/Home'
4
+
5
+ const Routing = () => {
6
+ return (
7
+ <Routes>
8
+ <Route path="/" element={<Home />} />
9
+ </Routes>
10
+ )
11
+ }
12
+
13
+ export default Routing
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import tailwindcss from "@tailwindcss/vite";
4
+
5
+ // https://vite.dev/config/
6
+ export default defineConfig({
7
+ plugins: [react(), tailwindcss()],
8
+ })