nodejs-quickstart-structure 1.4.3 → 1.7.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +18 -20
  3. package/bin/index.js +1 -0
  4. package/docs/generateCase.md +127 -61
  5. package/docs/generatorFlow.md +15 -3
  6. package/docs/releaseNoteRule.md +42 -0
  7. package/lib/generator.js +46 -314
  8. package/lib/modules/app-setup.js +96 -0
  9. package/lib/modules/caching-setup.js +56 -0
  10. package/lib/modules/config-files.js +109 -0
  11. package/lib/modules/database-setup.js +111 -0
  12. package/lib/modules/kafka-setup.js +112 -0
  13. package/lib/modules/project-setup.js +31 -0
  14. package/lib/prompts.js +12 -4
  15. package/package.json +4 -3
  16. package/templates/clean-architecture/js/src/index.js.ejs +19 -6
  17. package/templates/clean-architecture/js/src/infrastructure/log/logger.js +16 -2
  18. package/templates/clean-architecture/js/src/infrastructure/repositories/UserRepository.js.ejs +18 -6
  19. package/templates/clean-architecture/js/src/infrastructure/webserver/server.js.ejs +2 -0
  20. package/templates/clean-architecture/ts/src/config/swagger.ts.ejs +1 -2
  21. package/templates/clean-architecture/ts/src/index.ts.ejs +27 -19
  22. package/templates/clean-architecture/ts/src/infrastructure/log/logger.ts +16 -2
  23. package/templates/clean-architecture/ts/src/infrastructure/repositories/userRepository.ts.ejs +17 -6
  24. package/templates/common/.env.example.ejs +39 -0
  25. package/templates/common/Dockerfile +3 -0
  26. package/templates/common/Jenkinsfile.ejs +41 -0
  27. package/templates/common/README.md.ejs +113 -106
  28. package/templates/common/caching/clean/js/CreateUser.js.ejs +25 -0
  29. package/templates/common/caching/clean/js/GetAllUsers.js.ejs +33 -0
  30. package/templates/common/caching/clean/ts/createUser.ts.ejs +23 -0
  31. package/templates/common/caching/clean/ts/getAllUsers.ts.ejs +30 -0
  32. package/templates/common/caching/js/redisClient.js.ejs +71 -0
  33. package/templates/common/caching/ts/redisClient.ts.ejs +76 -0
  34. package/templates/common/docker-compose.yml.ejs +156 -116
  35. package/templates/common/package.json.ejs +13 -2
  36. package/templates/mvc/js/src/controllers/userController.js.ejs +35 -3
  37. package/templates/mvc/js/src/index.js.ejs +26 -17
  38. package/templates/mvc/js/src/utils/logger.js +16 -6
  39. package/templates/mvc/ts/src/config/swagger.ts.ejs +1 -2
  40. package/templates/mvc/ts/src/controllers/userController.ts.ejs +35 -3
  41. package/templates/mvc/ts/src/index.ts.ejs +27 -18
  42. package/templates/mvc/ts/src/utils/logger.ts +16 -2
  43. package/templates/mvc/js/src/config/database.js +0 -12
  44. /package/templates/db/mysql/{V1__Initial_Setup.sql → V1__Initial_Setup.sql.ejs} +0 -0
  45. /package/templates/db/postgres/{V1__Initial_Setup.sql → V1__Initial_Setup.sql.ejs} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,78 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.7.5] - 2026-02-17
9
+ > Happy Lunar New Year! This release coincides with Tet Vietnam. 🎆
10
+ ### Fixed
11
+ - Optimized `scripts/validate-windows.js` to use `--no-audit --no-fund --loglevel=error` during `npm install`, resolving intermittent CI failures on Windows.
12
+ - Fixed 7 failing test cases involving Kafka and Redis combinations.
13
+
14
+ ## [1.7.4] - 2026-02-17
15
+ ### Fixed
16
+ - Resolved `JSON.parse` error and incorrect Redis arguments in `getAllUsers` usecase for Clean Architecture templates.
17
+ - Fixed `SyntaxError` in `lib/modules/caching-setup.js` preventing project generation.
18
+
19
+ ### Added
20
+ - Implemented automatic cache invalidation in `createUser` usecase (Clean Architecture) to ensure data consistency.
21
+
22
+ ## [1.7.0]
23
+
24
+ ### Added
25
+ - Added support for Redis caching in both MVC and Clean Architecture.
26
+
27
+ ## [1.6.1] - 2026-02-11
28
+
29
+ ### Fixed
30
+ - Included `CHANGELOG.md` in the published npm package so users can see version history.
31
+ - Updated `README.md` with details on 64+ supported project combinations.
32
+
33
+ ## [1.6.0] - 2026-02-10
34
+
35
+ ### Refactored
36
+ - Modularized `lib/generator.js` into distinct modules (`lib/modules/`) for better maintainability.
37
+ - Extracted logic for project setup, config files, database, app setup, and Kafka.
38
+
39
+ ### Fixed
40
+ - Resolved syntax error in `UserRepository.js` for Clean Architecture projects with 'None' database.
41
+ - Increased health check timeout to 60s in validation scripts to prevent false positives in heavy environments (MySQL + Kafka).
42
+ - Fixed missing `src/views` copy logic for MVC projects, resolving Docker build errors.
43
+ - Corrected CLI argument parsing to properly exclude undefined flags (e.g., `--db-name`).
44
+ - Removed obsolete `version: '3.8'` from `docker-compose.yml`.
45
+
46
+ ## [1.5.0] - 2026-02-10
47
+
48
+ ### Added
49
+ - Implemented structured logging with `winston-daily-rotate-file` (14-day retention, daily rotation).
50
+ - Added HTTP request logging using `morgan` middleware.
51
+
52
+ ### Fixed
53
+ - Resolved `EACCES` permission errors for log directories in Docker.
54
+
55
+ ## [1.4.5] - 2026-02-10
56
+
57
+ ### Changed
58
+ - Bumped version to 1.4.5.
59
+
60
+ ## [1.4.4] - 2026-02-10
61
+
62
+ ### Added
63
+ - Created `CHANGELOG.md` to track release history.
64
+
65
+ ## [1.4.3] - 2026-02-10
66
+
67
+ ### Fixed
68
+ - Updated CLI help text description to include MongoDB support.
69
+ - Fixed unexpected character issues in npm scripts.
70
+ - General bug fixes and improvements.
71
+
72
+ ## [1.0.0] - 2026-02-03
73
+
74
+ ### Added
75
+ - Initial release of `nodejs-quickstart-structure`.
76
+ - Scaffolding for MVC and Clean Architecture.
77
+ - Support for Express.js.
78
+ - Database integration (MongoDB, MySQL, PostgreSQL).
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A powerful CLI tool to scaffold production-ready Node.js microservices with built-in best practices, allowing you to choose between **MVC** or **Clean Architecture**, **JavaScript** or **TypeScript**, and your preferred database.
4
4
 
5
+ [![Medium Article](https://img.shields.io/badge/Medium-Read%20Article-black?logo=medium)](https://medium.com/@paudang/nodejs-quickstart-generator-93c276d60e0b)
6
+
5
7
  ![Demo](docs/demo.gif)
6
8
 
7
9
  ## Features
@@ -11,7 +13,8 @@ A powerful CLI tool to scaffold production-ready Node.js microservices with buil
11
13
  - **Language Support**: Choose between **JavaScript** and **TypeScript**.
12
14
  - **Database Integration**: Pre-configured setup for **MySQL**, **PostgreSQL**, or **MongoDB**.
13
15
  - **Microservices Ready**: Optional **Kafka** integration for event-driven communication.
14
- - **Dockerized**: Automatically generates `docker-compose.yml` for DB, Kafka, and Zookeeper.
16
+ - **Caching Layer**: Optional **Redis** integration for high-performance data caching.
17
+ - **Dockerized**: Automatically generates `docker-compose.yml` for DB, Kafka, Redis, and Zookeeper.
15
18
  - **Database Migrations/Schemas**: Integrated **Flyway** for SQL migrations or **Mongoose** schemas for MongoDB.
16
19
  - **Professional Standards**: Generated projects come with highly professional, industry-standard tooling.
17
20
 
@@ -26,6 +29,18 @@ We don't just generate boilerplate; we generate **production-ready** foundations
26
29
  - **⚓ Git Hooks**: `Husky` and `Lint-Staged` to ensure no bad code is ever committed.
27
30
  - **🐳 DevOps**: Highly optimized **Multi-Stage Dockerfile** for small, secure production images.
28
31
 
32
+ ## 🧩 112+ Project Combinations
33
+
34
+ The CLI supports a massive number of configurations to fit your exact needs:
35
+
36
+ - **112 Core Combinations**:
37
+ - **MVC Architecture**: 84 variants (Languages × View Engines × Databases × Communication Patterns × Caching)
38
+ - **Clean Architecture**: 28 variants (Languages × Databases × Communication Patterns × Caching)
39
+ - **224 Total Scenarios**:
40
+ - Every combination can be generated with or without **GitHub Actions CI/CD**, doubling the possibilities.
41
+
42
+ For a detailed list of all supported cases, check out [docs/generateCase.md](docs/generateCase.md).
43
+
29
44
  ## Installation
30
45
 
31
46
  You can install the tool globally directly from npm:
@@ -34,24 +49,6 @@ You can install the tool globally directly from npm:
34
49
  npm install -g nodejs-quickstart-structure
35
50
  ```
36
51
 
37
- ### Manual Installation (For Development)
38
-
39
- If you want to modify the CLI itself:
40
-
41
- 1. Clone this repository:
42
- ```bash
43
- git clone https://github.com/paudang/nodejs-quickstart-structure.git
44
- cd nodejs-quickstart-structure
45
- ```
46
- 2. Install dependencies:
47
- ```bash
48
- npm install
49
- ```
50
- 3. Link globally:
51
- ```bash
52
- npm link
53
- ```
54
-
55
52
  ## Usage
56
53
 
57
54
  Once installed, simply run the following command in any directory where you want to create a new project:
@@ -70,7 +67,8 @@ The CLI will guide you through the following steps:
70
67
  4. **Database**: `MySQL`, `PostgreSQL`, or `MongoDB`.
71
68
  5. **Database Name**: The name of the initial database.
72
69
  6. **Communication**: `REST APIs` (default) or `Kafka`.
73
- 7. **CI/CD**: `GitHub Actions`, `Jenkins`, or `None`.
70
+ 7. **Caching**: `Redis` or `None`.
71
+ 8. **CI/CD**: `GitHub Actions`, `Jenkins`, or `None`.
74
72
 
75
73
  ## Generated Project Structure
76
74
 
package/bin/index.js CHANGED
@@ -33,6 +33,7 @@ program
33
33
  .option('--db-name <name>', 'Database name')
34
34
  .option('-c, --communication <communication>', 'Communication (REST APIs, Kafka)')
35
35
  .option('--ci-provider <provider>', 'CI/CD Provider (None, GitHub Actions, Jenkins)')
36
+ .option('--caching <type>', 'Caching Layer (None/Redis)')
36
37
  .action(async (options) => {
37
38
  // Fix for Commander camelCase conversion
38
39
  if (options.ciProvider) {
@@ -1,74 +1,140 @@
1
1
  # NodeJS Quickstart Generator - Test Cases
2
2
 
3
- This document lists the **48 possible project combinations** supported by the `nodejs-quickstart` CLI. These combinations cover all supported languages, architectures, databases (including MongoDB), and communication patterns.
3
+ This document lists the **112 possible project combinations** supported by the `nodejs-quickstart` CLI. These combinations cover all supported languages, architectures, databases, communication patterns, and caching options.
4
4
 
5
5
  ## Summary
6
- - **MVC Architecture**: 36 Combinations
7
- - (2 Languages × 3 View Engines × 3 Databases × 2 Patterns)
8
- - **Clean Architecture**: 12 Combinations
9
- - (2 Languages × 1 View Engine (None) × 3 Databases × 2 Patterns)
6
+ - **MVC Architecture**: 84 Combinations
7
+ - **With Database (36)**: 2 Lang × 3 View × 3 DB × 2 Comm = 36 * 2 (Caching: None/Redis) = 72
8
+ - **No Database (12)**: 2 Lang × 3 View × 1 DB × 2 Comm = 12 * 1 (Caching: None) = 12
9
+ - **Clean Architecture**: 28 Combinations
10
+ - **With Database (12)**: 2 Lang × 1 View (None) × 3 DB × 2 Comm = 12 * 2 (Caching: None/Redis) = 24
11
+ - **No Database (4)**: 2 Lang × 1 View (None) × 1 DB × 2 Comm = 4 * 1 (Caching: None) = 4
10
12
 
11
- **Total Core Combinations: 48**
13
+ **Total Core Combinations: 112**
12
14
 
13
- > **Note on CI/CD**: Each of these 48 combinations can be generated with or without the **GitHub Actions CI Workflow** (`--include-ci`). This effectively creates **96 possible project states**. The validation script currently defaults to *including* CI to verify the full "Professional Standards" feature set.
15
+ > **Note on CI/CD**: Each combination can be generated with or without CI/CD (`--ci-provider`), effectively doubling the state space.
14
16
 
15
17
  ---
16
18
 
17
- ## 1. MVC Architecture (36 Cases)
19
+ ## 1. MVC Architecture (84 Cases)
18
20
 
19
- | # | Language | Architecture | View Engine | Database | Communication |
20
- | :--- | :--- | :--- | :--- | :--- | :--- |
21
- | 1 | JavaScript | MVC | None | MySQL | REST APIs |
22
- | 2 | JavaScript | MVC | None | MySQL | Kafka |
23
- | 3 | JavaScript | MVC | None | PostgreSQL | REST APIs |
24
- | 4 | JavaScript | MVC | None | PostgreSQL | Kafka |
25
- | 5 | JavaScript | MVC | None | MongoDB | REST APIs |
26
- | 6 | JavaScript | MVC | None | MongoDB | Kafka |
27
- | 7 | JavaScript | MVC | EJS | MySQL | REST APIs |
28
- | 8 | JavaScript | MVC | EJS | MySQL | Kafka |
29
- | 9 | JavaScript | MVC | EJS | PostgreSQL | REST APIs |
30
- | 10 | JavaScript | MVC | EJS | PostgreSQL | Kafka |
31
- | 11 | JavaScript | MVC | EJS | MongoDB | REST APIs |
32
- | 12 | JavaScript | MVC | EJS | MongoDB | Kafka |
33
- | 13 | JavaScript | MVC | Pug | MySQL | REST APIs |
34
- | 14 | JavaScript | MVC | Pug | MySQL | Kafka |
35
- | 15 | JavaScript | MVC | Pug | PostgreSQL | REST APIs |
36
- | 16 | JavaScript | MVC | Pug | PostgreSQL | Kafka |
37
- | 17 | JavaScript | MVC | Pug | MongoDB | REST APIs |
38
- | 18 | JavaScript | MVC | Pug | MongoDB | Kafka |
39
- | 19 | TypeScript | MVC | None | MySQL | REST APIs |
40
- | 20 | TypeScript | MVC | None | MySQL | Kafka |
41
- | 21 | TypeScript | MVC | None | PostgreSQL | REST APIs |
42
- | 22 | TypeScript | MVC | None | PostgreSQL | Kafka |
43
- | 23 | TypeScript | MVC | None | MongoDB | REST APIs |
44
- | 24 | TypeScript | MVC | None | MongoDB | Kafka |
45
- | 25 | TypeScript | MVC | EJS | MySQL | REST APIs |
46
- | 26 | TypeScript | MVC | EJS | MySQL | Kafka |
47
- | 27 | TypeScript | MVC | EJS | PostgreSQL | REST APIs |
48
- | 28 | TypeScript | MVC | EJS | PostgreSQL | Kafka |
49
- | 29 | TypeScript | MVC | EJS | MongoDB | REST APIs |
50
- | 30 | TypeScript | MVC | EJS | MongoDB | Kafka |
51
- | 31 | TypeScript | MVC | Pug | MySQL | REST APIs |
52
- | 32 | TypeScript | MVC | Pug | MySQL | Kafka |
53
- | 33 | TypeScript | MVC | Pug | PostgreSQL | REST APIs |
54
- | 34 | TypeScript | MVC | Pug | PostgreSQL | Kafka |
55
- | 35 | TypeScript | MVC | Pug | MongoDB | REST APIs |
56
- | 36 | TypeScript | MVC | Pug | MongoDB | Kafka |
21
+ | # | Language | Architecture | View Engine | Database | Communication | Caching |
22
+ | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
23
+ | 1 | JavaScript | MVC | None | MySQL | REST APIs | None |
24
+ | 2 | JavaScript | MVC | None | MySQL | REST APIs | Redis |
25
+ | 3 | JavaScript | MVC | None | MySQL | Kafka | None |
26
+ | 4 | JavaScript | MVC | None | MySQL | Kafka | Redis |
27
+ | 5 | JavaScript | MVC | None | PostgreSQL | REST APIs | None |
28
+ | 6 | JavaScript | MVC | None | PostgreSQL | REST APIs | Redis |
29
+ | 7 | JavaScript | MVC | None | PostgreSQL | Kafka | None |
30
+ | 8 | JavaScript | MVC | None | PostgreSQL | Kafka | Redis |
31
+ | 9 | JavaScript | MVC | None | MongoDB | REST APIs | None |
32
+ | 10 | JavaScript | MVC | None | MongoDB | REST APIs | Redis |
33
+ | 11 | JavaScript | MVC | None | MongoDB | Kafka | None |
34
+ | 12 | JavaScript | MVC | None | MongoDB | Kafka | Redis |
35
+ | 13 | JavaScript | MVC | EJS | MySQL | REST APIs | None |
36
+ | 14 | JavaScript | MVC | EJS | MySQL | REST APIs | Redis |
37
+ | 15 | JavaScript | MVC | EJS | MySQL | Kafka | None |
38
+ | 16 | JavaScript | MVC | EJS | MySQL | Kafka | Redis |
39
+ | 17 | JavaScript | MVC | EJS | PostgreSQL | REST APIs | None |
40
+ | 18 | JavaScript | MVC | EJS | PostgreSQL | REST APIs | Redis |
41
+ | 19 | JavaScript | MVC | EJS | PostgreSQL | Kafka | None |
42
+ | 20 | JavaScript | MVC | EJS | PostgreSQL | Kafka | Redis |
43
+ | 21 | JavaScript | MVC | EJS | MongoDB | REST APIs | None |
44
+ | 22 | JavaScript | MVC | EJS | MongoDB | REST APIs | Redis |
45
+ | 23 | JavaScript | MVC | EJS | MongoDB | Kafka | None |
46
+ | 24 | JavaScript | MVC | EJS | MongoDB | Kafka | Redis |
47
+ | 25 | JavaScript | MVC | Pug | MySQL | REST APIs | None |
48
+ | 26 | JavaScript | MVC | Pug | MySQL | REST APIs | Redis |
49
+ | 27 | JavaScript | MVC | Pug | MySQL | Kafka | None |
50
+ | 28 | JavaScript | MVC | Pug | MySQL | Kafka | Redis |
51
+ | 29 | JavaScript | MVC | Pug | PostgreSQL | REST APIs | None |
52
+ | 30 | JavaScript | MVC | Pug | PostgreSQL | REST APIs | Redis |
53
+ | 31 | JavaScript | MVC | Pug | PostgreSQL | Kafka | None |
54
+ | 32 | JavaScript | MVC | Pug | PostgreSQL | Kafka | Redis |
55
+ | 33 | JavaScript | MVC | Pug | MongoDB | REST APIs | None |
56
+ | 34 | JavaScript | MVC | Pug | MongoDB | REST APIs | Redis |
57
+ | 35 | JavaScript | MVC | Pug | MongoDB | Kafka | None |
58
+ | 36 | JavaScript | MVC | Pug | MongoDB | Kafka | Redis |
59
+ | 37 | TypeScript | MVC | None | MySQL | REST APIs | None |
60
+ | 38 | TypeScript | MVC | None | MySQL | REST APIs | Redis |
61
+ | 39 | TypeScript | MVC | None | MySQL | Kafka | None |
62
+ | 40 | TypeScript | MVC | None | MySQL | Kafka | Redis |
63
+ | 41 | TypeScript | MVC | None | PostgreSQL | REST APIs | None |
64
+ | 42 | TypeScript | MVC | None | PostgreSQL | REST APIs | Redis |
65
+ | 43 | TypeScript | MVC | None | PostgreSQL | Kafka | None |
66
+ | 44 | TypeScript | MVC | None | PostgreSQL | Kafka | Redis |
67
+ | 45 | TypeScript | MVC | None | MongoDB | REST APIs | None |
68
+ | 46 | TypeScript | MVC | None | MongoDB | REST APIs | Redis |
69
+ | 47 | TypeScript | MVC | None | MongoDB | Kafka | None |
70
+ | 48 | TypeScript | MVC | None | MongoDB | Kafka | Redis |
71
+ | 49 | TypeScript | MVC | EJS | MySQL | REST APIs | None |
72
+ | 50 | TypeScript | MVC | EJS | MySQL | REST APIs | Redis |
73
+ | 51 | TypeScript | MVC | EJS | MySQL | Kafka | None |
74
+ | 52 | TypeScript | MVC | EJS | MySQL | Kafka | Redis |
75
+ | 53 | TypeScript | MVC | EJS | PostgreSQL | REST APIs | None |
76
+ | 54 | TypeScript | MVC | EJS | PostgreSQL | REST APIs | Redis |
77
+ | 55 | TypeScript | MVC | EJS | PostgreSQL | Kafka | None |
78
+ | 56 | TypeScript | MVC | EJS | PostgreSQL | Kafka | Redis |
79
+ | 57 | TypeScript | MVC | EJS | MongoDB | REST APIs | None |
80
+ | 58 | TypeScript | MVC | EJS | MongoDB | REST APIs | Redis |
81
+ | 59 | TypeScript | MVC | EJS | MongoDB | Kafka | None |
82
+ | 60 | TypeScript | MVC | EJS | MongoDB | Kafka | Redis |
83
+ | 61 | TypeScript | MVC | Pug | MySQL | REST APIs | None |
84
+ | 62 | TypeScript | MVC | Pug | MySQL | REST APIs | Redis |
85
+ | 63 | TypeScript | MVC | Pug | MySQL | Kafka | None |
86
+ | 64 | TypeScript | MVC | Pug | MySQL | Kafka | Redis |
87
+ | 65 | TypeScript | MVC | Pug | PostgreSQL | REST APIs | None |
88
+ | 66 | TypeScript | MVC | Pug | PostgreSQL | REST APIs | Redis |
89
+ | 67 | TypeScript | MVC | Pug | PostgreSQL | Kafka | None |
90
+ | 68 | TypeScript | MVC | Pug | PostgreSQL | Kafka | Redis |
91
+ | 69 | TypeScript | MVC | Pug | MongoDB | REST APIs | None |
92
+ | 70 | TypeScript | MVC | Pug | MongoDB | REST APIs | Redis |
93
+ | 71 | TypeScript | MVC | Pug | MongoDB | Kafka | None |
94
+ | 72 | TypeScript | MVC | Pug | MongoDB | Kafka | Redis |
95
+ | 73 | JavaScript | MVC | None | None | REST APIs | None |
96
+ | 74 | JavaScript | MVC | None | None | Kafka | None |
97
+ | 75 | JavaScript | MVC | EJS | None | REST APIs | None |
98
+ | 76 | JavaScript | MVC | EJS | None | Kafka | None |
99
+ | 77 | JavaScript | MVC | Pug | None | REST APIs | None |
100
+ | 78 | JavaScript | MVC | Pug | None | Kafka | None |
101
+ | 79 | TypeScript | MVC | None | None | REST APIs | None |
102
+ | 80 | TypeScript | MVC | None | None | Kafka | None |
103
+ | 81 | TypeScript | MVC | EJS | None | REST APIs | None |
104
+ | 82 | TypeScript | MVC | EJS | None | Kafka | None |
105
+ | 83 | TypeScript | MVC | Pug | None | REST APIs | None |
106
+ | 84 | TypeScript | MVC | Pug | None | Kafka | None |
57
107
 
58
- ## 2. Clean Architecture (12 Cases)
108
+ ## 2. Clean Architecture (16 Cases)
59
109
  *Note: Clean Architecture does not use server-side view engines (EJS/Pug).*
60
110
 
61
- | # | Language | Architecture | View Engine | Database | Communication |
62
- | :--- | :--- | :--- | :--- | :--- | :--- |
63
- | 37 | JavaScript | Clean Architecture | N/A | MySQL | REST APIs |
64
- | 38 | JavaScript | Clean Architecture | N/A | MySQL | Kafka |
65
- | 39 | JavaScript | Clean Architecture | N/A | PostgreSQL | REST APIs |
66
- | 40 | JavaScript | Clean Architecture | N/A | PostgreSQL | Kafka |
67
- | 41 | JavaScript | Clean Architecture | N/A | MongoDB | REST APIs |
68
- | 42 | JavaScript | Clean Architecture | N/A | MongoDB | Kafka |
69
- | 43 | TypeScript | Clean Architecture | N/A | MySQL | REST APIs |
70
- | 44 | TypeScript | Clean Architecture | N/A | MySQL | Kafka |
71
- | 45 | TypeScript | Clean Architecture | N/A | PostgreSQL | REST APIs |
72
- | 46 | TypeScript | Clean Architecture | N/A | PostgreSQL | Kafka |
73
- | 47 | TypeScript | Clean Architecture | N/A | MongoDB | REST APIs |
74
- | 48 | TypeScript | Clean Architecture | N/A | MongoDB | Kafka |
111
+ | # | Language | Architecture | View Engine | Database | Communication | Caching |
112
+ | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
113
+ | 85 | JavaScript | Clean Architecture | N/A | MySQL | REST APIs | None |
114
+ | 86 | JavaScript | Clean Architecture | N/A | MySQL | REST APIs | Redis |
115
+ | 87 | JavaScript | Clean Architecture | N/A | MySQL | Kafka | None |
116
+ | 88 | JavaScript | Clean Architecture | N/A | MySQL | Kafka | Redis |
117
+ | 89 | JavaScript | Clean Architecture | N/A | PostgreSQL | REST APIs | None |
118
+ | 90 | JavaScript | Clean Architecture | N/A | PostgreSQL | REST APIs | Redis |
119
+ | 91 | JavaScript | Clean Architecture | N/A | PostgreSQL | Kafka | None |
120
+ | 92 | JavaScript | Clean Architecture | N/A | PostgreSQL | Kafka | Redis |
121
+ | 93 | JavaScript | Clean Architecture | N/A | MongoDB | REST APIs | None |
122
+ | 94 | JavaScript | Clean Architecture | N/A | MongoDB | REST APIs | Redis |
123
+ | 95 | JavaScript | Clean Architecture | N/A | MongoDB | Kafka | None |
124
+ | 96 | JavaScript | Clean Architecture | N/A | MongoDB | Kafka | Redis |
125
+ | 97 | TypeScript | Clean Architecture | N/A | MySQL | REST APIs | None |
126
+ | 98 | TypeScript | Clean Architecture | N/A | MySQL | REST APIs | Redis |
127
+ | 99 | TypeScript | Clean Architecture | N/A | MySQL | Kafka | None |
128
+ | 100 | TypeScript | Clean Architecture | N/A | MySQL | Kafka | Redis |
129
+ | 101 | TypeScript | Clean Architecture | N/A | PostgreSQL | REST APIs | None |
130
+ | 102 | TypeScript | Clean Architecture | N/A | PostgreSQL | REST APIs | Redis |
131
+ | 103 | TypeScript | Clean Architecture | N/A | PostgreSQL | Kafka | None |
132
+ | 104 | TypeScript | Clean Architecture | N/A | PostgreSQL | Kafka | Redis |
133
+ | 105 | TypeScript | Clean Architecture | N/A | MongoDB | REST APIs | None |
134
+ | 106 | TypeScript | Clean Architecture | N/A | MongoDB | REST APIs | Redis |
135
+ | 107 | TypeScript | Clean Architecture | N/A | MongoDB | Kafka | None |
136
+ | 108 | TypeScript | Clean Architecture | N/A | MongoDB | Kafka | Redis |
137
+ | 109 | JavaScript | Clean Architecture | N/A | None | REST APIs | None |
138
+ | 110 | JavaScript | Clean Architecture | N/A | None | Kafka | None |
139
+ | 111 | TypeScript | Clean Architecture | N/A | None | REST APIs | None |
140
+ | 112 | TypeScript | Clean Architecture | N/A | None | Kafka | None |
@@ -23,9 +23,10 @@ The generator prompts the user for the following configurations. These determine
23
23
  | **Language** | `JavaScript`, `TypeScript` | `TypeScript` | The programming language to use. |
24
24
  | **Architecture** | `MVC`, `Clean Architecture` | `MVC` | The architectural pattern. |
25
25
  | **View Engine** | `None`, `EJS`, `Pug` | `None` | (MVC Only) Template engine for server-side rendering. |
26
- | **Database** | `MySQL`, `PostgreSQL`, `MongoDB` | `MySQL` | The primary database. |
26
+ | **Database** | `None`, `MySQL`, `PostgreSQL`, `MongoDB` | `None` | The primary database. |
27
27
  | **Database Name** | Input String | `demo` | The name of the database to use/create. |
28
28
  | **Communication**| `REST APIs`, `Kafka` | `REST APIs` | The primary communication method. |
29
+ | **Caching Layer**| `None`, `Redis` | `None` | (If DB selected) Caching solution. |
29
30
  | **CI/CD Provider**| `None`, `GitHub Actions`, `Jenkins`| `None` | Setup for Continuous Integration/Deployment. |
30
31
 
31
32
  ## 3. Main Generator Flow
@@ -42,6 +43,7 @@ The `generateProject` function in `lib/generator.js` executes the following step
42
43
  4. **Render `docker-compose.yml`**:
43
44
  * Uses `templates/common/docker-compose.yml.ejs`.
44
45
  * Configures services (DB, Zookeeper/Kafka) based on selection.
46
+ * **Note**: If Database is `None`, DB services are excluded.
45
47
  5. **Render `README.md`**:
46
48
  * Generates custom documentation specific to the selected stack.
47
49
  6. **Render `src/index.{js|ts}`**:
@@ -65,11 +67,20 @@ The `generateProject` function in `lib/generator.js` executes the following step
65
67
  10. **Database Setup**:
66
68
  * **MongoDB**: Sets up `migrate-mongo-config.js` and initial migration script.
67
69
  * **SQL (MySQL/Postgres)**: Sets up `flyway/sql` directory and copies initial SQL migration files.
68
- 11. **Database Connection Config**:
70
+ * **None**: Skips migration setup.
71
+ 11. **Caching Setup**:
72
+ * **Redis**:
73
+ * Injects `ioredis` dependency into `package.json`.
74
+ * Generates `redisClient.{js|ts}` config.
75
+ * **MVC**: Injects caching logic into `userController`.
76
+ * **Clean Architecture**: Overwrites `GetAllUsers` use case with caching-enabled version.
77
+ 12. **Database Connection Config**:
69
78
  * Renders `database.{js|ts}` or `mongoose.{js|ts}` based on DB selection.
70
79
  * Places it in `src/config` (MVC) or `src/infrastructure/database` (Clean Arch).
80
+ * **None**: Skips this step.
71
81
  12. **Model Generation**:
72
82
  * Renders `User` model (Mongoose schema or Sequelize/TypeORM model) in the appropriate directory.
83
+ * **None**: Generates a simple Mock Entity/Model class with in-memory data for testing.
73
84
  13. **View Engine Setup (MVC)**:
74
85
  * If selected, copies views (`views/ejs` or `views/pug`) and `public` assets.
75
86
  14. **Swagger Config**:
@@ -105,7 +116,7 @@ Standard architecture for web APIs.
105
116
  ```text
106
117
  project-name/
107
118
  ├── src/
108
- │ ├── config/ # Database, Swagger, etc.
119
+ │ ├── config/ # Database, Redis, Swagger, etc.
109
120
  │ ├── controllers/ # Request handlers
110
121
  │ ├── models/ # Database models
111
122
  │ ├── routes/ # Express routes
@@ -145,6 +156,7 @@ project-name/
145
156
  │ │ └── routes/
146
157
  │ ├── infrastructure/ # Frameworks & Drivers
147
158
  │ │ ├── config/ # Environment config
159
+ │ │ ├── caching/ # Redis Client
148
160
  │ │ ├── database/ # DB connection & models
149
161
  │ │ ├── repositories/ # Data access implementation
150
162
  │ │ └── webserver/ # Express server setup
@@ -0,0 +1,42 @@
1
+ # Release Process
2
+
3
+ This document outlines the steps to release a new version of `nodejs-quickstart-structure`.
4
+
5
+ ## 1. Update Changelog
6
+
7
+ Before releasing, update `CHANGELOG.md`:
8
+ 1. Create a new header for the new version (e.g., `## [1.4.6] - 2026-02-12`).
9
+ 2. Document new features, bug fixes, and changes.
10
+ 3. Save the file.
11
+
12
+ ## 2. Commit Changelog
13
+
14
+ Stage the `CHANGELOG.md` changes but **do not commit yet** if you want to include it in the version bump commit.
15
+ ```bash
16
+ git add CHANGELOG.md
17
+ ```
18
+
19
+ ## 3. Bump Version & Tag
20
+
21
+ Run the appropriate `npm version` command. This will assume you have a clean working directory (after staging `CHANGELOG.md`).
22
+ ```bash
23
+ npm version patch # For bug fixes (1.4.5 -> 1.4.6)
24
+ npm version minor # For new features (1.4.5 -> 1.5.0)
25
+ npm version major # For breaking changes (1.4.5 -> 2.0.0)
26
+ ```
27
+ *Note: This command automatically updates `package.json`, creates a git commit with the new version number, and creates a git tag (e.g., `v1.4.6`).*
28
+
29
+ ## 4. Push Changes & Tags
30
+
31
+ Push the new commit and the new tag to GitHub:
32
+ ```bash
33
+ git push origin main
34
+ git push origin --follow-tags
35
+ ```
36
+
37
+ ## 5. Publish to NPM (Optional)
38
+
39
+ If you are publishing this package to the npm registry:
40
+ ```bash
41
+ npm publish
42
+ ```