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.
- package/CHANGELOG.md +309 -294
- package/LICENSE +15 -15
- package/README.md +2 -1
- package/lib/generator.js +139 -139
- package/lib/modules/app-setup.js +401 -401
- package/lib/modules/caching-setup.js +76 -73
- package/lib/modules/config-files.js +151 -151
- package/lib/modules/database-setup.js +116 -116
- package/lib/modules/kafka-setup.js +249 -191
- package/lib/modules/project-setup.js +32 -31
- package/lib/prompts.js +100 -100
- package/package.json +78 -67
- package/templates/clean-architecture/js/src/domain/models/User.js +9 -9
- package/templates/clean-architecture/js/src/errors/ApiError.js +14 -14
- package/templates/clean-architecture/js/src/errors/BadRequestError.js +11 -10
- package/templates/clean-architecture/js/src/errors/BadRequestError.spec.js.ejs +22 -21
- package/templates/clean-architecture/js/src/errors/NotFoundError.js +11 -10
- package/templates/clean-architecture/js/src/errors/NotFoundError.spec.js.ejs +22 -21
- package/templates/clean-architecture/js/src/index.js.ejs +55 -55
- package/templates/clean-architecture/js/src/infrastructure/config/env.js.ejs +47 -47
- package/templates/clean-architecture/js/src/infrastructure/log/logger.js +36 -36
- package/templates/clean-architecture/js/src/infrastructure/log/logger.spec.js.ejs +63 -63
- package/templates/clean-architecture/js/src/infrastructure/repositories/UserRepository.js.ejs +69 -39
- package/templates/clean-architecture/js/src/infrastructure/repositories/UserRepository.spec.js.ejs +142 -81
- package/templates/clean-architecture/js/src/infrastructure/webserver/middleware/errorMiddleware.js +30 -30
- package/templates/clean-architecture/js/src/infrastructure/webserver/server.js.ejs +89 -89
- package/templates/clean-architecture/js/src/infrastructure/webserver/swagger.js.ejs +6 -6
- package/templates/clean-architecture/js/src/interfaces/controllers/userController.js.ejs +156 -75
- package/templates/clean-architecture/js/src/interfaces/controllers/userController.spec.js.ejs +234 -138
- package/templates/clean-architecture/js/src/interfaces/graphql/context.js.ejs +13 -13
- package/templates/clean-architecture/js/src/interfaces/graphql/context.spec.js.ejs +31 -31
- package/templates/clean-architecture/js/src/interfaces/graphql/index.js.ejs +5 -5
- package/templates/clean-architecture/js/src/interfaces/graphql/resolvers/index.js.ejs +6 -6
- package/templates/clean-architecture/js/src/interfaces/graphql/resolvers/user.resolvers.js.ejs +27 -21
- package/templates/clean-architecture/js/src/interfaces/graphql/resolvers/user.resolvers.spec.js.ejs +66 -49
- package/templates/clean-architecture/js/src/interfaces/graphql/typeDefs/index.js.ejs +6 -6
- package/templates/clean-architecture/js/src/interfaces/graphql/typeDefs/user.types.js.ejs +19 -17
- package/templates/clean-architecture/js/src/interfaces/routes/api.js +12 -10
- package/templates/clean-architecture/js/src/interfaces/routes/api.spec.js.ejs +38 -38
- package/templates/clean-architecture/js/src/usecases/CreateUser.js +14 -14
- package/templates/clean-architecture/js/src/usecases/CreateUser.spec.js.ejs +51 -51
- package/templates/clean-architecture/js/src/usecases/DeleteUser.js +11 -0
- package/templates/clean-architecture/js/src/usecases/DeleteUser.spec.js.ejs +47 -0
- package/templates/clean-architecture/js/src/usecases/GetAllUsers.js +12 -12
- package/templates/clean-architecture/js/src/usecases/GetAllUsers.spec.js.ejs +61 -61
- package/templates/clean-architecture/js/src/usecases/UpdateUser.js +11 -0
- package/templates/clean-architecture/js/src/usecases/UpdateUser.spec.js.ejs +48 -0
- package/templates/clean-architecture/js/src/utils/errorMessages.js +14 -0
- package/templates/clean-architecture/js/src/utils/httpCodes.js +9 -9
- package/templates/clean-architecture/ts/src/config/env.ts.ejs +46 -46
- package/templates/clean-architecture/ts/src/config/swagger.ts.ejs +6 -6
- package/templates/clean-architecture/ts/src/domain/user.ts +7 -7
- package/templates/clean-architecture/ts/src/errors/ApiError.ts +15 -15
- package/templates/clean-architecture/ts/src/errors/BadRequestError.spec.ts.ejs +22 -21
- package/templates/clean-architecture/ts/src/errors/BadRequestError.ts +9 -8
- package/templates/clean-architecture/ts/src/errors/NotFoundError.spec.ts.ejs +22 -21
- package/templates/clean-architecture/ts/src/errors/NotFoundError.ts +9 -8
- package/templates/clean-architecture/ts/src/index.ts.ejs +139 -139
- package/templates/clean-architecture/ts/src/infrastructure/log/logger.spec.ts.ejs +63 -63
- package/templates/clean-architecture/ts/src/infrastructure/log/logger.ts +36 -36
- package/templates/clean-architecture/ts/src/infrastructure/repositories/UserRepository.spec.ts.ejs +175 -85
- package/templates/clean-architecture/ts/src/infrastructure/repositories/userRepository.ts.ejs +74 -0
- package/templates/clean-architecture/ts/src/interfaces/controllers/userController.spec.ts.ejs +331 -185
- package/templates/clean-architecture/ts/src/interfaces/controllers/userController.ts.ejs +173 -84
- package/templates/clean-architecture/ts/src/interfaces/graphql/context.spec.ts.ejs +32 -32
- package/templates/clean-architecture/ts/src/interfaces/graphql/context.ts.ejs +17 -17
- package/templates/clean-architecture/ts/src/interfaces/graphql/index.ts.ejs +3 -3
- package/templates/clean-architecture/ts/src/interfaces/graphql/resolvers/index.ts.ejs +4 -4
- package/templates/clean-architecture/ts/src/interfaces/graphql/resolvers/user.resolvers.spec.ts.ejs +68 -51
- package/templates/clean-architecture/ts/src/interfaces/graphql/resolvers/user.resolvers.ts.ejs +29 -21
- package/templates/clean-architecture/ts/src/interfaces/graphql/typeDefs/index.ts.ejs +4 -4
- package/templates/clean-architecture/ts/src/interfaces/graphql/typeDefs/user.types.ts.ejs +17 -15
- package/templates/clean-architecture/ts/src/interfaces/routes/userRoutes.spec.ts.ejs +40 -40
- package/templates/clean-architecture/ts/src/interfaces/routes/userRoutes.ts +13 -11
- package/templates/clean-architecture/ts/src/usecases/createUser.spec.ts.ejs +51 -51
- package/templates/clean-architecture/ts/src/usecases/createUser.ts +13 -13
- package/templates/clean-architecture/ts/src/usecases/deleteUser.spec.ts.ejs +47 -0
- package/templates/clean-architecture/ts/src/usecases/deleteUser.ts +9 -0
- package/templates/clean-architecture/ts/src/usecases/getAllUsers.spec.ts.ejs +63 -63
- package/templates/clean-architecture/ts/src/usecases/getAllUsers.ts +10 -10
- package/templates/clean-architecture/ts/src/usecases/updateUser.spec.ts.ejs +48 -0
- package/templates/clean-architecture/ts/src/usecases/updateUser.ts +9 -0
- package/templates/clean-architecture/ts/src/utils/errorMessages.ts +12 -0
- package/templates/clean-architecture/ts/src/utils/errorMiddleware.ts.ejs +27 -27
- package/templates/clean-architecture/ts/src/utils/httpCodes.ts +7 -7
- package/templates/common/.cursorrules.ejs +60 -60
- package/templates/common/.dockerignore +12 -12
- package/templates/common/.env.example.ejs +41 -41
- package/templates/common/.gitattributes +46 -0
- package/templates/common/.gitlab-ci.yml.ejs +86 -86
- package/templates/common/.lintstagedrc +6 -6
- package/templates/common/.prettierrc +7 -7
- package/templates/common/Dockerfile +73 -73
- package/templates/common/Jenkinsfile.ejs +87 -87
- package/templates/common/README.md.ejs +294 -270
- package/templates/common/SECURITY.md +20 -20
- package/templates/common/_github/workflows/ci.yml.ejs +46 -46
- package/templates/common/_github/workflows/security.yml.ejs +36 -36
- package/templates/common/_gitignore +5 -5
- package/templates/common/_husky/pre-commit +4 -4
- package/templates/common/caching/clean/js/CreateUser.js.ejs +29 -29
- package/templates/common/caching/clean/js/DeleteUser.js.ejs +27 -0
- package/templates/common/caching/clean/js/GetAllUsers.js.ejs +37 -37
- package/templates/common/caching/clean/js/UpdateUser.js.ejs +27 -0
- package/templates/common/caching/clean/ts/createUser.ts.ejs +27 -27
- package/templates/common/caching/clean/ts/deleteUser.ts.ejs +24 -0
- package/templates/common/caching/clean/ts/getAllUsers.ts.ejs +34 -34
- package/templates/common/caching/clean/ts/updateUser.ts.ejs +25 -0
- package/templates/common/caching/js/memoryCache.js.ejs +60 -60
- package/templates/common/caching/js/memoryCache.spec.js.ejs +101 -101
- package/templates/common/caching/js/redisClient.js.ejs +75 -75
- package/templates/common/caching/js/redisClient.spec.js.ejs +147 -147
- package/templates/common/caching/ts/memoryCache.spec.ts.ejs +102 -102
- package/templates/common/caching/ts/memoryCache.ts.ejs +73 -64
- package/templates/common/caching/ts/redisClient.spec.ts.ejs +157 -157
- package/templates/common/caching/ts/redisClient.ts.ejs +89 -80
- package/templates/common/database/js/database.js.ejs +19 -19
- package/templates/common/database/js/database.spec.js.ejs +56 -56
- package/templates/common/database/js/models/User.js.ejs +79 -53
- package/templates/common/database/js/models/User.js.mongoose.ejs +23 -19
- package/templates/common/database/js/models/User.spec.js.ejs +94 -84
- package/templates/common/database/js/mongoose.js.ejs +33 -33
- package/templates/common/database/js/mongoose.spec.js.ejs +43 -43
- package/templates/common/database/ts/database.spec.ts.ejs +56 -56
- package/templates/common/database/ts/database.ts.ejs +21 -21
- package/templates/common/database/ts/models/User.spec.ts.ejs +100 -84
- package/templates/common/database/ts/models/User.ts.ejs +87 -61
- package/templates/common/database/ts/models/User.ts.mongoose.ejs +30 -25
- package/templates/common/database/ts/mongoose.spec.ts.ejs +42 -42
- package/templates/common/database/ts/mongoose.ts.ejs +28 -28
- package/templates/common/docker-compose.yml.ejs +159 -159
- package/templates/common/ecosystem.config.js.ejs +40 -40
- package/templates/common/eslint.config.mjs.ejs +77 -77
- package/templates/common/health/js/healthRoute.js.ejs +50 -47
- package/templates/common/health/js/healthRoute.spec.js.ejs +70 -70
- package/templates/common/health/ts/healthRoute.spec.ts.ejs +76 -76
- package/templates/common/health/ts/healthRoute.ts.ejs +49 -46
- package/templates/common/jest.config.js.ejs +32 -32
- package/templates/common/jest.e2e.config.js.ejs +8 -8
- package/templates/common/kafka/js/config/kafka.js +9 -9
- package/templates/common/kafka/js/config/kafka.spec.js.ejs +27 -27
- package/templates/common/kafka/js/messaging/baseConsumer.js.ejs +30 -30
- package/templates/common/kafka/js/messaging/baseConsumer.spec.js.ejs +58 -58
- package/templates/common/kafka/js/messaging/userEventSchema.js.ejs +12 -11
- package/templates/common/kafka/js/messaging/userEventSchema.spec.js.ejs +27 -27
- package/templates/common/kafka/js/messaging/welcomeEmailConsumer.js.ejs +44 -31
- package/templates/common/kafka/js/messaging/welcomeEmailConsumer.spec.js.ejs +86 -49
- package/templates/common/kafka/js/services/kafkaService.js.ejs +93 -93
- package/templates/common/kafka/js/services/kafkaService.spec.js.ejs +106 -106
- package/templates/common/kafka/js/utils/kafkaEvents.js.ejs +7 -0
- package/templates/common/kafka/ts/config/kafka.spec.ts.ejs +27 -27
- package/templates/common/kafka/ts/config/kafka.ts +7 -7
- package/templates/common/kafka/ts/messaging/baseConsumer.spec.ts.ejs +50 -50
- package/templates/common/kafka/ts/messaging/baseConsumer.ts.ejs +27 -27
- package/templates/common/kafka/ts/messaging/userEventSchema.spec.ts.ejs +51 -51
- package/templates/common/kafka/ts/messaging/userEventSchema.ts.ejs +12 -11
- package/templates/common/kafka/ts/messaging/welcomeEmailConsumer.spec.ts.ejs +86 -49
- package/templates/common/kafka/ts/messaging/welcomeEmailConsumer.ts.ejs +38 -25
- package/templates/common/kafka/ts/services/kafkaService.spec.ts.ejs +81 -81
- package/templates/common/kafka/ts/services/kafkaService.ts.ejs +95 -95
- package/templates/common/kafka/ts/utils/kafkaEvents.ts.ejs +5 -0
- package/templates/common/migrate-mongo-config.js.ejs +31 -31
- package/templates/common/migrations/init.js.ejs +23 -23
- package/templates/common/package.json.ejs +119 -118
- package/templates/common/prompts/add-feature.md.ejs +26 -26
- package/templates/common/prompts/project-context.md.ejs +43 -43
- package/templates/common/prompts/troubleshoot.md.ejs +28 -28
- package/templates/common/public/css/style.css +147 -147
- package/templates/common/scripts/run-e2e.js.ejs +63 -63
- package/templates/common/shutdown/js/gracefulShutdown.js.ejs +65 -61
- package/templates/common/shutdown/js/gracefulShutdown.spec.js.ejs +149 -160
- package/templates/common/shutdown/ts/gracefulShutdown.spec.ts.ejs +179 -158
- package/templates/common/shutdown/ts/gracefulShutdown.ts.ejs +59 -55
- package/templates/common/sonar-project.properties.ejs +27 -27
- package/templates/common/src/tests/e2e/e2e.users.test.js.ejs +120 -49
- package/templates/common/src/tests/e2e/e2e.users.test.ts.ejs +120 -49
- package/templates/common/src/utils/errorMiddleware.spec.js.ejs +79 -79
- package/templates/common/src/utils/errorMiddleware.spec.ts.ejs +94 -94
- package/templates/common/swagger.yml.ejs +118 -66
- package/templates/common/tsconfig.json +22 -22
- package/templates/common/views/ejs/index.ejs +55 -55
- package/templates/common/views/pug/index.pug +40 -40
- package/templates/db/mysql/V1__Initial_Setup.sql.ejs +10 -9
- package/templates/db/postgres/V1__Initial_Setup.sql.ejs +10 -9
- package/templates/mvc/js/src/config/env.js.ejs +46 -46
- package/templates/mvc/js/src/config/swagger.js.ejs +6 -6
- package/templates/mvc/js/src/controllers/userController.js.ejs +246 -105
- package/templates/mvc/js/src/controllers/userController.spec.js.ejs +481 -209
- package/templates/mvc/js/src/errors/ApiError.js +14 -14
- package/templates/mvc/js/src/errors/BadRequestError.js +11 -10
- package/templates/mvc/js/src/errors/BadRequestError.spec.js.ejs +22 -21
- package/templates/mvc/js/src/errors/NotFoundError.js +11 -10
- package/templates/mvc/js/src/errors/NotFoundError.spec.js.ejs +22 -21
- package/templates/mvc/js/src/graphql/context.js.ejs +7 -7
- package/templates/mvc/js/src/graphql/context.spec.js.ejs +29 -29
- package/templates/mvc/js/src/graphql/index.js.ejs +5 -5
- package/templates/mvc/js/src/graphql/resolvers/index.js.ejs +6 -6
- package/templates/mvc/js/src/graphql/resolvers/user.resolvers.js.ejs +25 -19
- package/templates/mvc/js/src/graphql/resolvers/user.resolvers.spec.js.ejs +64 -47
- package/templates/mvc/js/src/graphql/typeDefs/index.js.ejs +6 -6
- package/templates/mvc/js/src/graphql/typeDefs/user.types.js.ejs +19 -17
- package/templates/mvc/js/src/index.js.ejs +136 -136
- package/templates/mvc/js/src/routes/api.js +10 -8
- package/templates/mvc/js/src/routes/api.spec.js.ejs +41 -36
- package/templates/mvc/js/src/utils/errorMessages.js +14 -0
- package/templates/mvc/js/src/utils/errorMiddleware.js +29 -29
- package/templates/mvc/js/src/utils/httpCodes.js +9 -9
- package/templates/mvc/js/src/utils/logger.js +40 -40
- package/templates/mvc/js/src/utils/logger.spec.js.ejs +63 -63
- package/templates/mvc/ts/src/config/env.ts.ejs +45 -45
- package/templates/mvc/ts/src/config/swagger.ts.ejs +6 -6
- package/templates/mvc/ts/src/controllers/userController.spec.ts.ejs +481 -203
- package/templates/mvc/ts/src/controllers/userController.ts.ejs +248 -107
- package/templates/mvc/ts/src/errors/ApiError.ts +15 -15
- package/templates/mvc/ts/src/errors/BadRequestError.spec.ts.ejs +22 -21
- package/templates/mvc/ts/src/errors/BadRequestError.ts +9 -8
- package/templates/mvc/ts/src/errors/NotFoundError.spec.ts.ejs +27 -21
- package/templates/mvc/ts/src/errors/NotFoundError.ts +9 -8
- package/templates/mvc/ts/src/graphql/context.spec.ts.ejs +30 -30
- package/templates/mvc/ts/src/graphql/context.ts.ejs +12 -12
- package/templates/mvc/ts/src/graphql/index.ts.ejs +3 -3
- package/templates/mvc/ts/src/graphql/resolvers/index.ts.ejs +4 -4
- package/templates/mvc/ts/src/graphql/resolvers/user.resolvers.spec.ts.ejs +68 -51
- package/templates/mvc/ts/src/graphql/resolvers/user.resolvers.ts.ejs +29 -21
- package/templates/mvc/ts/src/graphql/typeDefs/index.ts.ejs +4 -4
- package/templates/mvc/ts/src/graphql/typeDefs/user.types.ts.ejs +17 -15
- package/templates/mvc/ts/src/index.ts.ejs +156 -153
- package/templates/mvc/ts/src/routes/api.spec.ts.ejs +59 -40
- package/templates/mvc/ts/src/routes/api.ts +12 -10
- package/templates/mvc/ts/src/utils/errorMessages.ts +12 -0
- package/templates/mvc/ts/src/utils/errorMiddleware.ts.ejs +27 -27
- package/templates/mvc/ts/src/utils/httpCodes.ts +7 -7
- package/templates/mvc/ts/src/utils/logger.spec.ts.ejs +63 -63
- package/templates/mvc/ts/src/utils/logger.ts +36 -36
- package/templates/clean-architecture/ts/src/infrastructure/repositories/UserRepository.ts.ejs +0 -37
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--primary-color: #4f46e5;
|
|
3
|
-
--primary-hover: #4338ca;
|
|
4
|
-
--bg-color: #f9fafb;
|
|
5
|
-
--card-bg: #ffffff;
|
|
6
|
-
--text-main: #111827;
|
|
7
|
-
--text-muted: #6b7280;
|
|
8
|
-
--success-color: #10b981;
|
|
9
|
-
--border-color: #e5e7eb;
|
|
10
|
-
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
11
|
-
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
body {
|
|
15
|
-
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
|
16
|
-
background-color: var(--bg-color);
|
|
17
|
-
color: var(--text-main);
|
|
18
|
-
margin: 0;
|
|
19
|
-
padding: 0;
|
|
20
|
-
line-height: 1.5;
|
|
21
|
-
display: flex;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
min-height: 100vh;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.container {
|
|
27
|
-
width: 100%;
|
|
28
|
-
max-width: 800px;
|
|
29
|
-
padding: 40px 20px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.header {
|
|
33
|
-
text-align: center;
|
|
34
|
-
margin-bottom: 40px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.logo {
|
|
38
|
-
font-size: 3rem;
|
|
39
|
-
margin-bottom: 10px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
h1 {
|
|
43
|
-
font-size: 2.5rem;
|
|
44
|
-
font-weight: 800;
|
|
45
|
-
color: var(--text-main);
|
|
46
|
-
margin: 0 0 10px 0;
|
|
47
|
-
letter-spacing: -0.025em;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.subtitle {
|
|
51
|
-
color: var(--text-muted);
|
|
52
|
-
font-size: 1.125rem;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.card-grid {
|
|
56
|
-
display: grid;
|
|
57
|
-
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
|
58
|
-
gap: 20px;
|
|
59
|
-
margin-bottom: 40px;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.card {
|
|
63
|
-
background: var(--card-bg);
|
|
64
|
-
padding: 24px;
|
|
65
|
-
border-radius: 12px;
|
|
66
|
-
box-shadow: var(--shadow-sm);
|
|
67
|
-
border: 1px solid var(--border-color);
|
|
68
|
-
transition: transform 0.2s, box-shadow 0.2s;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.card:hover {
|
|
72
|
-
transform: translateY(-2px);
|
|
73
|
-
box-shadow: var(--shadow-md);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.card h3 {
|
|
77
|
-
margin-top: 0;
|
|
78
|
-
font-size: 0.875rem;
|
|
79
|
-
text-transform: uppercase;
|
|
80
|
-
letter-spacing: 0.05em;
|
|
81
|
-
color: var(--text-muted);
|
|
82
|
-
font-weight: 600;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.card p {
|
|
86
|
-
font-size: 1.25rem;
|
|
87
|
-
font-weight: 600;
|
|
88
|
-
color: var(--text-main);
|
|
89
|
-
margin: 5px 0 0 0;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.status-card {
|
|
93
|
-
background: var(--card-bg);
|
|
94
|
-
border-radius: 12px;
|
|
95
|
-
padding: 24px;
|
|
96
|
-
box-shadow: var(--shadow-md);
|
|
97
|
-
border-left: 6px solid var(--success-color);
|
|
98
|
-
display: flex;
|
|
99
|
-
align-items: center;
|
|
100
|
-
gap: 20px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.status-icon {
|
|
104
|
-
background: #d1fae5;
|
|
105
|
-
color: var(--success-color);
|
|
106
|
-
width: 48px;
|
|
107
|
-
height: 48px;
|
|
108
|
-
border-radius: 50%;
|
|
109
|
-
display: flex;
|
|
110
|
-
align-items: center;
|
|
111
|
-
justify-content: center;
|
|
112
|
-
font-size: 1.5rem;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.status-content h3 {
|
|
116
|
-
margin: 0;
|
|
117
|
-
font-size: 1.25rem;
|
|
118
|
-
font-weight: 700;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.status-content p {
|
|
122
|
-
margin: 5px 0 0 0;
|
|
123
|
-
color: var(--text-muted);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.action-btn {
|
|
127
|
-
display: inline-block;
|
|
128
|
-
margin-top: 40px;
|
|
129
|
-
background-color: var(--primary-color);
|
|
130
|
-
color: white;
|
|
131
|
-
padding: 12px 24px;
|
|
132
|
-
border-radius: 8px;
|
|
133
|
-
text-decoration: none;
|
|
134
|
-
font-weight: 600;
|
|
135
|
-
transition: background-color 0.2s;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.action-btn:hover {
|
|
139
|
-
background-color: var(--primary-hover);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
footer {
|
|
143
|
-
margin-top: 60px;
|
|
144
|
-
text-align: center;
|
|
145
|
-
color: var(--text-muted);
|
|
146
|
-
font-size: 0.875rem;
|
|
147
|
-
}
|
|
1
|
+
:root {
|
|
2
|
+
--primary-color: #4f46e5;
|
|
3
|
+
--primary-hover: #4338ca;
|
|
4
|
+
--bg-color: #f9fafb;
|
|
5
|
+
--card-bg: #ffffff;
|
|
6
|
+
--text-main: #111827;
|
|
7
|
+
--text-muted: #6b7280;
|
|
8
|
+
--success-color: #10b981;
|
|
9
|
+
--border-color: #e5e7eb;
|
|
10
|
+
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
11
|
+
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
|
16
|
+
background-color: var(--bg-color);
|
|
17
|
+
color: var(--text-main);
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
line-height: 1.5;
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
min-height: 100vh;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.container {
|
|
27
|
+
width: 100%;
|
|
28
|
+
max-width: 800px;
|
|
29
|
+
padding: 40px 20px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.header {
|
|
33
|
+
text-align: center;
|
|
34
|
+
margin-bottom: 40px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.logo {
|
|
38
|
+
font-size: 3rem;
|
|
39
|
+
margin-bottom: 10px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
h1 {
|
|
43
|
+
font-size: 2.5rem;
|
|
44
|
+
font-weight: 800;
|
|
45
|
+
color: var(--text-main);
|
|
46
|
+
margin: 0 0 10px 0;
|
|
47
|
+
letter-spacing: -0.025em;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.subtitle {
|
|
51
|
+
color: var(--text-muted);
|
|
52
|
+
font-size: 1.125rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.card-grid {
|
|
56
|
+
display: grid;
|
|
57
|
+
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
|
58
|
+
gap: 20px;
|
|
59
|
+
margin-bottom: 40px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.card {
|
|
63
|
+
background: var(--card-bg);
|
|
64
|
+
padding: 24px;
|
|
65
|
+
border-radius: 12px;
|
|
66
|
+
box-shadow: var(--shadow-sm);
|
|
67
|
+
border: 1px solid var(--border-color);
|
|
68
|
+
transition: transform 0.2s, box-shadow 0.2s;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.card:hover {
|
|
72
|
+
transform: translateY(-2px);
|
|
73
|
+
box-shadow: var(--shadow-md);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.card h3 {
|
|
77
|
+
margin-top: 0;
|
|
78
|
+
font-size: 0.875rem;
|
|
79
|
+
text-transform: uppercase;
|
|
80
|
+
letter-spacing: 0.05em;
|
|
81
|
+
color: var(--text-muted);
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.card p {
|
|
86
|
+
font-size: 1.25rem;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
color: var(--text-main);
|
|
89
|
+
margin: 5px 0 0 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.status-card {
|
|
93
|
+
background: var(--card-bg);
|
|
94
|
+
border-radius: 12px;
|
|
95
|
+
padding: 24px;
|
|
96
|
+
box-shadow: var(--shadow-md);
|
|
97
|
+
border-left: 6px solid var(--success-color);
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
gap: 20px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.status-icon {
|
|
104
|
+
background: #d1fae5;
|
|
105
|
+
color: var(--success-color);
|
|
106
|
+
width: 48px;
|
|
107
|
+
height: 48px;
|
|
108
|
+
border-radius: 50%;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
font-size: 1.5rem;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.status-content h3 {
|
|
116
|
+
margin: 0;
|
|
117
|
+
font-size: 1.25rem;
|
|
118
|
+
font-weight: 700;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.status-content p {
|
|
122
|
+
margin: 5px 0 0 0;
|
|
123
|
+
color: var(--text-muted);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.action-btn {
|
|
127
|
+
display: inline-block;
|
|
128
|
+
margin-top: 40px;
|
|
129
|
+
background-color: var(--primary-color);
|
|
130
|
+
color: white;
|
|
131
|
+
padding: 12px 24px;
|
|
132
|
+
border-radius: 8px;
|
|
133
|
+
text-decoration: none;
|
|
134
|
+
font-weight: 600;
|
|
135
|
+
transition: background-color 0.2s;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.action-btn:hover {
|
|
139
|
+
background-color: var(--primary-hover);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
footer {
|
|
143
|
+
margin-top: 60px;
|
|
144
|
+
text-align: center;
|
|
145
|
+
color: var(--text-muted);
|
|
146
|
+
font-size: 0.875rem;
|
|
147
|
+
}
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
const { execSync } = require('child_process');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
// Set a specific port for E2E tests to avoid collisions with local development
|
|
6
|
-
process.env.PORT = '3001';
|
|
7
|
-
const TEST_PORT = process.env.PORT;
|
|
8
|
-
|
|
9
|
-
const execute = (command) => {
|
|
10
|
-
console.log(`\n> ${command}`);
|
|
11
|
-
// Run commands from the project root instead of the scripts folder
|
|
12
|
-
execSync(command, { stdio: 'inherit', cwd: path.resolve(__dirname, '../') });
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
let composeCmd = 'docker-compose';
|
|
16
|
-
try {
|
|
17
|
-
execSync('docker compose version', { stdio: 'ignore' });
|
|
18
|
-
composeCmd = 'docker compose';
|
|
19
|
-
} catch (e) {
|
|
20
|
-
// fallback to docker-compose
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let currentProcessStartedDocker = false;
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
let isAlreadyUp = false;
|
|
27
|
-
try {
|
|
28
|
-
// Silently check if the endpoint is already live (1.5-second timeout)
|
|
29
|
-
execSync(`npx wait-on http-get://127.0.0.1:${TEST_PORT}/health -t 1500`, {
|
|
30
|
-
stdio: 'ignore',
|
|
31
|
-
cwd: path.resolve(__dirname, '../')
|
|
32
|
-
});
|
|
33
|
-
isAlreadyUp = true;
|
|
34
|
-
} catch (e) {
|
|
35
|
-
isAlreadyUp = false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (isAlreadyUp) {
|
|
39
|
-
console.log('Infrastructure is already running! Skipping Docker spin-up...');
|
|
40
|
-
} else {
|
|
41
|
-
console.log(`Starting Docker Compose infrastructure using '${composeCmd}'...`);
|
|
42
|
-
execute(`${composeCmd} up -d --build`);
|
|
43
|
-
currentProcessStartedDocker = true;
|
|
44
|
-
|
|
45
|
-
console.log('Waiting for application healthcheck to turn green (120s timeout)...');
|
|
46
|
-
// Using wait-on to poll the universal /health endpoint injected into all architectures
|
|
47
|
-
execute(`npx wait-on http-get://127.0.0.1:${TEST_PORT}/health -t 120000`);
|
|
48
|
-
console.log('Infrastructure is healthy!');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
console.log('Running E2E tests...');
|
|
52
|
-
execute('npm run test:e2e:run');
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error('E2E tests failed or infrastructure did not boot in time.');
|
|
55
|
-
process.exitCode = 1;
|
|
56
|
-
} finally {
|
|
57
|
-
if (currentProcessStartedDocker) {
|
|
58
|
-
console.log('Tearing down isolated Docker Compose infrastructure...');
|
|
59
|
-
execute(`${composeCmd} down`);
|
|
60
|
-
} else {
|
|
61
|
-
console.log('Leaving preexisting infrastructure running.');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
// Set a specific port for E2E tests to avoid collisions with local development
|
|
6
|
+
process.env.PORT = '3001';
|
|
7
|
+
const TEST_PORT = process.env.PORT;
|
|
8
|
+
|
|
9
|
+
const execute = (command) => {
|
|
10
|
+
console.log(`\n> ${command}`);
|
|
11
|
+
// Run commands from the project root instead of the scripts folder
|
|
12
|
+
execSync(command, { stdio: 'inherit', cwd: path.resolve(__dirname, '../') });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
let composeCmd = 'docker-compose';
|
|
16
|
+
try {
|
|
17
|
+
execSync('docker compose version', { stdio: 'ignore' });
|
|
18
|
+
composeCmd = 'docker compose';
|
|
19
|
+
} catch (e) {
|
|
20
|
+
// fallback to docker-compose
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let currentProcessStartedDocker = false;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
let isAlreadyUp = false;
|
|
27
|
+
try {
|
|
28
|
+
// Silently check if the endpoint is already live (1.5-second timeout)
|
|
29
|
+
execSync(`npx wait-on http-get://127.0.0.1:${TEST_PORT}/health -t 1500`, {
|
|
30
|
+
stdio: 'ignore',
|
|
31
|
+
cwd: path.resolve(__dirname, '../')
|
|
32
|
+
});
|
|
33
|
+
isAlreadyUp = true;
|
|
34
|
+
} catch (e) {
|
|
35
|
+
isAlreadyUp = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (isAlreadyUp) {
|
|
39
|
+
console.log('Infrastructure is already running! Skipping Docker spin-up...');
|
|
40
|
+
} else {
|
|
41
|
+
console.log(`Starting Docker Compose infrastructure using '${composeCmd}'...`);
|
|
42
|
+
execute(`${composeCmd} up -d --build`);
|
|
43
|
+
currentProcessStartedDocker = true;
|
|
44
|
+
|
|
45
|
+
console.log('Waiting for application healthcheck to turn green (120s timeout)...');
|
|
46
|
+
// Using wait-on to poll the universal /health endpoint injected into all architectures
|
|
47
|
+
execute(`npx wait-on http-get://127.0.0.1:${TEST_PORT}/health -t 120000`);
|
|
48
|
+
console.log('Infrastructure is healthy!');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log('Running E2E tests...');
|
|
52
|
+
execute('npm run test:e2e:run');
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error('E2E tests failed or infrastructure did not boot in time.');
|
|
55
|
+
process.exitCode = 1;
|
|
56
|
+
} finally {
|
|
57
|
+
if (currentProcessStartedDocker) {
|
|
58
|
+
console.log('Tearing down isolated Docker Compose infrastructure...');
|
|
59
|
+
execute(`${composeCmd} down`);
|
|
60
|
+
} else {
|
|
61
|
+
console.log('Leaving preexisting infrastructure running.');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,61 +1,65 @@
|
|
|
1
|
-
<%_
|
|
2
|
-
let loggerPath = './logger';
|
|
3
|
-
let dbPath = '../config/database';
|
|
4
|
-
let redisPath = '../config/redisClient';
|
|
5
|
-
let kafkaPath = '../services/kafkaService';
|
|
6
|
-
|
|
7
|
-
if (architecture === 'Clean Architecture') {
|
|
8
|
-
loggerPath = '../infrastructure/log/logger';
|
|
9
|
-
dbPath = '../infrastructure/database/database';
|
|
10
|
-
redisPath = '../infrastructure/caching/redisClient';
|
|
11
|
-
kafkaPath = '../infrastructure/messaging/kafkaClient';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const logger = require('<%- loggerPath %>');
|
|
15
|
-
|
|
16
|
-
const setupGracefulShutdown = (server) => {
|
|
17
|
-
const gracefulShutdown = async (signal) => {
|
|
18
|
-
logger.info(`Received ${signal}. Shutting down gracefully...`);
|
|
19
|
-
server.close(async () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<%_
|
|
28
|
-
const
|
|
29
|
-
await
|
|
30
|
-
logger.info('
|
|
31
|
-
<%_ } -%>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<%_
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<%_
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
|
|
1
|
+
<%_
|
|
2
|
+
let loggerPath = './logger';
|
|
3
|
+
let dbPath = '../config/database';
|
|
4
|
+
let redisPath = '../config/redisClient';
|
|
5
|
+
let kafkaPath = '../services/kafkaService';
|
|
6
|
+
|
|
7
|
+
if (architecture === 'Clean Architecture') {
|
|
8
|
+
loggerPath = '../infrastructure/log/logger';
|
|
9
|
+
dbPath = '../infrastructure/database/database';
|
|
10
|
+
redisPath = '../infrastructure/caching/redisClient';
|
|
11
|
+
kafkaPath = '../infrastructure/messaging/kafkaClient';
|
|
12
|
+
}
|
|
13
|
+
-%>
|
|
14
|
+
const logger = require('<%- loggerPath %>');
|
|
15
|
+
|
|
16
|
+
const setupGracefulShutdown = (server) => {
|
|
17
|
+
const gracefulShutdown = async (signal) => {
|
|
18
|
+
logger.info(`Received ${signal}. Shutting down gracefully...`);
|
|
19
|
+
server.close(async (err) => {
|
|
20
|
+
if (err) {
|
|
21
|
+
logger.error('Error closing HTTP server:', err);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
logger.info('HTTP server closed.');
|
|
25
|
+
try {
|
|
26
|
+
<%_ if (database !== 'None') { -%>
|
|
27
|
+
<%_ if (database === 'MongoDB') { -%>
|
|
28
|
+
const mongoose = require('mongoose');
|
|
29
|
+
await mongoose.connection.close(false);
|
|
30
|
+
logger.info('MongoDB connection closed.');
|
|
31
|
+
<%_ } else { -%>
|
|
32
|
+
const sequelize = require('<%- dbPath %>');
|
|
33
|
+
await sequelize.close();
|
|
34
|
+
logger.info('Database connection closed.');
|
|
35
|
+
<%_ } -%>
|
|
36
|
+
<%_ } -%>
|
|
37
|
+
<%_ if (caching === 'Redis') { -%>
|
|
38
|
+
const redisService = require('<%- redisPath %>');
|
|
39
|
+
await redisService.quit();
|
|
40
|
+
logger.info('Redis connection closed.');
|
|
41
|
+
<%_ } -%>
|
|
42
|
+
<%_ if (communication === 'Kafka') { -%>
|
|
43
|
+
const { disconnectKafka } = require('<%- kafkaPath %>');
|
|
44
|
+
await disconnectKafka();
|
|
45
|
+
logger.info('Kafka connection closed.');
|
|
46
|
+
<%_ } -%>
|
|
47
|
+
logger.info('Graceful shutdown fully completed.');
|
|
48
|
+
process.exit(0);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
logger.error('Error during shutdown:', err);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
logger.error('Could not close connections in time, forcefully shutting down');
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}, 15000);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
|
|
62
|
+
process.on('SIGINT', () => gracefulShutdown('SIGINT'));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
module.exports = setupGracefulShutdown;
|