mvc-faststart-express 1.0.0 → 1.0.1
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 +91 -0
- package/index.js +1 -1
- package/package.json +11 -4
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# mern-mvc-generator
|
|
2
|
+
|
|
3
|
+
A lightweight, zero-dependency CLI tool for scaffolding professional MERN (MongoDB, Express, React, Node.js) backend APIs with a clean MVC structure.
|
|
4
|
+
|
|
5
|
+
This generator creates a ready-to-use Express.js backend featuring:
|
|
6
|
+
- MVC pattern (Models, Views not included — API-focused, Controllers, Services)
|
|
7
|
+
- Best practices: error handling, async wrappers, CORS, Helmet, etc.
|
|
8
|
+
- Example User model, controller, service, and route
|
|
9
|
+
- MongoDB connection via Mongoose
|
|
10
|
+
- Development mode with Nodemon
|
|
11
|
+
|
|
12
|
+
All with **no external dependencies** for the generator itself — pure Node.js!
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
Install globally to use the CLI anywhere:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g mern-mvc-generator
|
|
20
|
+
Or use directly with npx (no global install needed):
|
|
21
|
+
Bashnpx mern-mvc-generator my-api-project
|
|
22
|
+
Usage
|
|
23
|
+
Global Install
|
|
24
|
+
Bashmern-mvc-generator [project-name]
|
|
25
|
+
With npx
|
|
26
|
+
Bashnpx mern-mvc-generator [project-name]
|
|
27
|
+
|
|
28
|
+
If no project-name is provided, defaults to mern-api-service.
|
|
29
|
+
The tool will create a new directory with the project name and scaffold the backend inside it.
|
|
30
|
+
It automatically runs npm install for the required dependencies.
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
Bashmern-mvc-generator my-awesome-api
|
|
34
|
+
cd my-awesome-api
|
|
35
|
+
npm run dev
|
|
36
|
+
Generated Project Structure
|
|
37
|
+
textmy-awesome-api/
|
|
38
|
+
├── .env
|
|
39
|
+
├── package.json
|
|
40
|
+
└── src/
|
|
41
|
+
├── app.js
|
|
42
|
+
├── server.js
|
|
43
|
+
├── config/
|
|
44
|
+
│ └── db.js
|
|
45
|
+
├── controllers/
|
|
46
|
+
│ ├── index.js
|
|
47
|
+
│ └── user.controller.js
|
|
48
|
+
├── middlewares/
|
|
49
|
+
│ └── error.js
|
|
50
|
+
├── models/
|
|
51
|
+
│ ├── index.js
|
|
52
|
+
│ └── user.model.js
|
|
53
|
+
├── routes/
|
|
54
|
+
│ ├── index.js
|
|
55
|
+
│ └── user.route.js
|
|
56
|
+
├── services/
|
|
57
|
+
│ ├── index.js
|
|
58
|
+
│ └── user.service.js
|
|
59
|
+
└── utils/
|
|
60
|
+
├── ApiError.js
|
|
61
|
+
└── catchAsync.js
|
|
62
|
+
Key Features in the Scaffold
|
|
63
|
+
|
|
64
|
+
Centralized error handling (ApiError, converter, handler)
|
|
65
|
+
Async wrapper (catchAsync)
|
|
66
|
+
Modular routes under /v1
|
|
67
|
+
Example CRUD-ready User resource (currently implements GET /v1/users)
|
|
68
|
+
Environment-based config (.env with PORT and MONGODB_URL)
|
|
69
|
+
|
|
70
|
+
Running the Generated API
|
|
71
|
+
Bashcd your-project-name
|
|
72
|
+
npm run dev # Starts with nodemon (hot-reload)
|
|
73
|
+
# or
|
|
74
|
+
npm start # Production mode
|
|
75
|
+
The server will run on http://localhost:5000 (or your configured PORT).
|
|
76
|
+
Test the example endpoint:
|
|
77
|
+
textGET http://localhost:5000/v1/users
|
|
78
|
+
Customization
|
|
79
|
+
The generated project is fully yours — extend models, add more routes/controllers/services, integrate authentication (e.g., JWT), pagination, validation, etc.
|
|
80
|
+
Why This Generator?
|
|
81
|
+
|
|
82
|
+
Zero dependencies for the CLI itself → fast, portable, no bloat.
|
|
83
|
+
Uses native Node.js modules and ANSI colors.
|
|
84
|
+
Focuses on clean, maintainable backend structure inspired by real-world production APIs.
|
|
85
|
+
Perfect starting point for MERN stack backends.
|
|
86
|
+
|
|
87
|
+
Contributing
|
|
88
|
+
Contributions are welcome! Feel free to open issues or PRs on the repository.
|
|
89
|
+
License
|
|
90
|
+
MIT
|
|
91
|
+
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "mvc-faststart-express",
|
|
3
|
-
"version": "1.0.
|
|
2
|
+
"name": "mvc-faststart-express",
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A zero-dependency CLI for scaffolding production-ready MERN MVC architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"mvc-faststart-express": "index.js"
|
|
9
9
|
},
|
|
10
|
-
"keywords": [
|
|
10
|
+
"keywords": [
|
|
11
|
+
"express",
|
|
12
|
+
"mvc",
|
|
13
|
+
"mern",
|
|
14
|
+
"boilerplate",
|
|
15
|
+
"cli",
|
|
16
|
+
"generator"
|
|
17
|
+
],
|
|
11
18
|
"author": "Vinay Kumar",
|
|
12
19
|
"license": "MIT",
|
|
13
20
|
"engines": {
|
|
14
21
|
"node": ">=16.0.0"
|
|
15
22
|
},
|
|
16
23
|
"dependencies": {}
|
|
17
|
-
}
|
|
24
|
+
}
|