nodejs-quickstart-structure 1.18.1 → 1.19.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 (235) hide show
  1. package/CHANGELOG.md +309 -294
  2. package/LICENSE +15 -15
  3. package/README.md +2 -1
  4. package/lib/generator.js +139 -139
  5. package/lib/modules/app-setup.js +401 -401
  6. package/lib/modules/caching-setup.js +76 -73
  7. package/lib/modules/config-files.js +151 -151
  8. package/lib/modules/database-setup.js +116 -116
  9. package/lib/modules/kafka-setup.js +249 -191
  10. package/lib/modules/project-setup.js +32 -31
  11. package/lib/prompts.js +100 -100
  12. package/package.json +78 -67
  13. package/templates/clean-architecture/js/src/domain/models/User.js +9 -9
  14. package/templates/clean-architecture/js/src/errors/ApiError.js +14 -14
  15. package/templates/clean-architecture/js/src/errors/BadRequestError.js +11 -10
  16. package/templates/clean-architecture/js/src/errors/BadRequestError.spec.js.ejs +22 -21
  17. package/templates/clean-architecture/js/src/errors/NotFoundError.js +11 -10
  18. package/templates/clean-architecture/js/src/errors/NotFoundError.spec.js.ejs +22 -21
  19. package/templates/clean-architecture/js/src/index.js.ejs +55 -55
  20. package/templates/clean-architecture/js/src/infrastructure/config/env.js.ejs +47 -47
  21. package/templates/clean-architecture/js/src/infrastructure/log/logger.js +36 -36
  22. package/templates/clean-architecture/js/src/infrastructure/log/logger.spec.js.ejs +63 -63
  23. package/templates/clean-architecture/js/src/infrastructure/repositories/UserRepository.js.ejs +69 -39
  24. package/templates/clean-architecture/js/src/infrastructure/repositories/UserRepository.spec.js.ejs +142 -81
  25. package/templates/clean-architecture/js/src/infrastructure/webserver/middleware/errorMiddleware.js +30 -30
  26. package/templates/clean-architecture/js/src/infrastructure/webserver/server.js.ejs +89 -89
  27. package/templates/clean-architecture/js/src/infrastructure/webserver/swagger.js.ejs +6 -6
  28. package/templates/clean-architecture/js/src/interfaces/controllers/userController.js.ejs +156 -75
  29. package/templates/clean-architecture/js/src/interfaces/controllers/userController.spec.js.ejs +234 -138
  30. package/templates/clean-architecture/js/src/interfaces/graphql/context.js.ejs +13 -13
  31. package/templates/clean-architecture/js/src/interfaces/graphql/context.spec.js.ejs +31 -31
  32. package/templates/clean-architecture/js/src/interfaces/graphql/index.js.ejs +5 -5
  33. package/templates/clean-architecture/js/src/interfaces/graphql/resolvers/index.js.ejs +6 -6
  34. package/templates/clean-architecture/js/src/interfaces/graphql/resolvers/user.resolvers.js.ejs +27 -21
  35. package/templates/clean-architecture/js/src/interfaces/graphql/resolvers/user.resolvers.spec.js.ejs +66 -49
  36. package/templates/clean-architecture/js/src/interfaces/graphql/typeDefs/index.js.ejs +6 -6
  37. package/templates/clean-architecture/js/src/interfaces/graphql/typeDefs/user.types.js.ejs +19 -17
  38. package/templates/clean-architecture/js/src/interfaces/routes/api.js +12 -10
  39. package/templates/clean-architecture/js/src/interfaces/routes/api.spec.js.ejs +38 -38
  40. package/templates/clean-architecture/js/src/usecases/CreateUser.js +14 -14
  41. package/templates/clean-architecture/js/src/usecases/CreateUser.spec.js.ejs +51 -51
  42. package/templates/clean-architecture/js/src/usecases/DeleteUser.js +11 -0
  43. package/templates/clean-architecture/js/src/usecases/DeleteUser.spec.js.ejs +47 -0
  44. package/templates/clean-architecture/js/src/usecases/GetAllUsers.js +12 -12
  45. package/templates/clean-architecture/js/src/usecases/GetAllUsers.spec.js.ejs +61 -61
  46. package/templates/clean-architecture/js/src/usecases/UpdateUser.js +11 -0
  47. package/templates/clean-architecture/js/src/usecases/UpdateUser.spec.js.ejs +48 -0
  48. package/templates/clean-architecture/js/src/utils/errorMessages.js +14 -0
  49. package/templates/clean-architecture/js/src/utils/httpCodes.js +9 -9
  50. package/templates/clean-architecture/ts/src/config/env.ts.ejs +46 -46
  51. package/templates/clean-architecture/ts/src/config/swagger.ts.ejs +6 -6
  52. package/templates/clean-architecture/ts/src/domain/user.ts +7 -7
  53. package/templates/clean-architecture/ts/src/errors/ApiError.ts +15 -15
  54. package/templates/clean-architecture/ts/src/errors/BadRequestError.spec.ts.ejs +22 -21
  55. package/templates/clean-architecture/ts/src/errors/BadRequestError.ts +9 -8
  56. package/templates/clean-architecture/ts/src/errors/NotFoundError.spec.ts.ejs +22 -21
  57. package/templates/clean-architecture/ts/src/errors/NotFoundError.ts +9 -8
  58. package/templates/clean-architecture/ts/src/index.ts.ejs +139 -139
  59. package/templates/clean-architecture/ts/src/infrastructure/log/logger.spec.ts.ejs +63 -63
  60. package/templates/clean-architecture/ts/src/infrastructure/log/logger.ts +36 -36
  61. package/templates/clean-architecture/ts/src/infrastructure/repositories/UserRepository.spec.ts.ejs +175 -85
  62. package/templates/clean-architecture/ts/src/infrastructure/repositories/userRepository.ts.ejs +74 -0
  63. package/templates/clean-architecture/ts/src/interfaces/controllers/userController.spec.ts.ejs +331 -185
  64. package/templates/clean-architecture/ts/src/interfaces/controllers/userController.ts.ejs +173 -84
  65. package/templates/clean-architecture/ts/src/interfaces/graphql/context.spec.ts.ejs +32 -32
  66. package/templates/clean-architecture/ts/src/interfaces/graphql/context.ts.ejs +17 -17
  67. package/templates/clean-architecture/ts/src/interfaces/graphql/index.ts.ejs +3 -3
  68. package/templates/clean-architecture/ts/src/interfaces/graphql/resolvers/index.ts.ejs +4 -4
  69. package/templates/clean-architecture/ts/src/interfaces/graphql/resolvers/user.resolvers.spec.ts.ejs +68 -51
  70. package/templates/clean-architecture/ts/src/interfaces/graphql/resolvers/user.resolvers.ts.ejs +29 -21
  71. package/templates/clean-architecture/ts/src/interfaces/graphql/typeDefs/index.ts.ejs +4 -4
  72. package/templates/clean-architecture/ts/src/interfaces/graphql/typeDefs/user.types.ts.ejs +17 -15
  73. package/templates/clean-architecture/ts/src/interfaces/routes/userRoutes.spec.ts.ejs +40 -40
  74. package/templates/clean-architecture/ts/src/interfaces/routes/userRoutes.ts +13 -11
  75. package/templates/clean-architecture/ts/src/usecases/createUser.spec.ts.ejs +51 -51
  76. package/templates/clean-architecture/ts/src/usecases/createUser.ts +13 -13
  77. package/templates/clean-architecture/ts/src/usecases/deleteUser.spec.ts.ejs +47 -0
  78. package/templates/clean-architecture/ts/src/usecases/deleteUser.ts +9 -0
  79. package/templates/clean-architecture/ts/src/usecases/getAllUsers.spec.ts.ejs +63 -63
  80. package/templates/clean-architecture/ts/src/usecases/getAllUsers.ts +10 -10
  81. package/templates/clean-architecture/ts/src/usecases/updateUser.spec.ts.ejs +48 -0
  82. package/templates/clean-architecture/ts/src/usecases/updateUser.ts +9 -0
  83. package/templates/clean-architecture/ts/src/utils/errorMessages.ts +12 -0
  84. package/templates/clean-architecture/ts/src/utils/errorMiddleware.ts.ejs +27 -27
  85. package/templates/clean-architecture/ts/src/utils/httpCodes.ts +7 -7
  86. package/templates/common/.cursorrules.ejs +60 -60
  87. package/templates/common/.dockerignore +12 -12
  88. package/templates/common/.env.example.ejs +41 -41
  89. package/templates/common/.gitattributes +46 -0
  90. package/templates/common/.gitlab-ci.yml.ejs +86 -86
  91. package/templates/common/.lintstagedrc +6 -6
  92. package/templates/common/.prettierrc +7 -7
  93. package/templates/common/Dockerfile +73 -73
  94. package/templates/common/Jenkinsfile.ejs +87 -87
  95. package/templates/common/README.md.ejs +294 -270
  96. package/templates/common/SECURITY.md +20 -20
  97. package/templates/common/_github/workflows/ci.yml.ejs +46 -46
  98. package/templates/common/_github/workflows/security.yml.ejs +36 -36
  99. package/templates/common/_gitignore +5 -5
  100. package/templates/common/_husky/pre-commit +4 -4
  101. package/templates/common/caching/clean/js/CreateUser.js.ejs +29 -29
  102. package/templates/common/caching/clean/js/DeleteUser.js.ejs +27 -0
  103. package/templates/common/caching/clean/js/GetAllUsers.js.ejs +37 -37
  104. package/templates/common/caching/clean/js/UpdateUser.js.ejs +27 -0
  105. package/templates/common/caching/clean/ts/createUser.ts.ejs +27 -27
  106. package/templates/common/caching/clean/ts/deleteUser.ts.ejs +24 -0
  107. package/templates/common/caching/clean/ts/getAllUsers.ts.ejs +34 -34
  108. package/templates/common/caching/clean/ts/updateUser.ts.ejs +25 -0
  109. package/templates/common/caching/js/memoryCache.js.ejs +60 -60
  110. package/templates/common/caching/js/memoryCache.spec.js.ejs +101 -101
  111. package/templates/common/caching/js/redisClient.js.ejs +75 -75
  112. package/templates/common/caching/js/redisClient.spec.js.ejs +147 -147
  113. package/templates/common/caching/ts/memoryCache.spec.ts.ejs +102 -102
  114. package/templates/common/caching/ts/memoryCache.ts.ejs +73 -64
  115. package/templates/common/caching/ts/redisClient.spec.ts.ejs +157 -157
  116. package/templates/common/caching/ts/redisClient.ts.ejs +89 -80
  117. package/templates/common/database/js/database.js.ejs +19 -19
  118. package/templates/common/database/js/database.spec.js.ejs +56 -56
  119. package/templates/common/database/js/models/User.js.ejs +79 -53
  120. package/templates/common/database/js/models/User.js.mongoose.ejs +23 -19
  121. package/templates/common/database/js/models/User.spec.js.ejs +94 -84
  122. package/templates/common/database/js/mongoose.js.ejs +33 -33
  123. package/templates/common/database/js/mongoose.spec.js.ejs +43 -43
  124. package/templates/common/database/ts/database.spec.ts.ejs +56 -56
  125. package/templates/common/database/ts/database.ts.ejs +21 -21
  126. package/templates/common/database/ts/models/User.spec.ts.ejs +100 -84
  127. package/templates/common/database/ts/models/User.ts.ejs +87 -61
  128. package/templates/common/database/ts/models/User.ts.mongoose.ejs +30 -25
  129. package/templates/common/database/ts/mongoose.spec.ts.ejs +42 -42
  130. package/templates/common/database/ts/mongoose.ts.ejs +28 -28
  131. package/templates/common/docker-compose.yml.ejs +159 -159
  132. package/templates/common/ecosystem.config.js.ejs +40 -40
  133. package/templates/common/eslint.config.mjs.ejs +77 -77
  134. package/templates/common/health/js/healthRoute.js.ejs +50 -47
  135. package/templates/common/health/js/healthRoute.spec.js.ejs +70 -70
  136. package/templates/common/health/ts/healthRoute.spec.ts.ejs +76 -76
  137. package/templates/common/health/ts/healthRoute.ts.ejs +49 -46
  138. package/templates/common/jest.config.js.ejs +32 -32
  139. package/templates/common/jest.e2e.config.js.ejs +8 -8
  140. package/templates/common/kafka/js/config/kafka.js +9 -9
  141. package/templates/common/kafka/js/config/kafka.spec.js.ejs +27 -27
  142. package/templates/common/kafka/js/messaging/baseConsumer.js.ejs +30 -30
  143. package/templates/common/kafka/js/messaging/baseConsumer.spec.js.ejs +58 -58
  144. package/templates/common/kafka/js/messaging/userEventSchema.js.ejs +12 -11
  145. package/templates/common/kafka/js/messaging/userEventSchema.spec.js.ejs +27 -27
  146. package/templates/common/kafka/js/messaging/welcomeEmailConsumer.js.ejs +44 -31
  147. package/templates/common/kafka/js/messaging/welcomeEmailConsumer.spec.js.ejs +86 -49
  148. package/templates/common/kafka/js/services/kafkaService.js.ejs +93 -93
  149. package/templates/common/kafka/js/services/kafkaService.spec.js.ejs +106 -106
  150. package/templates/common/kafka/js/utils/kafkaEvents.js.ejs +7 -0
  151. package/templates/common/kafka/ts/config/kafka.spec.ts.ejs +27 -27
  152. package/templates/common/kafka/ts/config/kafka.ts +7 -7
  153. package/templates/common/kafka/ts/messaging/baseConsumer.spec.ts.ejs +50 -50
  154. package/templates/common/kafka/ts/messaging/baseConsumer.ts.ejs +27 -27
  155. package/templates/common/kafka/ts/messaging/userEventSchema.spec.ts.ejs +51 -51
  156. package/templates/common/kafka/ts/messaging/userEventSchema.ts.ejs +12 -11
  157. package/templates/common/kafka/ts/messaging/welcomeEmailConsumer.spec.ts.ejs +86 -49
  158. package/templates/common/kafka/ts/messaging/welcomeEmailConsumer.ts.ejs +38 -25
  159. package/templates/common/kafka/ts/services/kafkaService.spec.ts.ejs +81 -81
  160. package/templates/common/kafka/ts/services/kafkaService.ts.ejs +95 -95
  161. package/templates/common/kafka/ts/utils/kafkaEvents.ts.ejs +5 -0
  162. package/templates/common/migrate-mongo-config.js.ejs +31 -31
  163. package/templates/common/migrations/init.js.ejs +23 -23
  164. package/templates/common/package.json.ejs +119 -118
  165. package/templates/common/prompts/add-feature.md.ejs +26 -26
  166. package/templates/common/prompts/project-context.md.ejs +43 -43
  167. package/templates/common/prompts/troubleshoot.md.ejs +28 -28
  168. package/templates/common/public/css/style.css +147 -147
  169. package/templates/common/scripts/run-e2e.js.ejs +63 -63
  170. package/templates/common/shutdown/js/gracefulShutdown.js.ejs +65 -61
  171. package/templates/common/shutdown/js/gracefulShutdown.spec.js.ejs +149 -160
  172. package/templates/common/shutdown/ts/gracefulShutdown.spec.ts.ejs +179 -158
  173. package/templates/common/shutdown/ts/gracefulShutdown.ts.ejs +59 -55
  174. package/templates/common/sonar-project.properties.ejs +27 -27
  175. package/templates/common/src/tests/e2e/e2e.users.test.js.ejs +120 -49
  176. package/templates/common/src/tests/e2e/e2e.users.test.ts.ejs +120 -49
  177. package/templates/common/src/utils/errorMiddleware.spec.js.ejs +79 -79
  178. package/templates/common/src/utils/errorMiddleware.spec.ts.ejs +94 -94
  179. package/templates/common/swagger.yml.ejs +118 -66
  180. package/templates/common/tsconfig.json +22 -22
  181. package/templates/common/views/ejs/index.ejs +55 -55
  182. package/templates/common/views/pug/index.pug +40 -40
  183. package/templates/db/mysql/V1__Initial_Setup.sql.ejs +10 -9
  184. package/templates/db/postgres/V1__Initial_Setup.sql.ejs +10 -9
  185. package/templates/mvc/js/src/config/env.js.ejs +46 -46
  186. package/templates/mvc/js/src/config/swagger.js.ejs +6 -6
  187. package/templates/mvc/js/src/controllers/userController.js.ejs +246 -105
  188. package/templates/mvc/js/src/controllers/userController.spec.js.ejs +481 -209
  189. package/templates/mvc/js/src/errors/ApiError.js +14 -14
  190. package/templates/mvc/js/src/errors/BadRequestError.js +11 -10
  191. package/templates/mvc/js/src/errors/BadRequestError.spec.js.ejs +22 -21
  192. package/templates/mvc/js/src/errors/NotFoundError.js +11 -10
  193. package/templates/mvc/js/src/errors/NotFoundError.spec.js.ejs +22 -21
  194. package/templates/mvc/js/src/graphql/context.js.ejs +7 -7
  195. package/templates/mvc/js/src/graphql/context.spec.js.ejs +29 -29
  196. package/templates/mvc/js/src/graphql/index.js.ejs +5 -5
  197. package/templates/mvc/js/src/graphql/resolvers/index.js.ejs +6 -6
  198. package/templates/mvc/js/src/graphql/resolvers/user.resolvers.js.ejs +25 -19
  199. package/templates/mvc/js/src/graphql/resolvers/user.resolvers.spec.js.ejs +64 -47
  200. package/templates/mvc/js/src/graphql/typeDefs/index.js.ejs +6 -6
  201. package/templates/mvc/js/src/graphql/typeDefs/user.types.js.ejs +19 -17
  202. package/templates/mvc/js/src/index.js.ejs +136 -136
  203. package/templates/mvc/js/src/routes/api.js +10 -8
  204. package/templates/mvc/js/src/routes/api.spec.js.ejs +41 -36
  205. package/templates/mvc/js/src/utils/errorMessages.js +14 -0
  206. package/templates/mvc/js/src/utils/errorMiddleware.js +29 -29
  207. package/templates/mvc/js/src/utils/httpCodes.js +9 -9
  208. package/templates/mvc/js/src/utils/logger.js +40 -40
  209. package/templates/mvc/js/src/utils/logger.spec.js.ejs +63 -63
  210. package/templates/mvc/ts/src/config/env.ts.ejs +45 -45
  211. package/templates/mvc/ts/src/config/swagger.ts.ejs +6 -6
  212. package/templates/mvc/ts/src/controllers/userController.spec.ts.ejs +481 -203
  213. package/templates/mvc/ts/src/controllers/userController.ts.ejs +248 -107
  214. package/templates/mvc/ts/src/errors/ApiError.ts +15 -15
  215. package/templates/mvc/ts/src/errors/BadRequestError.spec.ts.ejs +22 -21
  216. package/templates/mvc/ts/src/errors/BadRequestError.ts +9 -8
  217. package/templates/mvc/ts/src/errors/NotFoundError.spec.ts.ejs +27 -21
  218. package/templates/mvc/ts/src/errors/NotFoundError.ts +9 -8
  219. package/templates/mvc/ts/src/graphql/context.spec.ts.ejs +30 -30
  220. package/templates/mvc/ts/src/graphql/context.ts.ejs +12 -12
  221. package/templates/mvc/ts/src/graphql/index.ts.ejs +3 -3
  222. package/templates/mvc/ts/src/graphql/resolvers/index.ts.ejs +4 -4
  223. package/templates/mvc/ts/src/graphql/resolvers/user.resolvers.spec.ts.ejs +68 -51
  224. package/templates/mvc/ts/src/graphql/resolvers/user.resolvers.ts.ejs +29 -21
  225. package/templates/mvc/ts/src/graphql/typeDefs/index.ts.ejs +4 -4
  226. package/templates/mvc/ts/src/graphql/typeDefs/user.types.ts.ejs +17 -15
  227. package/templates/mvc/ts/src/index.ts.ejs +156 -153
  228. package/templates/mvc/ts/src/routes/api.spec.ts.ejs +59 -40
  229. package/templates/mvc/ts/src/routes/api.ts +12 -10
  230. package/templates/mvc/ts/src/utils/errorMessages.ts +12 -0
  231. package/templates/mvc/ts/src/utils/errorMiddleware.ts.ejs +27 -27
  232. package/templates/mvc/ts/src/utils/httpCodes.ts +7 -7
  233. package/templates/mvc/ts/src/utils/logger.spec.ts.ejs +63 -63
  234. package/templates/mvc/ts/src/utils/logger.ts +36 -36
  235. package/templates/clean-architecture/ts/src/infrastructure/repositories/UserRepository.ts.ejs +0 -37
package/CHANGELOG.md CHANGED
@@ -1,294 +1,309 @@
1
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2
-
3
- ## [1.18.1] - 2026-03-27
4
-
5
- ### Fixed
6
- - **Template Security Hardening**: Resolved 29 vulnerabilities in `package.json.ejs` by upgrading `Apollo Server`, `Jest`, and `ESLint`.
7
- - **Apollo Server 5 Compatibility**: Migrated GraphQL integration to use `@as-integrations/express4`, resolving breaking changes in the latest Apollo release.
8
- - **Surgical Security Overrides**: Implemented targeted `overrides` for `brace-expansion`, `jake`, and `micromatch`. Removed global `glob/minimatch` overrides to maintain compatibility with Jest's internal APIs while preserving a "Zero-Vulnerability" status.
9
- - **E2E Validated**: Verified the entire "Secure-by-Default" ecosystem via Windows E2E tests, achieving 100% pass rate.
10
- - **Enterprise Standards**: Synchronized all generator templates with the latest secure dependency standards across MVC and Clean Architecture.
11
- ### Changed
12
- - **Readme**: Standardize Generated Project README.
13
-
14
- ## [1.18.0] - 2026-03-25
15
-
16
- ### Added
17
- - **Enterprise-Grade Security Hardening**: Integrated **Snyk (SCA)** and **SonarQube (SAST)** into the project scaffolding, providing "Big Tech" industry-standard security analysis out of the box.
18
- - **Automated Security Workflows**: Pre-configured CI/CD stages for security scanning across GitHub Actions, GitLab CI, and Jenkins.
19
- - **Pre-commit Security Gates**: Integrated **Husky** and **lint-staged** to automatically enforce code quality and security standards locally before every commit.
20
- - **Security Standard Enforcement**: Added a standardized `SECURITY.md` policy and automated quality gates to ensure code resilience.
21
- - **Comprehensive Security Guide**: Created a new documentation guide detailing the setup and operational workflows for the enterprise security features.
22
-
23
- ### Changed
24
- - **Matrix Expansion**: Updated the CLI to support over **1,680+ project combinations** by adding a conditional security hardening layer across all CI/CD providers.
25
-
26
- ### Fixed
27
- - **Docker Node Version**: Updated Docker node version to 22.22.2-trixie-slim
28
-
29
- ## [1.17.0] - 2026-03-23
30
-
31
- ### Added
32
- - **Kafka KRaft Mode Integration**: Modernized Kafka setups across all templates (MVC & Clean Architecture) by completely removing the Zookeeper dependency and enabling KRaft mode in `docker-compose.yml`, reducing project orchestration overhead.
33
- - **End-to-End (E2E) Verification Framework**: Implemented dedicated Docker container targeted end-to-end tests (`tests/e2e/`) utilizing Supertest via dynamic `SERVER_URL` mapping to eliminate port collisions and test the fully assembled container cluster directly.
34
- - **Enhanced Validation Pipelines**: Automatically executes the `npm run test:e2e` suite at the conclusion of internal validations across the entire platform matrix for improved CI accountability.
35
-
36
- ### Refactored
37
- - **Test Directory Strict Isolation**: Restructured internal code generation workflows (`lib/modules/`) to pipe all generated `.spec` files strictly into a dedicated `tests/unit/` subdirectory, cleanly abstracting unit specifications from end-to-end specifications.
38
-
39
- ## [1.16.2] - 2026-03-19
40
-
41
- ### Changed
42
- - **Major Dependency Upgrades**: Upgraded core CLI dependencies to their latest stable versions for better performance and security:
43
- - `commander`: Upgraded from `^13.1.0` to `^14.0.3`.
44
- - `ejs`: Upgraded from `^3.1.10` to `^5.0.1`.
45
- - `inquirer`: Upgraded from `^12.4.1` to `^13.3.2`.
46
- - **Verified Compatibility**: Validated the generator across multiple complex project configurations including TypeScript/MVC, JavaScript/Clean Architecture, Kafka messaging, and Redis/PostgreSQL integration.
47
- - **Update jest.config.js**: Update jest.config.js (or your test runner config) with new global thresholds:
48
- ```
49
- globalThreshold: {
50
- branches: 70,
51
- functions: 80,
52
- lines: 80,
53
- statements: 80,
54
- },
55
- ```
56
-
57
- ## [1.16.1] - 2026-03-17
58
-
59
- ### Refactored
60
- - **Top-Level Dynamic Imports**: Moved dynamic `await import()` and `require()` calls to the top-level across all TypeScript and JavaScript templates (MVC & Clean Architecture).
61
- - **Module Loading Standardization**: Standardized database connections (Mongoose/Sequelize), Kafka services, and graceful shutdown logic for better static analysis and ESM/CJS consistency.
62
-
63
- ### Fixed
64
- - **Kafka Service Scope**: Resolved a potential `ReferenceError` in `kafkaService.ts.ejs` by correcting the instantiation order of dynamic consumers.
65
- - **Health Check Imports**: Optimized `healthRoute.ts.ejs` to use top-level database driver imports.
66
-
67
- ## [1.16.0] - 2026-03-14
68
-
69
- ### Added
70
- - **Robust Kafka Singleton Implementation**: Refactored `KafkaService` to a strict singleton pattern across all architectures with `connectionPromise` and automated retry logic for resilient messaging.
71
- - **BaseConsumer Standards**: Implemented constructor guards in `BaseConsumer` to prevent direct instantiation of abstract messaging classes.
72
- - **Professional Docker Log Hygiene**: Added `NPM_CONFIG_UPDATE_NOTIFIER=false` to both builder and production stages to suppress non-essential npm upgrade notifications.
73
-
74
- ### Fixed
75
- - **Docker Build & Type Safety**: Resolved a critical build failure in MVC TypeScript projects using EJS/Pug by addressing missing Express `Request` and `Response` type imports.
76
- - **Network Resilience**: Removed redundant `npm install -g npm@latest` from the `Dockerfile` template to fix `ECONNRESET` failures during project verification on unstable networks.
77
- - **Controller Testing Modernization**: Refactored `userController` spec templates (TS and JS) to correctly mock and verify the shared Kafka singleton, fixing persistent unit test failures.
78
- - **Database Mocking Refinement**: Resolved a data flow bug in the "None" database mock where generated IDs were being overwritten, and enhanced TypeScript types to eliminate `any` in repository patterns.
79
-
80
- ## [1.15.1] - 2026-03-12
81
-
82
- ### Added
83
- - **Magic AI Scaffolding**: Automated AI context generation ( `.cursorrules`, `prompts/`) by intelligently inferring project goals from the project name, removing the need for manual business domain prompts.
84
- - **Enhanced README**: Added specialized guidance for AI-native development with Cursor and LLMs.
85
-
86
- ### Fixed
87
- - **GitHub Actions Compliance**: Fully resolved Node.js 20 deprecation warnings by moving `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24` to global workflow scope.
88
- - **CI Modernization**: Upgraded daily audit and GitLab CI runners to Node.js 22.
89
- - **CI Enforcement**: Updated all CI/CD templates (GitHub, GitLab, Jenkins) to strictly enforce the >70% test coverage gate.
90
-
91
- ## [1.15.0] - 2026-03-12
92
- ### Added
93
- - **AI-Native Scaffolding & Agent Skill Templates:**
94
- - Added a new CLI prompt for `businessDomain` to inject custom domain knowledge into generated templates.
95
- - Generates a `.cursorrules` file at the root to enforce >70% Test coverage and Architecture patterns automatically for AI Code Editors.
96
- - Scaffolds a `prompts/` directory with specialized Agent Skill templates (`project-context.md`, `add-feature.md`, `troubleshoot.md`) designed to provide deep structural understanding to LLMs like ChatGPT or Claude.
97
- - Added an "AI-Native Development" section to the generated `README.md` and prominent print messages in the CLI upon successful completion.
98
-
99
- ## [1.14.0] - 2026-03-09
100
- ### Added
101
- - **Unit test:**
102
- - Unit Testing Framework: Integrated Jest and ts-jest as the core testing suite.
103
-
104
- - Scaffolding Logic: Automatically generates .spec.ts files in the tests/ directory mirroring the src/ structure during project initialization.
105
-
106
- - Quality Gates: Implemented a mandatory Coverage Threshold (>=70%) for lines and functions to ensure long-term maintainability.
107
-
108
- - Mocking Standards: Included pre-configured mocks for Mongoose (database pings) and Express request/response objects.
109
-
110
- - NPM Scripts: Added npm test, npm run test:watch, and npm run test:coverage for seamless developer workflow.
111
-
112
- ## [1.13.0] - 2026-03-05
113
- ### Added
114
- - **Enhanced Health Check System:**
115
- - Standardized health logic for both MVC and Clean Architecture.
116
- - Deep verification: Automatically pings the selected database (MySQL, PostgreSQL, MongoDB) during health checks and returns a `DOWN` status with 500 code if the connection is lost.
117
- - Structured response including `uptime`, `memoryUsage`, `database` connectivity status, and `timestamp`.
118
- - **Improved Graceful Shutdown:**
119
- - Standardized signal handling (`SIGINT`, `SIGTERM`) across all architecture types to ensure clean disposal of database and caching resources.
120
- - Integrated proper shutdown sequences for Redis, MySQL, PostgreSQL, and MongoDB.
121
-
122
- ## [1.12.0] - 2026-03-04
123
- ### Added
124
- - **Zod Environment Validation:** Replaced manual `dotenv` process calls in server entry points with a centralized schema parser.
125
- - Automatically generates `src/config/env.ts` (or `.js`) evaluating `NODE_ENV`, `PORT`, and strictly mapping database, cache, and Kafka connection definitions gracefully crashing the app at startup if missing.
126
- - **PM2 Deployment Configuration:** Natively supports PM2 ecosystem clustering for VPS and EC2 configurations out-of-the-box.
127
- - Generates `ecosystem.config.js` intelligently mapping dynamic environments for Redis, Databases, and Kafka without user prompts.
128
- - Modifies `package.json` with an out-of-the-box `npm run deploy` script bound to `pm2 start ecosystem.config.js --env production`.
129
- - Upgraded generated README deployment guides for transparent CLI instruction workflows outlining the contrast between running Docker vs PM2.
130
-
131
- ## [1.11.1] - 2026-03-03
132
- ### Fixed
133
- - Fixed relative import paths in Clean Architecture JS `errorMiddleware.js` — changed to correct 3-level relative paths (`../../../`).
134
-
135
- ## [1.11.0] - 2026-03-02
136
- ### Added
137
- - **Centralized Error Handling Mechanism:** All generated projects now include a standardized, predictable error response structure for both REST APIs and GraphQL communication types.
138
- - New `src/errors/` directory with custom error classes: `ApiError`, `NotFoundError`, `BadRequestError`.
139
- - New `error.middleware.{ts|js}` global error handler placed at the end of the Express middleware chain in `src/utils/` (MVC) and `src/utils/` + `src/infrastructure/webserver/middleware/` (Clean Architecture).
140
- - Integrates `winston` logger to automatically log 500-level errors to persistent log files.
141
- - All controllers updated to pass errors via `next(error)` instead of manually sending responses.
142
- - **GraphQL:** Apollo Server `formatError` hook configured with `unwrapResolverError` to intercept resolver errors and map `ApiError` instances to structured GraphQL extension codes.
143
- - **REST APIs:** Express error middleware returns a consistent `{ statusCode, message, stack? }` JSON body.
144
- - **Error Response Standardization:** All error responses follow the same schema regardless of database, caching, or communication type selected.
145
-
146
- ### Fixed
147
- - Fixed `swagger.js` / `swagger.yml` being incorrectly generated for non-REST API configurations (GraphQL, Kafka). Converted static `swagger.js` to `swagger.js.ejs` in MVC JS and Clean Architecture JS templates so `renderSwaggerConfig` can conditionally control its generation.
148
- - Fixed `userRoutes.ts` in Clean Architecture TypeScript template not passing `NextFunction` to controller methods, causing `TypeScript TS2554: Expected 3 arguments` compile errors during Docker builds.
149
- - Fixed incorrect relative import paths (`../../../../`) in Clean Architecture JS `errorMiddleware.js` — changed to correct 3-level relative paths (`../../../`).
150
- - Fixed `HTTP_STATUS` being imported without destructuring from `httpCodes.js` (which uses a plain `module.exports = HTTP_STATUS` default export), causing `Cannot read properties of undefined` runtime errors.
151
- - Fixed `renderErrorMiddleware` in `app-setup.js` deleting from the **template source directory** instead of the generated project's target directory. This caused error middleware templates to disappear from disk after the first test run, breaking all subsequent generations.
152
-
153
- ## [1.10.1] - 2026-03-02
154
- ### Added
155
- - Roadmap & Upcoming Features. **[View our Public Roadmap on Trello](https://trello.com/b/TPTo8ylF/nodejs-quickstart-structure-product)**
156
- - Update start app with npx command.
157
-
158
- ## [1.10.0] - 2026-02-27
159
- ### Added
160
- - **GraphQL Support:** The generator now supports scaffolding GraphQL APIs using Apollo Server (v4) alongside standard REST APIs. This feature includes built-in integrations for both MVC and Clean Architecture designs across TypeScript and JavaScript.
161
- - Generates strongly-typed schemas (`typeDefs`) and structured `resolvers`.
162
- - Automatically provisions Apollo Sandbox for local development.
163
- - Integrates smoothly with existing databases (MySQL, PostgreSQL, MongoDB) and caching (Redis, Memory Cache) layouts.
164
- - Automatically configures Content Security Policy (Helmet) to allow embeddable Apollo Sandbox UI out of the box.
165
-
166
- ## [1.9.4] - 2026-02-26
167
- ### Fixed
168
- - Fixed intermittent "Health check timeout" errors in concurrent (concurrency > 1) E2E validation scripts. Increased the total verification timeout window to 120s to accommodate heavy Docker image cluster instantiations (Kafka/MySQL/Redis), and enhanced the Node.js `fetch` client to use `127.0.0.1` IPv4 loopback resolution alongside strict 5-second `AbortSignal` timeouts to mitigate dangling TCP connections resulting from overloaded internal Docker proxy bridges.
169
- - Fixed an `EBADENGINE` compatibility issue during Docker builds by upgrading the default template `Dockerfile` base image from `node:18-alpine` to `node:22-alpine`, supporting modern dependencies like `eslint@9` and `cpx2`.
170
- - Fixed a port collision bug (`Bind for 0.0.0.0:6379 failed: port is already allocated`) during parallel E2E testing. The `validation-core.js` script now dynamically assigns random network ports for `REDIS_PORT` when running concurrent testing matrices.
171
-
172
- ## [1.9.3] - 2026-02-26
173
- ### Added
174
- - Refactored Swagger documentation to use a standalone `swagger.yml` file instead of inline JSDoc comments across all templates (MVC, Clean Architecture, TS, and JS).
175
- - Integrated `yamljs` to parse the `swagger.yml` file and removed the `swagger-jsdoc` dependency, significantly reducing boilerplate in route files.
176
-
177
- ### Fixed
178
- - Fixed an issue in `package.json.ejs` where `jest` configuration had malformed JSON due to whitespace stripping.
179
- - Fixed a Docker build crash for non-REST API projects caused by the build script unconditionally attempting to copy `swagger.yml` using `cpx2`.
180
-
181
- ## [1.9.2] - 2026-02-23
182
- ### Fixed
183
- - Fixed an issue where the generator output misleading instructions (`DATABASE_URL`) for standalone `docker run` executions. The CLI success commands and `README.md` now conditionally include dynamic compose network bindings (`--network`) and accurate environment variables matching the user's selected DB stack.
184
- - Fixed a bug where `DB_PASSWORD` in `database.ts.ejs` and `database.js.ejs` defaulted to `postgres` instead of `root` for PostgreSQL configurations, causing standalone Node local servers (`npm run dev`) to fail connection handshakes with default `docker-compose` clusters.
185
-
186
- ## [1.9.1] - 2026-02-22
187
- ### Added
188
- - Implemented **Daily Template Vulnerability Audit** via GitHub Actions (`.github/workflows/daily-audit.yml`). A custom script now parses `package.json.ejs` daily to proactively scan for high-severity vulnerabilities in generated dependencies, ensuring generated projects are eternally secure.
189
- - Added built-in **Memory Cache** (`node-cache`) integration as an alternative caching layer alongside Redis.
190
- - Scaled up the generator matrix, now supporting over **160 Core Combinations** and **320 Total Scenarios** (including CI/CD pipelines).
191
- - Configured dynamic cache service imports across both MVC and Clean Architecture controllers/usecases.
192
-
193
- ### Fixed
194
- - Fixed an ESLint TypeScript parsing error (`Type expected`) caused by unescaped EJS template variables in Clean Architecture usecases.
195
- - Fixed a CLI execution bug where unquoted caching parameters (like `"Memory Cache"`) caused test validation failures.
196
- - Updated the E2E Windows Validation test core to evaluate ESLint flat config files (`eslint.config.mjs`) instead of `.eslintrc.json`.
197
-
198
- ## [1.8.2] - 2026-02-22
199
- ### Fixed
200
- - Hotfix: Changed `cpx2` command to its actual executable binary `cpx` in the build script. This resolves `sh: cpx2: not found` failures when running `npm run build` or `docker-compose up --build`.
201
-
202
- ## [1.8.1] - 2026-02-22
203
- ### Security
204
- - Resolved all high-severity npm vulnerabilities (0 vulnerabilities detected on install).
205
- - Upgraded ESLint to v9 and `typescript-eslint` to v8, migrating generated templates from `.eslintrc.json` to Flat Config (`eslint.config.mjs`) to eliminate deprecated `eslint@8` transitive dependencies.
206
- - Upgraded `supertest` to v7, `rimraf` to v6, and `ejs` to v3.1.10.
207
- - Replaced vulnerable `copyfiles` dependency with `cpx2` for view template orchestration.
208
- - Configured npm `overrides` for `minimatch@^10.2.1` to patch outdated `jest` sub-dependencies without breaking the test runner.
209
-
210
- ### Fixed
211
- - Fixed `npm install` crashing due to `husky install` expecting an initialized `.git` directory by adding a graceful fallback wrapper.
212
-
213
- ## [1.8.0] - 2026-02-18
214
- ### Added
215
- - Introduced **GitLab CI/CD pipeline support**:
216
- - Preconfigured `.gitlab-ci.yml` for automated build, test, and deploy steps.
217
- - End-to-end (e2e) test job included to ensure project reliability.
218
- - Aligns with existing GitHub Actions and Jenkins workflows for consistent CI/CD coverage.
219
-
220
- ### Improved
221
- - Documentation updated to highlight GitLab CI/CD as a supported option.
222
- - Enhanced CI/CD setup instructions in `README.md` for multi-platform pipelines.
223
-
224
- ## [1.7.5] - 2026-02-17
225
- > Happy Lunar New Year! This release coincides with Tet Vietnam. 🎆
226
- ### Fixed
227
- - Optimized `scripts/validate-windows.js` to use `--no-audit --no-fund --loglevel=error` during `npm install`, resolving intermittent CI failures on Windows.
228
- - Fixed 7 failing test cases involving Kafka and Redis combinations.
229
-
230
- ## [1.7.4] - 2026-02-17
231
- ### Fixed
232
- - Resolved `JSON.parse` error and incorrect Redis arguments in `getAllUsers` usecase for Clean Architecture templates.
233
- - Fixed `SyntaxError` in `lib/modules/caching-setup.js` preventing project generation.
234
-
235
- ### Added
236
- - Implemented automatic cache invalidation in `createUser` usecase (Clean Architecture) to ensure data consistency.
237
-
238
- ## [1.7.0]
239
-
240
- ### Added
241
- - Added support for Redis caching in both MVC and Clean Architecture.
242
-
243
- ## [1.6.1] - 2026-02-11
244
-
245
- ### Fixed
246
- - Included `CHANGELOG.md` in the published npm package so users can see version history.
247
- - Updated `README.md` with details on 64+ supported project combinations.
248
-
249
- ## [1.6.0] - 2026-02-10
250
-
251
- ### Refactored
252
- - Modularized `lib/generator.js` into distinct modules (`lib/modules/`) for better maintainability.
253
- - Extracted logic for project setup, config files, database, app setup, and Kafka.
254
-
255
- ### Fixed
256
- - Resolved syntax error in `UserRepository.js` for Clean Architecture projects with 'None' database.
257
- - Increased health check timeout to 60s in validation scripts to prevent false positives in heavy environments (MySQL + Kafka).
258
- - Fixed missing `src/views` copy logic for MVC projects, resolving Docker build errors.
259
- - Corrected CLI argument parsing to properly exclude undefined flags (e.g., `--db-name`).
260
- - Removed obsolete `version: '3.8'` from `docker-compose.yml`.
261
-
262
- ## [1.5.0] - 2026-02-10
263
-
264
- ### Added
265
- - Implemented structured logging with `winston-daily-rotate-file` (14-day retention, daily rotation).
266
- - Added HTTP request logging using `morgan` middleware.
267
-
268
- ### Fixed
269
- - Resolved `EACCES` permission errors for log directories in Docker.
270
-
271
- ## [1.4.5] - 2026-02-10
272
-
273
- ### Changed
274
- - Bumped version to 1.4.5.
275
-
276
- ## [1.4.4] - 2026-02-10
277
-
278
- ### Added
279
- - Created `CHANGELOG.md` to track release history.
280
-
281
- ## [1.4.3] - 2026-02-10
282
-
283
- ### Fixed
284
- - Updated CLI help text description to include MongoDB support.
285
- - Fixed unexpected character issues in npm scripts.
286
- - General bug fixes and improvements.
287
-
288
- ## [1.0.0] - 2026-02-03
289
-
290
- ### Added
291
- - Initial release of `nodejs-quickstart-structure`.
292
- - Scaffolding for MVC and Clean Architecture.
293
- - Support for Express.js.
294
- - Database integration (MongoDB, MySQL, PostgreSQL)
1
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2
+
3
+ ## [1.19.1] - 2026-04-01
4
+
5
+ ### Fixed
6
+ - **Template Security Hardening**: Resolved moderate Prototype Pollution vulnerability in `lodash` (GHSA-xxjr-mmjv-4gpg) by implementing a targeted `override` to version `^4.17.23` in generated templates.
7
+ - **Dependency Modernization**: Updated `jake` override to `^11.9.5` (latest version) across all project templates.
8
+ - **E2E Verified**: Validated the fix across multiple scenarios (JS/TS, MVC/Clean, MySQL/MongoDB/GraphQL) via Windows E2E tests with Docker, ensuring 0 vulnerabilities and 100% functional reliability.
9
+
10
+
11
+ ## [1.19.0] - 2026-03-28
12
+
13
+ ### Added
14
+ - **Security Hardening**: Added `SECURITY.md` file to the project.
15
+ - **Git Attributes**: Added `.gitattributes` file to the project.
16
+ - **Contributing Guide**: Added `CONTRIBUTING.md` file to the project.
17
+
18
+ ## [1.18.1] - 2026-03-27
19
+
20
+ ### Fixed
21
+ - **Template Security Hardening**: Resolved 29 vulnerabilities in `package.json.ejs` by upgrading `Apollo Server`, `Jest`, and `ESLint`.
22
+ - **Apollo Server 5 Compatibility**: Migrated GraphQL integration to use `@as-integrations/express4`, resolving breaking changes in the latest Apollo release.
23
+ - **Surgical Security Overrides**: Implemented targeted `overrides` for `brace-expansion`, `jake`, and `micromatch`. Removed global `glob/minimatch` overrides to maintain compatibility with Jest's internal APIs while preserving a "Zero-Vulnerability" status.
24
+ - **E2E Validated**: Verified the entire "Secure-by-Default" ecosystem via Windows E2E tests, achieving 100% pass rate.
25
+ - **Enterprise Standards**: Synchronized all generator templates with the latest secure dependency standards across MVC and Clean Architecture.
26
+ ### Changed
27
+ - **Readme**: Standardize Generated Project README.
28
+
29
+ ## [1.18.0] - 2026-03-25
30
+
31
+ ### Added
32
+ - **Enterprise-Grade Security Hardening**: Integrated **Snyk (SCA)** and **SonarQube (SAST)** into the project scaffolding, providing "Big Tech" industry-standard security analysis out of the box.
33
+ - **Automated Security Workflows**: Pre-configured CI/CD stages for security scanning across GitHub Actions, GitLab CI, and Jenkins.
34
+ - **Pre-commit Security Gates**: Integrated **Husky** and **lint-staged** to automatically enforce code quality and security standards locally before every commit.
35
+ - **Security Standard Enforcement**: Added a standardized `SECURITY.md` policy and automated quality gates to ensure code resilience.
36
+ - **Comprehensive Security Guide**: Created a new documentation guide detailing the setup and operational workflows for the enterprise security features.
37
+
38
+ ### Changed
39
+ - **Matrix Expansion**: Updated the CLI to support over **1,680+ project combinations** by adding a conditional security hardening layer across all CI/CD providers.
40
+
41
+ ### Fixed
42
+ - **Docker Node Version**: Updated Docker node version to 22.22.2-trixie-slim
43
+
44
+ ## [1.17.0] - 2026-03-23
45
+
46
+ ### Added
47
+ - **Kafka KRaft Mode Integration**: Modernized Kafka setups across all templates (MVC & Clean Architecture) by completely removing the Zookeeper dependency and enabling KRaft mode in `docker-compose.yml`, reducing project orchestration overhead.
48
+ - **End-to-End (E2E) Verification Framework**: Implemented dedicated Docker container targeted end-to-end tests (`tests/e2e/`) utilizing Supertest via dynamic `SERVER_URL` mapping to eliminate port collisions and test the fully assembled container cluster directly.
49
+ - **Enhanced Validation Pipelines**: Automatically executes the `npm run test:e2e` suite at the conclusion of internal validations across the entire platform matrix for improved CI accountability.
50
+
51
+ ### Refactored
52
+ - **Test Directory Strict Isolation**: Restructured internal code generation workflows (`lib/modules/`) to pipe all generated `.spec` files strictly into a dedicated `tests/unit/` subdirectory, cleanly abstracting unit specifications from end-to-end specifications.
53
+
54
+ ## [1.16.2] - 2026-03-19
55
+
56
+ ### Changed
57
+ - **Major Dependency Upgrades**: Upgraded core CLI dependencies to their latest stable versions for better performance and security:
58
+ - `commander`: Upgraded from `^13.1.0` to `^14.0.3`.
59
+ - `ejs`: Upgraded from `^3.1.10` to `^5.0.1`.
60
+ - `inquirer`: Upgraded from `^12.4.1` to `^13.3.2`.
61
+ - **Verified Compatibility**: Validated the generator across multiple complex project configurations including TypeScript/MVC, JavaScript/Clean Architecture, Kafka messaging, and Redis/PostgreSQL integration.
62
+ - **Update jest.config.js**: Update jest.config.js (or your test runner config) with new global thresholds:
63
+ ```
64
+ globalThreshold: {
65
+ branches: 70,
66
+ functions: 80,
67
+ lines: 80,
68
+ statements: 80,
69
+ },
70
+ ```
71
+
72
+ ## [1.16.1] - 2026-03-17
73
+
74
+ ### Refactored
75
+ - **Top-Level Dynamic Imports**: Moved dynamic `await import()` and `require()` calls to the top-level across all TypeScript and JavaScript templates (MVC & Clean Architecture).
76
+ - **Module Loading Standardization**: Standardized database connections (Mongoose/Sequelize), Kafka services, and graceful shutdown logic for better static analysis and ESM/CJS consistency.
77
+
78
+ ### Fixed
79
+ - **Kafka Service Scope**: Resolved a potential `ReferenceError` in `kafkaService.ts.ejs` by correcting the instantiation order of dynamic consumers.
80
+ - **Health Check Imports**: Optimized `healthRoute.ts.ejs` to use top-level database driver imports.
81
+
82
+ ## [1.16.0] - 2026-03-14
83
+
84
+ ### Added
85
+ - **Robust Kafka Singleton Implementation**: Refactored `KafkaService` to a strict singleton pattern across all architectures with `connectionPromise` and automated retry logic for resilient messaging.
86
+ - **BaseConsumer Standards**: Implemented constructor guards in `BaseConsumer` to prevent direct instantiation of abstract messaging classes.
87
+ - **Professional Docker Log Hygiene**: Added `NPM_CONFIG_UPDATE_NOTIFIER=false` to both builder and production stages to suppress non-essential npm upgrade notifications.
88
+
89
+ ### Fixed
90
+ - **Docker Build & Type Safety**: Resolved a critical build failure in MVC TypeScript projects using EJS/Pug by addressing missing Express `Request` and `Response` type imports.
91
+ - **Network Resilience**: Removed redundant `npm install -g npm@latest` from the `Dockerfile` template to fix `ECONNRESET` failures during project verification on unstable networks.
92
+ - **Controller Testing Modernization**: Refactored `userController` spec templates (TS and JS) to correctly mock and verify the shared Kafka singleton, fixing persistent unit test failures.
93
+ - **Database Mocking Refinement**: Resolved a data flow bug in the "None" database mock where generated IDs were being overwritten, and enhanced TypeScript types to eliminate `any` in repository patterns.
94
+
95
+ ## [1.15.1] - 2026-03-12
96
+
97
+ ### Added
98
+ - **Magic AI Scaffolding**: Automated AI context generation ( `.cursorrules`, `prompts/`) by intelligently inferring project goals from the project name, removing the need for manual business domain prompts.
99
+ - **Enhanced README**: Added specialized guidance for AI-native development with Cursor and LLMs.
100
+
101
+ ### Fixed
102
+ - **GitHub Actions Compliance**: Fully resolved Node.js 20 deprecation warnings by moving `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24` to global workflow scope.
103
+ - **CI Modernization**: Upgraded daily audit and GitLab CI runners to Node.js 22.
104
+ - **CI Enforcement**: Updated all CI/CD templates (GitHub, GitLab, Jenkins) to strictly enforce the >70% test coverage gate.
105
+
106
+ ## [1.15.0] - 2026-03-12
107
+ ### Added
108
+ - **AI-Native Scaffolding & Agent Skill Templates:**
109
+ - Added a new CLI prompt for `businessDomain` to inject custom domain knowledge into generated templates.
110
+ - Generates a `.cursorrules` file at the root to enforce >70% Test coverage and Architecture patterns automatically for AI Code Editors.
111
+ - Scaffolds a `prompts/` directory with specialized Agent Skill templates (`project-context.md`, `add-feature.md`, `troubleshoot.md`) designed to provide deep structural understanding to LLMs like ChatGPT or Claude.
112
+ - Added an "AI-Native Development" section to the generated `README.md` and prominent print messages in the CLI upon successful completion.
113
+
114
+ ## [1.14.0] - 2026-03-09
115
+ ### Added
116
+ - **Unit test:**
117
+ - Unit Testing Framework: Integrated Jest and ts-jest as the core testing suite.
118
+
119
+ - Scaffolding Logic: Automatically generates .spec.ts files in the tests/ directory mirroring the src/ structure during project initialization.
120
+
121
+ - Quality Gates: Implemented a mandatory Coverage Threshold (>=70%) for lines and functions to ensure long-term maintainability.
122
+
123
+ - Mocking Standards: Included pre-configured mocks for Mongoose (database pings) and Express request/response objects.
124
+
125
+ - NPM Scripts: Added npm test, npm run test:watch, and npm run test:coverage for seamless developer workflow.
126
+
127
+ ## [1.13.0] - 2026-03-05
128
+ ### Added
129
+ - **Enhanced Health Check System:**
130
+ - Standardized health logic for both MVC and Clean Architecture.
131
+ - Deep verification: Automatically pings the selected database (MySQL, PostgreSQL, MongoDB) during health checks and returns a `DOWN` status with 500 code if the connection is lost.
132
+ - Structured response including `uptime`, `memoryUsage`, `database` connectivity status, and `timestamp`.
133
+ - **Improved Graceful Shutdown:**
134
+ - Standardized signal handling (`SIGINT`, `SIGTERM`) across all architecture types to ensure clean disposal of database and caching resources.
135
+ - Integrated proper shutdown sequences for Redis, MySQL, PostgreSQL, and MongoDB.
136
+
137
+ ## [1.12.0] - 2026-03-04
138
+ ### Added
139
+ - **Zod Environment Validation:** Replaced manual `dotenv` process calls in server entry points with a centralized schema parser.
140
+ - Automatically generates `src/config/env.ts` (or `.js`) evaluating `NODE_ENV`, `PORT`, and strictly mapping database, cache, and Kafka connection definitions gracefully crashing the app at startup if missing.
141
+ - **PM2 Deployment Configuration:** Natively supports PM2 ecosystem clustering for VPS and EC2 configurations out-of-the-box.
142
+ - Generates `ecosystem.config.js` intelligently mapping dynamic environments for Redis, Databases, and Kafka without user prompts.
143
+ - Modifies `package.json` with an out-of-the-box `npm run deploy` script bound to `pm2 start ecosystem.config.js --env production`.
144
+ - Upgraded generated README deployment guides for transparent CLI instruction workflows outlining the contrast between running Docker vs PM2.
145
+
146
+ ## [1.11.1] - 2026-03-03
147
+ ### Fixed
148
+ - Fixed relative import paths in Clean Architecture JS `errorMiddleware.js` changed to correct 3-level relative paths (`../../../`).
149
+
150
+ ## [1.11.0] - 2026-03-02
151
+ ### Added
152
+ - **Centralized Error Handling Mechanism:** All generated projects now include a standardized, predictable error response structure for both REST APIs and GraphQL communication types.
153
+ - New `src/errors/` directory with custom error classes: `ApiError`, `NotFoundError`, `BadRequestError`.
154
+ - New `error.middleware.{ts|js}` global error handler placed at the end of the Express middleware chain in `src/utils/` (MVC) and `src/utils/` + `src/infrastructure/webserver/middleware/` (Clean Architecture).
155
+ - Integrates `winston` logger to automatically log 500-level errors to persistent log files.
156
+ - All controllers updated to pass errors via `next(error)` instead of manually sending responses.
157
+ - **GraphQL:** Apollo Server `formatError` hook configured with `unwrapResolverError` to intercept resolver errors and map `ApiError` instances to structured GraphQL extension codes.
158
+ - **REST APIs:** Express error middleware returns a consistent `{ statusCode, message, stack? }` JSON body.
159
+ - **Error Response Standardization:** All error responses follow the same schema regardless of database, caching, or communication type selected.
160
+
161
+ ### Fixed
162
+ - Fixed `swagger.js` / `swagger.yml` being incorrectly generated for non-REST API configurations (GraphQL, Kafka). Converted static `swagger.js` to `swagger.js.ejs` in MVC JS and Clean Architecture JS templates so `renderSwaggerConfig` can conditionally control its generation.
163
+ - Fixed `userRoutes.ts` in Clean Architecture TypeScript template not passing `NextFunction` to controller methods, causing `TypeScript TS2554: Expected 3 arguments` compile errors during Docker builds.
164
+ - Fixed incorrect relative import paths (`../../../../`) in Clean Architecture JS `errorMiddleware.js` changed to correct 3-level relative paths (`../../../`).
165
+ - Fixed `HTTP_STATUS` being imported without destructuring from `httpCodes.js` (which uses a plain `module.exports = HTTP_STATUS` default export), causing `Cannot read properties of undefined` runtime errors.
166
+ - Fixed `renderErrorMiddleware` in `app-setup.js` deleting from the **template source directory** instead of the generated project's target directory. This caused error middleware templates to disappear from disk after the first test run, breaking all subsequent generations.
167
+
168
+ ## [1.10.1] - 2026-03-02
169
+ ### Added
170
+ - Roadmap & Upcoming Features. **[View our Public Roadmap on Trello](https://trello.com/b/TPTo8ylF/nodejs-quickstart-structure-product)**
171
+ - Update start app with npx command.
172
+
173
+ ## [1.10.0] - 2026-02-27
174
+ ### Added
175
+ - **GraphQL Support:** The generator now supports scaffolding GraphQL APIs using Apollo Server (v4) alongside standard REST APIs. This feature includes built-in integrations for both MVC and Clean Architecture designs across TypeScript and JavaScript.
176
+ - Generates strongly-typed schemas (`typeDefs`) and structured `resolvers`.
177
+ - Automatically provisions Apollo Sandbox for local development.
178
+ - Integrates smoothly with existing databases (MySQL, PostgreSQL, MongoDB) and caching (Redis, Memory Cache) layouts.
179
+ - Automatically configures Content Security Policy (Helmet) to allow embeddable Apollo Sandbox UI out of the box.
180
+
181
+ ## [1.9.4] - 2026-02-26
182
+ ### Fixed
183
+ - Fixed intermittent "Health check timeout" errors in concurrent (concurrency > 1) E2E validation scripts. Increased the total verification timeout window to 120s to accommodate heavy Docker image cluster instantiations (Kafka/MySQL/Redis), and enhanced the Node.js `fetch` client to use `127.0.0.1` IPv4 loopback resolution alongside strict 5-second `AbortSignal` timeouts to mitigate dangling TCP connections resulting from overloaded internal Docker proxy bridges.
184
+ - Fixed an `EBADENGINE` compatibility issue during Docker builds by upgrading the default template `Dockerfile` base image from `node:18-alpine` to `node:22-alpine`, supporting modern dependencies like `eslint@9` and `cpx2`.
185
+ - Fixed a port collision bug (`Bind for 0.0.0.0:6379 failed: port is already allocated`) during parallel E2E testing. The `validation-core.js` script now dynamically assigns random network ports for `REDIS_PORT` when running concurrent testing matrices.
186
+
187
+ ## [1.9.3] - 2026-02-26
188
+ ### Added
189
+ - Refactored Swagger documentation to use a standalone `swagger.yml` file instead of inline JSDoc comments across all templates (MVC, Clean Architecture, TS, and JS).
190
+ - Integrated `yamljs` to parse the `swagger.yml` file and removed the `swagger-jsdoc` dependency, significantly reducing boilerplate in route files.
191
+
192
+ ### Fixed
193
+ - Fixed an issue in `package.json.ejs` where `jest` configuration had malformed JSON due to whitespace stripping.
194
+ - Fixed a Docker build crash for non-REST API projects caused by the build script unconditionally attempting to copy `swagger.yml` using `cpx2`.
195
+
196
+ ## [1.9.2] - 2026-02-23
197
+ ### Fixed
198
+ - Fixed an issue where the generator output misleading instructions (`DATABASE_URL`) for standalone `docker run` executions. The CLI success commands and `README.md` now conditionally include dynamic compose network bindings (`--network`) and accurate environment variables matching the user's selected DB stack.
199
+ - Fixed a bug where `DB_PASSWORD` in `database.ts.ejs` and `database.js.ejs` defaulted to `postgres` instead of `root` for PostgreSQL configurations, causing standalone Node local servers (`npm run dev`) to fail connection handshakes with default `docker-compose` clusters.
200
+
201
+ ## [1.9.1] - 2026-02-22
202
+ ### Added
203
+ - Implemented **Daily Template Vulnerability Audit** via GitHub Actions (`.github/workflows/daily-audit.yml`). A custom script now parses `package.json.ejs` daily to proactively scan for high-severity vulnerabilities in generated dependencies, ensuring generated projects are eternally secure.
204
+ - Added built-in **Memory Cache** (`node-cache`) integration as an alternative caching layer alongside Redis.
205
+ - Scaled up the generator matrix, now supporting over **160 Core Combinations** and **320 Total Scenarios** (including CI/CD pipelines).
206
+ - Configured dynamic cache service imports across both MVC and Clean Architecture controllers/usecases.
207
+
208
+ ### Fixed
209
+ - Fixed an ESLint TypeScript parsing error (`Type expected`) caused by unescaped EJS template variables in Clean Architecture usecases.
210
+ - Fixed a CLI execution bug where unquoted caching parameters (like `"Memory Cache"`) caused test validation failures.
211
+ - Updated the E2E Windows Validation test core to evaluate ESLint flat config files (`eslint.config.mjs`) instead of `.eslintrc.json`.
212
+
213
+ ## [1.8.2] - 2026-02-22
214
+ ### Fixed
215
+ - Hotfix: Changed `cpx2` command to its actual executable binary `cpx` in the build script. This resolves `sh: cpx2: not found` failures when running `npm run build` or `docker-compose up --build`.
216
+
217
+ ## [1.8.1] - 2026-02-22
218
+ ### Security
219
+ - Resolved all high-severity npm vulnerabilities (0 vulnerabilities detected on install).
220
+ - Upgraded ESLint to v9 and `typescript-eslint` to v8, migrating generated templates from `.eslintrc.json` to Flat Config (`eslint.config.mjs`) to eliminate deprecated `eslint@8` transitive dependencies.
221
+ - Upgraded `supertest` to v7, `rimraf` to v6, and `ejs` to v3.1.10.
222
+ - Replaced vulnerable `copyfiles` dependency with `cpx2` for view template orchestration.
223
+ - Configured npm `overrides` for `minimatch@^10.2.1` to patch outdated `jest` sub-dependencies without breaking the test runner.
224
+
225
+ ### Fixed
226
+ - Fixed `npm install` crashing due to `husky install` expecting an initialized `.git` directory by adding a graceful fallback wrapper.
227
+
228
+ ## [1.8.0] - 2026-02-18
229
+ ### Added
230
+ - Introduced **GitLab CI/CD pipeline support**:
231
+ - Preconfigured `.gitlab-ci.yml` for automated build, test, and deploy steps.
232
+ - End-to-end (e2e) test job included to ensure project reliability.
233
+ - Aligns with existing GitHub Actions and Jenkins workflows for consistent CI/CD coverage.
234
+
235
+ ### Improved
236
+ - Documentation updated to highlight GitLab CI/CD as a supported option.
237
+ - Enhanced CI/CD setup instructions in `README.md` for multi-platform pipelines.
238
+
239
+ ## [1.7.5] - 2026-02-17
240
+ > Happy Lunar New Year! This release coincides with Tet Vietnam. 🎆
241
+ ### Fixed
242
+ - Optimized `scripts/validate-windows.js` to use `--no-audit --no-fund --loglevel=error` during `npm install`, resolving intermittent CI failures on Windows.
243
+ - Fixed 7 failing test cases involving Kafka and Redis combinations.
244
+
245
+ ## [1.7.4] - 2026-02-17
246
+ ### Fixed
247
+ - Resolved `JSON.parse` error and incorrect Redis arguments in `getAllUsers` usecase for Clean Architecture templates.
248
+ - Fixed `SyntaxError` in `lib/modules/caching-setup.js` preventing project generation.
249
+
250
+ ### Added
251
+ - Implemented automatic cache invalidation in `createUser` usecase (Clean Architecture) to ensure data consistency.
252
+
253
+ ## [1.7.0]
254
+
255
+ ### Added
256
+ - Added support for Redis caching in both MVC and Clean Architecture.
257
+
258
+ ## [1.6.1] - 2026-02-11
259
+
260
+ ### Fixed
261
+ - Included `CHANGELOG.md` in the published npm package so users can see version history.
262
+ - Updated `README.md` with details on 64+ supported project combinations.
263
+
264
+ ## [1.6.0] - 2026-02-10
265
+
266
+ ### Refactored
267
+ - Modularized `lib/generator.js` into distinct modules (`lib/modules/`) for better maintainability.
268
+ - Extracted logic for project setup, config files, database, app setup, and Kafka.
269
+
270
+ ### Fixed
271
+ - Resolved syntax error in `UserRepository.js` for Clean Architecture projects with 'None' database.
272
+ - Increased health check timeout to 60s in validation scripts to prevent false positives in heavy environments (MySQL + Kafka).
273
+ - Fixed missing `src/views` copy logic for MVC projects, resolving Docker build errors.
274
+ - Corrected CLI argument parsing to properly exclude undefined flags (e.g., `--db-name`).
275
+ - Removed obsolete `version: '3.8'` from `docker-compose.yml`.
276
+
277
+ ## [1.5.0] - 2026-02-10
278
+
279
+ ### Added
280
+ - Implemented structured logging with `winston-daily-rotate-file` (14-day retention, daily rotation).
281
+ - Added HTTP request logging using `morgan` middleware.
282
+
283
+ ### Fixed
284
+ - Resolved `EACCES` permission errors for log directories in Docker.
285
+
286
+ ## [1.4.5] - 2026-02-10
287
+
288
+ ### Changed
289
+ - Bumped version to 1.4.5.
290
+
291
+ ## [1.4.4] - 2026-02-10
292
+
293
+ ### Added
294
+ - Created `CHANGELOG.md` to track release history.
295
+
296
+ ## [1.4.3] - 2026-02-10
297
+
298
+ ### Fixed
299
+ - Updated CLI help text description to include MongoDB support.
300
+ - Fixed unexpected character issues in npm scripts.
301
+ - General bug fixes and improvements.
302
+
303
+ ## [1.0.0] - 2026-02-03
304
+
305
+ ### Added
306
+ - Initial release of `nodejs-quickstart-structure`.
307
+ - Scaffolding for MVC and Clean Architecture.
308
+ - Support for Express.js.
309
+ - Database integration (MongoDB, MySQL, PostgreSQL)