create-prod-backend 1.1.3 → 1.1.5
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 +175 -6
- package/bin/index.js +0 -0
- package/package.json +1 -1
- package/src/services/file.service.js +5 -0
- package/src/services/folder.service.js +6 -1
- package/src/services/package.service.js +2 -2
package/README.md
CHANGED
|
@@ -1,12 +1,181 @@
|
|
|
1
|
-
# create-prod-backend
|
|
1
|
+
# create-prod-backend
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Build a **production-ready Express backend** in seconds — no boilerplate, no setup headaches.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
9
|
+
Use directly with **npx** (recommended):
|
|
10
|
+
|
|
11
|
+
```bash
|
|
7
12
|
npx create-prod-backend
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or install globally:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g create-prod-backend
|
|
19
|
+
create-prod-backend
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
8
23
|
|
|
9
24
|
## Features
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
25
|
+
|
|
26
|
+
* Instant Express.js backend setup
|
|
27
|
+
* Clean and scalable folder structure
|
|
28
|
+
* Optional MongoDB integration
|
|
29
|
+
* Environment variable support (.env)
|
|
30
|
+
* Select dependencies interactively
|
|
31
|
+
* Production-ready scripts
|
|
32
|
+
* Developer-friendly CLI
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## What It Generates
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
project-name/
|
|
40
|
+
│
|
|
41
|
+
├── src/
|
|
42
|
+
│ ├── controllers/
|
|
43
|
+
│ ├── routes/
|
|
44
|
+
│ ├── models/
|
|
45
|
+
│ ├── middlewares/
|
|
46
|
+
│ ├── utils/
|
|
47
|
+
│ ├── db/
|
|
48
|
+
│ │
|
|
49
|
+
│ ├── app.js
|
|
50
|
+
│ ├── index.js
|
|
51
|
+
│ └── constants.js
|
|
52
|
+
│
|
|
53
|
+
├── public/
|
|
54
|
+
│
|
|
55
|
+
├── .env
|
|
56
|
+
├── .gitignore
|
|
57
|
+
├── package.json
|
|
58
|
+
└── README.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
Run the CLI:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx create-prod-backend
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### You’ll be prompted for:
|
|
72
|
+
|
|
73
|
+
* Project name
|
|
74
|
+
* MongoDB setup (Yes/No)
|
|
75
|
+
* .env file (Yes/No)
|
|
76
|
+
* Dependencies to install
|
|
77
|
+
* Auto install dependencies
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Supported Dependencies
|
|
82
|
+
|
|
83
|
+
* express
|
|
84
|
+
* nodemon
|
|
85
|
+
* cors
|
|
86
|
+
* bcryptjs
|
|
87
|
+
* dotenv
|
|
88
|
+
* jsonwebtoken
|
|
89
|
+
* cookie-parser
|
|
90
|
+
* cloudinary
|
|
91
|
+
* multer
|
|
92
|
+
* mongoose (optional)
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Scripts
|
|
97
|
+
|
|
98
|
+
After setup:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm run dev # Development (nodemon)
|
|
102
|
+
npm start # Production
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Example
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx create-prod-backend
|
|
111
|
+
|
|
112
|
+
✔ Enter project name: my-app
|
|
113
|
+
✔ Use MongoDB: Yes
|
|
114
|
+
✔ Use .env: Yes
|
|
115
|
+
✔ Install dependencies: Yes
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Your backend is ready!
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Tech Stack
|
|
123
|
+
|
|
124
|
+
* Node.js
|
|
125
|
+
* Express.js
|
|
126
|
+
* MongoDB (optional)
|
|
127
|
+
* Inquirer (CLI prompts)
|
|
128
|
+
* Chalk (CLI styling)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Upcoming Features
|
|
133
|
+
|
|
134
|
+
* Service layer support
|
|
135
|
+
* Auth template (JWT)
|
|
136
|
+
* Docker setup
|
|
137
|
+
* API documentation (Swagger)
|
|
138
|
+
* TypeScript support
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Contributing
|
|
143
|
+
|
|
144
|
+
Contributions are welcome!
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
git clone https://github.com/codeurge123/create-prod-backend
|
|
148
|
+
cd create-prod-backend
|
|
149
|
+
npm install
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
ISC License
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Author
|
|
161
|
+
|
|
162
|
+
Made by **codeurge316 - @yashbansal**
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Support
|
|
167
|
+
|
|
168
|
+
If you like this project:
|
|
169
|
+
|
|
170
|
+
* Star the repo
|
|
171
|
+
* Share with others
|
|
172
|
+
* Suggest new features
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Final Thought
|
|
177
|
+
|
|
178
|
+
Stop wasting time setting up backend boilerplate.
|
|
179
|
+
Start building real projects.
|
|
180
|
+
|
|
181
|
+
- **create-prod-backend** does the setup — you build the product.
|
package/bin/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -44,6 +44,11 @@ export function createFiles(projectPath, answer) {
|
|
|
44
44
|
fs.writeFileSync(path.join(projectPath, ".env"), envTemplate());
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
fs.writeFileSync(
|
|
48
|
+
path.join(projectPath, "README.md"),
|
|
49
|
+
`# ${answer.projectName}\n\nGenerated with create-prod-backend CLI.`
|
|
50
|
+
);
|
|
51
|
+
|
|
47
52
|
// gitignore
|
|
48
53
|
fs.writeFileSync(
|
|
49
54
|
path.join(projectPath, ".gitignore"),
|
|
@@ -17,7 +17,12 @@ export function createFolders(projectPath) {
|
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
folders.forEach((folder) => {
|
|
20
|
-
|
|
20
|
+
const folderPath =
|
|
21
|
+
folder === "public"
|
|
22
|
+
? path.join(projectPath, folder, 'temp')
|
|
23
|
+
: path.join(projectPath, "src", folder);
|
|
24
|
+
|
|
25
|
+
fs.mkdirSync(folderPath, {
|
|
21
26
|
recursive: true
|
|
22
27
|
});
|
|
23
28
|
});
|
|
@@ -13,8 +13,8 @@ export function initPackage(projectPath) {
|
|
|
13
13
|
|
|
14
14
|
pkg.type = "module";
|
|
15
15
|
pkg.scripts = {
|
|
16
|
-
start: "node index.js",
|
|
17
|
-
dev: "nodemon index.js",
|
|
16
|
+
start: "node src/index.js",
|
|
17
|
+
dev: "nodemon src/index.js",
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|