express-genix 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/README.md +259 -110
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,110 +1,259 @@
1
- # Express-Genix CLI - Complete File Checklist
2
-
3
- ## Root Level Files (3/3)
4
- - ✅ `index.js` - Main CLI entry point
5
- - `package.json` - CLI package configuration
6
- - ✅ `README.md` - CLI documentation
7
-
8
- ## ✅ lib/ Directory (3/3)
9
- - `cleanup.js` - Post-generation cleanup functions
10
- - `generator.js` - File generation logic
11
- - `utils.js` - Utility functions
12
-
13
- ## templates/core/ Directory (11/11)
14
- - `app.js.ejs`
15
- - `server.js.ejs`
16
- - `package.json.ejs`
17
- - `env.ejs`
18
- - ✅ `gitignore.ejs`
19
- - ✅ `eslintrc.json.ejs`
20
- - ✅ `prettierrc.json.ejs`
21
- - `Dockerfile.ejs`
22
- - ✅ `docker-compose.yml.ejs`
23
- - ✅ `healthcheck.js.ejs`
24
- - `jest.config.js.ejs`
25
- - ✅ `README.md.ejs`
26
-
27
- ## templates/config/ Directory (3/3)
28
- - ✅ `database.mongo.js.ejs`
29
- - ✅ `database.postgres.js.ejs`
30
- - ✅ `swagger.json.ejs`
31
-
32
- ## ✅ templates/controllers/ Directory (3/3)
33
- - ✅ `authController.js.ejs`
34
- - ✅ `userController.js.ejs`
35
- - `exampleController.js.ejs`
36
-
37
- ## ✅ templates/middleware/ Directory (3/3)
38
- - ✅ `auth.js.ejs`
39
- - ✅ `errorHandler.js.ejs`
40
- - ✅ `validation.js.ejs`
41
-
42
- ## ✅ templates/models/ Directory (3/3)
43
- - ✅ `User.mongo.js.ejs`
44
- - ✅ `User.postgres.js.ejs`
45
- - ✅ `index.mongo.js.ejs`
46
- - ✅ `index.postgres.js.ejs`
47
-
48
- ## ✅ templates/routes/ Directory (4/4)
49
- - `index.js.ejs`
50
- - `authRoutes.js.ejs`
51
- - `userRoutes.js.ejs`
52
- - `exampleRoutes.js.ejs`
53
-
54
- ## ✅ templates/services/ Directory (4/4)
55
- - `authService.js.ejs`
56
- - ✅ `userService.mongo.js.ejs`
57
- - `userService.postgres.js.ejs`
58
- - ✅ `exampleService.js.ejs`
59
-
60
- ## templates/utils/ Directory (3/3)
61
- - ✅ `errors.js.ejs`
62
- - ✅ `logger.js.ejs`
63
- - `validators.js.ejs`
64
-
65
- ## templates/tests/ Directory (4/4)
66
- - ✅ `setup.js.ejs`
67
- - `auth.test.js.ejs`
68
- - `users.test.js.ejs`
69
- - `example.test.js.ejs`
70
-
71
- ---
72
-
73
- ## 🎉 COMPLETION STATUS: 40/40 FILES (100%)
74
-
75
- All required template files and supporting code have been created according to your specified directory structure.
76
-
77
- ## Key Features Implemented:
78
-
79
- ### ✅ Three Database Options
80
- 1. **MongoDB with Mongoose** - Full JWT authentication system
81
- 2. **PostgreSQL with Sequelize** - Full JWT authentication system
82
- 3. **No Database** - Example CRUD API with in-memory storage
83
-
84
- ### Template Architecture
85
- - **EJS templating** for conditional file generation
86
- - **Modular structure** with organized template directories
87
- - **Conditional logic** that generates different files based on database choice
88
-
89
- ### ✅ Generated Project Features
90
- - **Security**: Helmet, CORS, rate limiting
91
- - **Authentication**: JWT with refresh tokens (database modes)
92
- - **Documentation**: Swagger UI with OpenAPI 3.0 spec
93
- - **Testing**: Jest with Supertest and coverage
94
- - **Code Quality**: ESLint (Airbnb) + Prettier formatting
95
- - **Deployment**: Docker with docker-compose
96
- - **Development**: Hot reload, clustering, health checks
97
-
98
- ### ✅ Post-Generation Features
99
- - **Automatic cleanup** with ESLint --fix and Prettier
100
- - **Zero linting errors** out of the box
101
- - **Production-ready code** immediately after generation
102
-
103
- ## Ready for Use:
104
-
105
- The express-genix CLI is now complete and ready for:
106
- 1. **Local testing** with `node index.js init`
107
- 2. **npm publishing** with the provided package.json
108
- 3. **Production use** by developers who need Express boilerplates
109
-
110
- Each generated project will include all necessary files, dependencies, configurations, and documentation for immediate development use.
1
+ # Express-Genix CLI
2
+
3
+ express-genix is a production-grade CLI tool that generates Express.js applications with a robust, scalable foundation. It scaffolds projects with JWT authentication (including refresh tokens), MongoDB (with Mongoose) or PostgreSQL (with Sequelize), rate-limiting, security middleware (Helmet, CORS), custom logging, Swagger API documentation, Jest testing, ESLint (Airbnb style), Prettier formatting, and Docker support with database services.
4
+
5
+ **NEW**: Now includes a "No Database" option for APIs that don't require database persistence - perfect for microservices, proxy servers, or computational APIs.
6
+
7
+ ## Features
8
+
9
+ - Generates Express apps with a clean structure (src/server.js, src/app.js, src/routes, etc.)
10
+ - **Three database options**: MongoDB (Mongoose), PostgreSQL (Sequelize), or No Database
11
+ - Includes JWT-based authentication with register, login, refresh tokens, and logout (database modes)
12
+ - Provides security (Helmet, CORS, rate-limiting), logging (Morgan, custom logger), and Swagger UI
13
+ - Sets up Jest/Supertest for testing, ESLint for code quality, and Prettier for formatting
14
+ - **Automatic post-generation cleanup** - runs `eslint --fix` and Prettier formatting
15
+ - **Zero linting errors out of the box** - generated code is production-ready immediately
16
+ - Docker configuration with database services for easy deployment
17
+ - User-friendly CLI with input validation and detailed output
18
+
19
+ ## Installation
20
+
21
+ Install express-genix globally from npm to use it anywhere:
22
+
23
+ ```bash
24
+ npm install -g express-genix
25
+ ```
26
+
27
+ Alternatively, use it directly with npx without installation:
28
+
29
+ ```bash
30
+ npx express-genix init
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Run the CLI to generate a new Express project:
36
+
37
+ ```bash
38
+ express-genix init
39
+ ```
40
+
41
+ Or with npx:
42
+
43
+ ```bash
44
+ npx express-genix init
45
+ ```
46
+
47
+ ### Prompts
48
+
49
+ - **Project name**: Enter a name (letters, numbers, hyphens, underscores; default: my-express-app)
50
+ - **Database**: Choose from:
51
+ - **MongoDB (with Mongoose)** - Full authentication system with JWT
52
+ - **PostgreSQL (with Sequelize)** - Full authentication system with JWT
53
+ - **No Database (API without database)** - Example CRUD API with in-memory storage
54
+
55
+ The CLI creates a project directory, generates files, installs dependencies, and **automatically formats and lints the code**.
56
+
57
+ Navigate to the generated project (e.g., `cd my-express-app`) and run:
58
+
59
+ ```bash
60
+ npm run dev
61
+ ```
62
+
63
+ Visit `http://localhost:3000/api-docs` for Swagger documentation or `http://localhost:3000/health` for health checks.
64
+
65
+ ### Generated Project Features
66
+
67
+ **All Projects Include:**
68
+ - Rate limiting, security middleware, logging
69
+ - Swagger API documentation with OpenAPI 3.0
70
+ - Jest testing with coverage
71
+ - ESLint (Airbnb) + Prettier formatting
72
+ - Docker support with clustering
73
+ - Health checks and structured logging
74
+
75
+ **Database Projects Include:**
76
+ - **Authentication**: `/api/auth/register`, `/api/auth/login`, `/api/auth/refresh`, `/api/auth/logout`
77
+ - **User Management**: `/api/users/profile` (GET, PUT, DELETE)
78
+ - **Features**: JWT with refresh tokens, password hashing (bcrypt)
79
+
80
+ **No-Database Projects Include:**
81
+ - **Example API**: `/api/examples` (GET, POST, PUT, DELETE) with in-memory storage
82
+ - **Perfect for**: Microservices, proxy servers, computational APIs
83
+
84
+ ### CLI Options
85
+
86
+ ```bash
87
+ express-genix init --skip-cleanup # Skip automatic formatting (for debugging)
88
+ ```
89
+
90
+ ## Project Structure
91
+
92
+ ### CLI Structure
93
+ ```
94
+ express-genix/
95
+ ├── index.js # Main CLI entry point
96
+ ├── package.json # CLI package configuration
97
+ ├── README.md # This documentation
98
+ ├── lib/
99
+ │ ├── cleanup.js # Post-generation cleanup functions
100
+ │ ├── generator.js # File generation logic
101
+ │ └── utils.js # Utility functions
102
+ └── templates/
103
+ ├── core/ # Core files (app.js, server.js, etc.)
104
+ ├── config/ # Configuration files
105
+ ├── controllers/ # Route handlers
106
+ ├── middleware/ # Custom middleware
107
+ ├── models/ # Database models
108
+ ├── routes/ # API routes
109
+ ├── services/ # Business logic
110
+ ├── utils/ # Utilities
111
+ └── tests/ # Test files
112
+ ```
113
+
114
+ ### Generated Express App Structure
115
+ ```
116
+ ├── src/
117
+ │ ├── config/ # Database and Swagger configurations
118
+ │ ├── controllers/ # Request handlers and business logic
119
+ │ ├── middleware/ # Custom middleware (auth, validation, errors)
120
+ │ ├── models/ # Database models (if using database)
121
+ │ ├── routes/ # API route definitions
122
+ │ ├── services/ # Business logic layer
123
+ │ ├── utils/ # Utility functions and helpers
124
+ │ ├── app.js # Express app setup with middleware
125
+ │ └── server.js # Server entry point with clustering
126
+ ├── tests/ # Jest tests for endpoints
127
+ ├── .env # Environment variables
128
+ ├── .eslintrc.json # ESLint configuration
129
+ ├── .prettierrc # Prettier configuration
130
+ ├── Dockerfile # Docker configuration
131
+ ├── docker-compose.yml # Docker services (app + database)
132
+ └── package.json # Dependencies and scripts
133
+ ```
134
+
135
+ ## Available Scripts (Generated Project)
136
+
137
+ - `npm run dev` - Start development server with nodemon
138
+ - `npm start` - Start production server with clustering
139
+ - `npm test` - Run Jest tests with coverage
140
+ - `npm run lint` - Run ESLint checks
141
+ - `npm run lint:fix` - Fix ESLint issues automatically
142
+ - `npm run format` - Format code with Prettier
143
+ - `npm run format:check` - Check code formatting
144
+
145
+ ## Contributing
146
+
147
+ To contribute to express-genix:
148
+
149
+ 1. **Fork and Clone**:
150
+ ```bash
151
+ git clone <your-fork-url>
152
+ cd express-genix
153
+ ```
154
+
155
+ 2. **Install Dependencies**:
156
+ ```bash
157
+ npm install
158
+ ```
159
+
160
+ 3. **Make Changes**:
161
+ - Update templates in `templates/` directory
162
+ - Modify generation logic in `lib/generator.js`
163
+ - Follow Airbnb JavaScript style
164
+ - Test changes locally: `node index.js init`
165
+ - Verify generated projects have zero linting errors
166
+
167
+ 4. **Submit a Pull Request**:
168
+ - Push changes and submit a PR with a clear description
169
+ - Include test results showing the generated project works correctly
170
+
171
+ ## Version History
172
+
173
+ - **v1.1.0**: Added "No Database" option and template-based architecture with EJS
174
+ - **v1.0.1**: Added automatic post-generation cleanup with Prettier and ESLint auto-fix
175
+ - **v1.0.0**: Initial release with Express boilerplate generation
176
+
177
+ ## Publishing to npm
178
+
179
+ To publish express-genix to npm, follow these steps from the CLI's root directory:
180
+
181
+ ### 1. Prepare the Project
182
+
183
+ Ensure all template files are in place in the `templates/` directory structure.
184
+
185
+ Verify `package.json` is configured correctly:
186
+
187
+ ```json
188
+ {
189
+ "name": "express-genix",
190
+ "version": "1.1.0",
191
+ "description": "Production-grade CLI to generate Express apps with JWT, DB, rate-limiting, automatic formatting, and more",
192
+ "main": "index.js",
193
+ "bin": {
194
+ "express-genix": "./index.js"
195
+ },
196
+ "dependencies": {
197
+ "commander": "^12.1.0",
198
+ "inquirer": "^10.2.0",
199
+ "ejs": "^3.1.9"
200
+ }
201
+ }
202
+ ```
203
+
204
+ ### 2. Test Locally
205
+
206
+ Run the CLI to ensure it generates working, properly formatted projects for all three database options:
207
+
208
+ ```bash
209
+ node index.js init
210
+ ```
211
+
212
+ Test each option:
213
+ - MongoDB with authentication
214
+ - PostgreSQL with authentication
215
+ - No database with example API
216
+
217
+ ### 3. Publish
218
+
219
+ Login to npm and publish:
220
+
221
+ ```bash
222
+ npm login
223
+ npm publish --access public
224
+ ```
225
+
226
+ ### 4. Verify
227
+
228
+ Test the published package:
229
+
230
+ ```bash
231
+ npx express-genix init
232
+ # Should generate a project with zero linting errors
233
+ ```
234
+
235
+ ## Troubleshooting
236
+
237
+ ### Publishing Issues
238
+
239
+ - **Name Conflict**: If `express-genix` is taken, use a scoped name like `@yourname/express-genix`
240
+ - **Authentication Error**: Verify with `npm whoami`, re-login if needed
241
+ - **Permission Issues**: Move project to a directory with full write access
242
+
243
+ ### Generated Project Issues
244
+
245
+ - **Dependency Errors**: Run `npm cache clean --force && npm install`
246
+ - **Database Connection**: Ensure MongoDB/PostgreSQL is running and connection strings are correct
247
+ - **Linting Issues**: Run `npm run lint:fix && npm run format` to resolve formatting
248
+
249
+ ## License
250
+
251
+ MIT License
252
+
253
+ Copyright (c) 2025 Joshua Maeba Nyamasege
254
+
255
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
256
+
257
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
258
+
259
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-genix",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Production-grade CLI to generate Express apps with JWT, DB, rate-limiting, automatic formatting, and more",
5
5
  "main": "index.js",
6
6
  "bin": {