backend-scaffold-cli 1.5.0 → 1.5.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 +66 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
# backend-scaffold-cli
|
|
2
3
|
|
|
3
|
-
A CLI tool to quickly scaffold Express.js backend projects with MongoDB, middleware, and common setup. It automatically generates production-ready projects with JWT authentication, error handling, request logging, input validation, DNS configuration, and pre-configured MongoDB Atlas connection.
|
|
4
|
+
A CLI tool to quickly scaffold Express.js backend projects with MongoDB, middleware, and common setup. It automatically generates production-ready projects with JWT authentication, error handling, request logging, input validation, DNS configuration, and pre-configured MongoDB Atlas connection. Every project has different requirements, so this tool provides a solid, common foundation that developers can easily modify, extend, or trim according to their specific needs.
|
|
4
5
|
|
|
5
6
|
## Features
|
|
6
7
|
|
|
@@ -13,13 +14,17 @@ A CLI tool to quickly scaffold Express.js backend projects with MongoDB, middlew
|
|
|
13
14
|
|
|
14
15
|
🔐 **Security**
|
|
15
16
|
- JWT authentication middleware
|
|
17
|
+
- Password hashing with bcryptjs
|
|
16
18
|
- Error handling middleware
|
|
17
19
|
- CORS configuration
|
|
20
|
+
- Rate limiting (optional)
|
|
18
21
|
|
|
19
22
|
📝 **Developer Experience**
|
|
20
23
|
- Logging middleware
|
|
21
|
-
- Input validation
|
|
22
|
-
-
|
|
24
|
+
- Input validation (optional)
|
|
25
|
+
- File upload support with multer (optional)
|
|
26
|
+
- Axios utility for external API calls (optional)
|
|
27
|
+
- Sample routes and User model
|
|
23
28
|
- Git initialization
|
|
24
29
|
- Auto dependency installation
|
|
25
30
|
|
|
@@ -38,55 +43,92 @@ npm install -g backend-scaffold-cli
|
|
|
38
43
|
create-express-backend my-app
|
|
39
44
|
```
|
|
40
45
|
|
|
46
|
+
> **Tip:** Always use `@latest` to ensure you get the newest version with all features and bug fixes.
|
|
47
|
+
|
|
41
48
|
## Usage
|
|
42
49
|
|
|
43
50
|
```bash
|
|
44
|
-
npx backend-scaffold-cli <project-name>
|
|
51
|
+
npx backend-scaffold-cli@latest <project-name>
|
|
45
52
|
```
|
|
46
53
|
|
|
47
54
|
You'll be prompted to select features:
|
|
48
|
-
- ✅ Include JWT authentication
|
|
49
|
-
- ✅ Include logging middleware
|
|
55
|
+
- ✅ Include JWT authentication (adds bcryptjs + User model)
|
|
50
56
|
- ✅ Include input validation
|
|
57
|
+
- ✅ Include rate limiting
|
|
58
|
+
- ✅ Include file upload support (multer)
|
|
59
|
+
- ✅ Include axios (for external API calls)
|
|
51
60
|
- ✅ Install dependencies
|
|
52
61
|
|
|
62
|
+
After setup, copy `.env.example` to `.env`, configure your MongoDB URI, then run:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm start
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Test it's working:
|
|
69
|
+
```bash
|
|
70
|
+
curl http://localhost:5000/api/health
|
|
71
|
+
```
|
|
72
|
+
|
|
53
73
|
## Project Structure
|
|
74
|
+
|
|
54
75
|
```
|
|
55
76
|
my-app/
|
|
56
77
|
├── src/
|
|
57
|
-
│
|
|
58
|
-
│
|
|
59
|
-
│
|
|
60
|
-
│
|
|
61
|
-
│
|
|
62
|
-
│
|
|
63
|
-
│
|
|
78
|
+
│ ├── config/
|
|
79
|
+
│ │ └── db.js
|
|
80
|
+
│ ├── middleware/
|
|
81
|
+
│ │ ├── errorHandler.js
|
|
82
|
+
│ │ ├── logger.js
|
|
83
|
+
│ │ ├── auth.js
|
|
84
|
+
│ │ ├── validation.js
|
|
85
|
+
│ │ ├── rateLimiter.js
|
|
86
|
+
│ │ └── upload.js
|
|
87
|
+
│ ├── routes/
|
|
88
|
+
│ │ └── index.js
|
|
89
|
+
│ ├── controllers/
|
|
90
|
+
│ ├── models/
|
|
91
|
+
│ │ └── User.js
|
|
92
|
+
│ ├── utils/
|
|
93
|
+
│ │ └── axiosUtil.js
|
|
94
|
+
│ ├── validation/
|
|
95
|
+
│ └── server.js
|
|
96
|
+
├── uploads/
|
|
64
97
|
├── .env.example
|
|
65
98
|
├── .gitignore
|
|
66
99
|
└── package.json
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Quick Start
|
|
70
100
|
|
|
71
|
-
```bash
|
|
72
|
-
npx backend-scaffold-cli my-app
|
|
73
|
-
cd my-app
|
|
74
|
-
cp .env.example .env
|
|
75
|
-
npm start
|
|
76
101
|
```
|
|
77
102
|
|
|
78
|
-
Visit: `http://localhost:5000/api/health`
|
|
79
103
|
|
|
80
104
|
## Environment Variables
|
|
81
105
|
|
|
82
106
|
```env
|
|
107
|
+
# Server Configuration
|
|
83
108
|
PORT=5000
|
|
84
109
|
NODE_ENV=development
|
|
110
|
+
|
|
111
|
+
# MongoDB Configuration
|
|
85
112
|
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/dbname
|
|
86
|
-
|
|
113
|
+
DB_NAME=myapp
|
|
114
|
+
|
|
115
|
+
# DNS Configuration
|
|
87
116
|
DNS_SERVERS=8.8.8.8,8.8.4.4
|
|
117
|
+
|
|
118
|
+
# JWT Configuration
|
|
119
|
+
JWT_SECRET=your-secret-key-change-this-in-production
|
|
120
|
+
JWT_EXPIRE=7d
|
|
121
|
+
|
|
122
|
+
# CORS
|
|
123
|
+
CORS_ORIGIN=http://localhost:3000
|
|
88
124
|
```
|
|
89
125
|
|
|
126
|
+
|
|
127
|
+
|
|
90
128
|
## License
|
|
91
129
|
|
|
92
|
-
MIT
|
|
130
|
+
MIT
|
|
131
|
+
|
|
132
|
+
## Repository
|
|
133
|
+
|
|
134
|
+
https://github.com/abhi-0605/express-backend
|