kybernus 1.0.1 → 1.1.3

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 (300) hide show
  1. package/README.md +48 -263
  2. package/dist/cli/commands/init.d.ts.map +1 -1
  3. package/dist/cli/commands/init.js +5 -1
  4. package/dist/cli/commands/init.js.map +1 -1
  5. package/dist/cli/commands/upgrade.js +2 -2
  6. package/dist/cli/prompts/wizard.d.ts +14 -1
  7. package/dist/cli/prompts/wizard.d.ts.map +1 -1
  8. package/dist/cli/prompts/wizard.js +45 -9
  9. package/dist/cli/prompts/wizard.js.map +1 -1
  10. package/dist/core/generator/project.d.ts +8 -0
  11. package/dist/core/generator/project.d.ts.map +1 -1
  12. package/dist/core/generator/project.js +41 -2
  13. package/dist/core/generator/project.js.map +1 -1
  14. package/dist/core/templates/downloader.d.ts +32 -0
  15. package/dist/core/templates/downloader.d.ts.map +1 -0
  16. package/dist/core/templates/downloader.js +95 -0
  17. package/dist/core/templates/downloader.js.map +1 -0
  18. package/dist/models/config.d.ts +1 -0
  19. package/dist/models/config.d.ts.map +1 -1
  20. package/package.json +6 -2
  21. package/templates/java-spring/pro/clean/.github/workflows/ci-cd.yml.hbs +0 -88
  22. package/templates/java-spring/pro/clean/Dockerfile.hbs +0 -45
  23. package/templates/java-spring/pro/clean/README.md.hbs +0 -31
  24. package/templates/java-spring/pro/clean/docker-compose.yml.hbs +0 -18
  25. package/templates/java-spring/pro/clean/infra/main.tf.hbs +0 -83
  26. package/templates/java-spring/pro/clean/infra/modules/ecs/main.tf.hbs +0 -54
  27. package/templates/java-spring/pro/clean/infra/modules/rds/main.tf.hbs +0 -88
  28. package/templates/java-spring/pro/clean/infra/modules/vpc/main.tf.hbs +0 -107
  29. package/templates/java-spring/pro/clean/pom.xml.hbs +0 -130
  30. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/application/service/AuthService.java.hbs +0 -36
  31. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/entity/User.java.hbs +0 -77
  32. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/repository/UserRepository.java.hbs +0 -15
  33. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/usecase/LoginUserUseCase.java.hbs +0 -36
  34. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/usecase/RegisterUserUseCase.java.hbs +0 -46
  35. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/persistence/InMemoryUserRepository.java.hbs +0 -41
  36. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/security/SecurityAdapters.java.hbs +0 -53
  37. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/web/controller/AuthController.java.hbs +0 -41
  38. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +0 -14
  39. package/templates/java-spring/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +0 -88
  40. package/templates/java-spring/pro/hexagonal/Dockerfile.hbs +0 -45
  41. package/templates/java-spring/pro/hexagonal/README.md.hbs +0 -38
  42. package/templates/java-spring/pro/hexagonal/docker-compose.yml.hbs +0 -18
  43. package/templates/java-spring/pro/hexagonal/infra/main.tf.hbs +0 -83
  44. package/templates/java-spring/pro/hexagonal/infra/modules/ecs/main.tf.hbs +0 -54
  45. package/templates/java-spring/pro/hexagonal/infra/modules/rds/main.tf.hbs +0 -88
  46. package/templates/java-spring/pro/hexagonal/infra/modules/vpc/main.tf.hbs +0 -107
  47. package/templates/java-spring/pro/hexagonal/pom.xml.hbs +0 -130
  48. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/application/service/AuthService.java.hbs +0 -36
  49. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/entity/User.java.hbs +0 -77
  50. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/repository/UserRepository.java.hbs +0 -15
  51. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/usecase/LoginUserUseCase.java.hbs +0 -36
  52. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/usecase/RegisterUserUseCase.java.hbs +0 -46
  53. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/persistence/InMemoryUserRepository.java.hbs +0 -41
  54. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/security/SecurityAdapters.java.hbs +0 -53
  55. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/web/controller/AuthController.java.hbs +0 -41
  56. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +0 -14
  57. package/templates/java-spring/pro/mvc/.github/workflows/ci-cd.yml.hbs +0 -88
  58. package/templates/java-spring/pro/mvc/Dockerfile.hbs +0 -45
  59. package/templates/java-spring/pro/mvc/README.md.hbs +0 -116
  60. package/templates/java-spring/pro/mvc/docker-compose.yml.hbs +0 -18
  61. package/templates/java-spring/pro/mvc/infra/main.tf.hbs +0 -83
  62. package/templates/java-spring/pro/mvc/infra/modules/ecs/main.tf.hbs +0 -54
  63. package/templates/java-spring/pro/mvc/infra/modules/rds/main.tf.hbs +0 -88
  64. package/templates/java-spring/pro/mvc/infra/modules/vpc/main.tf.hbs +0 -107
  65. package/templates/java-spring/pro/mvc/pom.xml.hbs +0 -130
  66. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/GlobalExceptionHandler.java.hbs +0 -39
  67. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/SecurityConfig.java.hbs +0 -44
  68. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/WebConfig.java.hbs +0 -30
  69. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/AuthController.java.hbs +0 -69
  70. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/HealthController.java.hbs +0 -30
  71. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/PaymentsController.java.hbs +0 -49
  72. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/dto/AuthRequest.java.hbs +0 -3
  73. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/dto/AuthResponse.java.hbs +0 -3
  74. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/model/.gitkeep +0 -0
  75. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/repository/.gitkeep +0 -0
  76. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/security/JwtAuthenticationFilter.java.hbs +0 -56
  77. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/security/JwtTokenProvider.java.hbs +0 -59
  78. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/service/.gitkeep +0 -0
  79. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/service/StripeService.java.hbs +0 -67
  80. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +0 -13
  81. package/templates/java-spring/pro/mvc/src/main/resources/application.yml.hbs +0 -32
  82. package/templates/java-spring/pro/mvc/src/test/java/{{packagePath}}/{{projectNamePascalCase}}ApplicationTests.java.hbs +0 -13
  83. package/templates/java-spring/pro/mvc/src/test/resources/application.yml.hbs +0 -10
  84. package/templates/java-spring/pro/mvc/template.json +0 -14
  85. package/templates/nestjs/free/mvc/README.md.hbs +0 -28
  86. package/templates/nestjs/free/mvc/package.json.hbs +0 -29
  87. package/templates/nestjs/free/mvc/src/app.module.ts.hbs +0 -13
  88. package/templates/nestjs/free/mvc/src/controllers/health.controller.ts.hbs +0 -9
  89. package/templates/nestjs/free/mvc/src/controllers/items.controller.ts.hbs +0 -32
  90. package/templates/nestjs/free/mvc/src/main.ts.hbs +0 -17
  91. package/templates/nestjs/free/mvc/src/models/create-item.dto.ts.hbs +0 -10
  92. package/templates/nestjs/free/mvc/src/models/item.model.ts.hbs +0 -6
  93. package/templates/nestjs/free/mvc/src/modules/items.module.ts.hbs +0 -9
  94. package/templates/nestjs/free/mvc/src/services/items.service.ts.hbs +0 -32
  95. package/templates/nestjs/free/mvc/tsconfig.json.hbs +0 -21
  96. package/templates/nestjs/pro/clean/.env.example.hbs +0 -19
  97. package/templates/nestjs/pro/clean/.github/workflows/ci-cd.yml.hbs +0 -88
  98. package/templates/nestjs/pro/clean/Dockerfile.hbs +0 -45
  99. package/templates/nestjs/pro/clean/infra/main.tf.hbs +0 -83
  100. package/templates/nestjs/pro/clean/infra/modules/ecs/main.tf.hbs +0 -54
  101. package/templates/nestjs/pro/clean/infra/modules/rds/main.tf.hbs +0 -88
  102. package/templates/nestjs/pro/clean/infra/modules/vpc/main.tf.hbs +0 -107
  103. package/templates/nestjs/pro/clean/package.json.hbs +0 -37
  104. package/templates/nestjs/pro/clean/src/auth.module.ts.hbs +0 -17
  105. package/templates/nestjs/pro/clean/src/domain/entities/user.entity.ts.hbs +0 -12
  106. package/templates/nestjs/pro/clean/src/domain/repositories/user.repository.ts.hbs +0 -6
  107. package/templates/nestjs/pro/clean/src/domain/use-cases/register.use-case.ts.hbs +0 -18
  108. package/templates/nestjs/pro/clean/src/infrastructure/database/in-memory.repository.ts.hbs +0 -17
  109. package/templates/nestjs/pro/clean/src/infrastructure/http/auth.controller.ts.hbs +0 -16
  110. package/templates/nestjs/pro/clean/tsconfig.json.hbs +0 -21
  111. package/templates/nestjs/pro/hexagonal/.env.example.hbs +0 -19
  112. package/templates/nestjs/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +0 -88
  113. package/templates/nestjs/pro/hexagonal/Dockerfile.hbs +0 -45
  114. package/templates/nestjs/pro/hexagonal/infra/main.tf.hbs +0 -83
  115. package/templates/nestjs/pro/hexagonal/infra/modules/ecs/main.tf.hbs +0 -54
  116. package/templates/nestjs/pro/hexagonal/infra/modules/rds/main.tf.hbs +0 -88
  117. package/templates/nestjs/pro/hexagonal/infra/modules/vpc/main.tf.hbs +0 -107
  118. package/templates/nestjs/pro/hexagonal/package.json.hbs +0 -37
  119. package/templates/nestjs/pro/hexagonal/src/adapters/inbound/http.adapter.ts.hbs +0 -12
  120. package/templates/nestjs/pro/hexagonal/src/adapters/outbound/persistence.adapter.ts.hbs +0 -13
  121. package/templates/nestjs/pro/hexagonal/src/auth.module.ts.hbs +0 -19
  122. package/templates/nestjs/pro/hexagonal/src/core/auth.service.ts.hbs +0 -16
  123. package/templates/nestjs/pro/hexagonal/src/core/domain/user.entity.ts.hbs +0 -8
  124. package/templates/nestjs/pro/hexagonal/src/core/ports/ports.ts.hbs +0 -9
  125. package/templates/nestjs/pro/hexagonal/tsconfig.json.hbs +0 -21
  126. package/templates/nestjs/pro/mvc/.env.example.hbs +0 -19
  127. package/templates/nestjs/pro/mvc/.github/workflows/ci-cd.yml.hbs +0 -88
  128. package/templates/nestjs/pro/mvc/Dockerfile.hbs +0 -45
  129. package/templates/nestjs/pro/mvc/README.md.hbs +0 -28
  130. package/templates/nestjs/pro/mvc/infra/main.tf.hbs +0 -83
  131. package/templates/nestjs/pro/mvc/infra/modules/ecs/main.tf.hbs +0 -54
  132. package/templates/nestjs/pro/mvc/infra/modules/rds/main.tf.hbs +0 -88
  133. package/templates/nestjs/pro/mvc/infra/modules/vpc/main.tf.hbs +0 -107
  134. package/templates/nestjs/pro/mvc/package.json.hbs +0 -37
  135. package/templates/nestjs/pro/mvc/src/app.module.ts.hbs +0 -17
  136. package/templates/nestjs/pro/mvc/src/auth/auth.controller.ts.hbs +0 -35
  137. package/templates/nestjs/pro/mvc/src/auth/auth.module.ts.hbs +0 -25
  138. package/templates/nestjs/pro/mvc/src/auth/auth.service.ts.hbs +0 -55
  139. package/templates/nestjs/pro/mvc/src/auth/jwt.strategy.ts.hbs +0 -19
  140. package/templates/nestjs/pro/mvc/src/controllers/health.controller.ts.hbs +0 -9
  141. package/templates/nestjs/pro/mvc/src/controllers/items.controller.ts.hbs +0 -32
  142. package/templates/nestjs/pro/mvc/src/main.ts.hbs +0 -17
  143. package/templates/nestjs/pro/mvc/src/models/create-item.dto.ts.hbs +0 -10
  144. package/templates/nestjs/pro/mvc/src/models/item.model.ts.hbs +0 -6
  145. package/templates/nestjs/pro/mvc/src/modules/items.module.ts.hbs +0 -9
  146. package/templates/nestjs/pro/mvc/src/payments/payments.controller.ts.hbs +0 -26
  147. package/templates/nestjs/pro/mvc/src/payments/payments.module.ts.hbs +0 -11
  148. package/templates/nestjs/pro/mvc/src/payments/payments.service.ts.hbs +0 -43
  149. package/templates/nestjs/pro/mvc/src/services/items.service.ts.hbs +0 -32
  150. package/templates/nestjs/pro/mvc/tsconfig.json.hbs +0 -21
  151. package/templates/nextjs/pro/default/.env.example.hbs +0 -20
  152. package/templates/nextjs/pro/default/.github/workflows/ci-cd.yml.hbs +0 -88
  153. package/templates/nextjs/pro/default/Dockerfile.hbs +0 -45
  154. package/templates/nextjs/pro/default/README.md.hbs +0 -96
  155. package/templates/nextjs/pro/default/docker-compose.yml.hbs +0 -18
  156. package/templates/nextjs/pro/default/infra/main.tf.hbs +0 -83
  157. package/templates/nextjs/pro/default/infra/modules/ecs/main.tf.hbs +0 -54
  158. package/templates/nextjs/pro/default/infra/modules/rds/main.tf.hbs +0 -88
  159. package/templates/nextjs/pro/default/infra/modules/vpc/main.tf.hbs +0 -107
  160. package/templates/nextjs/pro/default/next.config.js.hbs +0 -4
  161. package/templates/nextjs/pro/default/package.json.hbs +0 -34
  162. package/templates/nextjs/pro/default/postcss.config.js.hbs +0 -6
  163. package/templates/nextjs/pro/default/prisma/schema.prisma.hbs +0 -18
  164. package/templates/nextjs/pro/default/public/.gitkeep +0 -0
  165. package/templates/nextjs/pro/default/src/app/api/auth/[...nextauth]/route.ts.hbs +0 -61
  166. package/templates/nextjs/pro/default/src/app/api/checkout/route.ts.hbs +0 -30
  167. package/templates/nextjs/pro/default/src/app/api/health/route.ts.hbs +0 -9
  168. package/templates/nextjs/pro/default/src/app/api/webhook/route.ts.hbs +0 -51
  169. package/templates/nextjs/pro/default/src/app/dashboard/page.tsx.hbs +0 -52
  170. package/templates/nextjs/pro/default/src/app/globals.css.hbs +0 -3
  171. package/templates/nextjs/pro/default/src/app/layout.tsx.hbs +0 -22
  172. package/templates/nextjs/pro/default/src/app/page.tsx.hbs +0 -38
  173. package/templates/nextjs/pro/default/src/components/.gitkeep +0 -0
  174. package/templates/nextjs/pro/default/src/components/AuthButton.tsx.hbs +0 -34
  175. package/templates/nextjs/pro/default/src/components/Providers.tsx.hbs +0 -7
  176. package/templates/nextjs/pro/default/src/lib/prisma.ts.hbs +0 -13
  177. package/templates/nextjs/pro/default/src/proxy.ts.hbs +0 -22
  178. package/templates/nextjs/pro/default/tailwind.config.ts.hbs +0 -15
  179. package/templates/nextjs/pro/default/template.json +0 -18
  180. package/templates/nextjs/pro/default/tsconfig.json.hbs +0 -40
  181. package/templates/nodejs-express/pro/clean/.env.example.hbs +0 -19
  182. package/templates/nodejs-express/pro/clean/.github/workflows/ci-cd.yml.hbs +0 -88
  183. package/templates/nodejs-express/pro/clean/Dockerfile.hbs +0 -45
  184. package/templates/nodejs-express/pro/clean/README.md.hbs +0 -41
  185. package/templates/nodejs-express/pro/clean/docker-compose.yml.hbs +0 -18
  186. package/templates/nodejs-express/pro/clean/infra/main.tf.hbs +0 -83
  187. package/templates/nodejs-express/pro/clean/infra/modules/ecs/main.tf.hbs +0 -54
  188. package/templates/nodejs-express/pro/clean/infra/modules/rds/main.tf.hbs +0 -88
  189. package/templates/nodejs-express/pro/clean/infra/modules/vpc/main.tf.hbs +0 -107
  190. package/templates/nodejs-express/pro/clean/package.json.hbs +0 -55
  191. package/templates/nodejs-express/pro/clean/src/application/services/AuthService.ts.hbs +0 -66
  192. package/templates/nodejs-express/pro/clean/src/domain/entities/User.ts.hbs +0 -38
  193. package/templates/nodejs-express/pro/clean/src/domain/repositories/IUserRepository.ts.hbs +0 -13
  194. package/templates/nodejs-express/pro/clean/src/domain/usecases/LoginUserUseCase.ts.hbs +0 -39
  195. package/templates/nodejs-express/pro/clean/src/domain/usecases/RegisterUserUseCase.ts.hbs +0 -51
  196. package/templates/nodejs-express/pro/clean/src/index.ts.hbs +0 -40
  197. package/templates/nodejs-express/pro/clean/src/infrastructure/database/InMemoryUserRepository.ts.hbs +0 -46
  198. package/templates/nodejs-express/pro/clean/src/infrastructure/http/controllers/AuthController.ts.hbs +0 -45
  199. package/templates/nodejs-express/pro/clean/src/infrastructure/http/middlewares/AuthMiddleware.ts.hbs +0 -27
  200. package/templates/nodejs-express/pro/clean/src/infrastructure/providers/PasswordHasher.ts.hbs +0 -14
  201. package/templates/nodejs-express/pro/clean/src/infrastructure/providers/TokenGenerator.ts.hbs +0 -25
  202. package/templates/nodejs-express/pro/clean/tsconfig.json.hbs +0 -27
  203. package/templates/nodejs-express/pro/hexagonal/.env.example.hbs +0 -19
  204. package/templates/nodejs-express/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +0 -88
  205. package/templates/nodejs-express/pro/hexagonal/Dockerfile.hbs +0 -45
  206. package/templates/nodejs-express/pro/hexagonal/README.md.hbs +0 -42
  207. package/templates/nodejs-express/pro/hexagonal/docker-compose.yml.hbs +0 -18
  208. package/templates/nodejs-express/pro/hexagonal/infra/main.tf.hbs +0 -83
  209. package/templates/nodejs-express/pro/hexagonal/infra/modules/ecs/main.tf.hbs +0 -54
  210. package/templates/nodejs-express/pro/hexagonal/infra/modules/rds/main.tf.hbs +0 -88
  211. package/templates/nodejs-express/pro/hexagonal/infra/modules/vpc/main.tf.hbs +0 -107
  212. package/templates/nodejs-express/pro/hexagonal/package.json.hbs +0 -55
  213. package/templates/nodejs-express/pro/hexagonal/src/adapters/inbound/http/AuthController.ts.hbs +0 -48
  214. package/templates/nodejs-express/pro/hexagonal/src/adapters/outbound/SecurityAdapters.ts.hbs +0 -31
  215. package/templates/nodejs-express/pro/hexagonal/src/adapters/outbound/persistence/InMemoryUserAdapter.ts.hbs +0 -38
  216. package/templates/nodejs-express/pro/hexagonal/src/core/AuthService.ts.hbs +0 -51
  217. package/templates/nodejs-express/pro/hexagonal/src/core/domain/entities/User.ts.hbs +0 -28
  218. package/templates/nodejs-express/pro/hexagonal/src/core/ports/inbound/IAuthPort.ts.hbs +0 -11
  219. package/templates/nodejs-express/pro/hexagonal/src/core/ports/outbound/ISecurityPorts.ts.hbs +0 -15
  220. package/templates/nodejs-express/pro/hexagonal/src/core/ports/outbound/IUserRepositoryPort.ts.hbs +0 -13
  221. package/templates/nodejs-express/pro/hexagonal/src/index.ts.hbs +0 -41
  222. package/templates/nodejs-express/pro/hexagonal/tsconfig.json.hbs +0 -27
  223. package/templates/nodejs-express/pro/mvc/.env.example.hbs +0 -19
  224. package/templates/nodejs-express/pro/mvc/.github/workflows/ci-cd.yml.hbs +0 -88
  225. package/templates/nodejs-express/pro/mvc/Dockerfile.hbs +0 -45
  226. package/templates/nodejs-express/pro/mvc/README.md.hbs +0 -85
  227. package/templates/nodejs-express/pro/mvc/docker-compose.yml.hbs +0 -18
  228. package/templates/nodejs-express/pro/mvc/infra/main.tf.hbs +0 -83
  229. package/templates/nodejs-express/pro/mvc/infra/modules/ecs/main.tf.hbs +0 -54
  230. package/templates/nodejs-express/pro/mvc/infra/modules/rds/main.tf.hbs +0 -88
  231. package/templates/nodejs-express/pro/mvc/infra/modules/vpc/main.tf.hbs +0 -107
  232. package/templates/nodejs-express/pro/mvc/package.json.hbs +0 -55
  233. package/templates/nodejs-express/pro/mvc/src/app.ts.hbs +0 -34
  234. package/templates/nodejs-express/pro/mvc/src/config/database.ts.hbs +0 -10
  235. package/templates/nodejs-express/pro/mvc/src/controllers/auth.controller.ts.hbs +0 -91
  236. package/templates/nodejs-express/pro/mvc/src/controllers/healthController.ts.hbs +0 -20
  237. package/templates/nodejs-express/pro/mvc/src/controllers/payments.controller.ts.hbs +0 -72
  238. package/templates/nodejs-express/pro/mvc/src/index.ts.hbs +0 -12
  239. package/templates/nodejs-express/pro/mvc/src/middleware/errorHandler.ts.hbs +0 -22
  240. package/templates/nodejs-express/pro/mvc/src/middlewares/auth.middleware.ts.hbs +0 -31
  241. package/templates/nodejs-express/pro/mvc/src/models/.gitkeep +0 -0
  242. package/templates/nodejs-express/pro/mvc/src/routes/index.ts.hbs +0 -14
  243. package/templates/nodejs-express/pro/mvc/src/services/.gitkeep +0 -0
  244. package/templates/nodejs-express/pro/mvc/src/services/stripe.service.ts.hbs +0 -102
  245. package/templates/nodejs-express/pro/mvc/template.json +0 -18
  246. package/templates/nodejs-express/pro/mvc/tsconfig.json.hbs +0 -27
  247. package/templates/python-fastapi/free/mvc/README.md.hbs +0 -41
  248. package/templates/python-fastapi/free/mvc/app/controllers/health.py.hbs +0 -7
  249. package/templates/python-fastapi/free/mvc/app/controllers/items.py.hbs +0 -27
  250. package/templates/python-fastapi/free/mvc/app/main.py.hbs +0 -26
  251. package/templates/python-fastapi/free/mvc/app/models/item.py.hbs +0 -11
  252. package/templates/python-fastapi/free/mvc/app/schemas/item.py.hbs +0 -17
  253. package/templates/python-fastapi/free/mvc/app/services/item_service.py.hbs +0 -33
  254. package/templates/python-fastapi/free/mvc/requirements.txt.hbs +0 -4
  255. package/templates/python-fastapi/pro/clean/.env.example.hbs +0 -17
  256. package/templates/python-fastapi/pro/clean/.github/workflows/ci-cd.yml.hbs +0 -88
  257. package/templates/python-fastapi/pro/clean/Dockerfile.hbs +0 -20
  258. package/templates/python-fastapi/pro/clean/app/domain/entities/user.py.hbs +0 -23
  259. package/templates/python-fastapi/pro/clean/app/domain/repositories/user_repository.py.hbs +0 -22
  260. package/templates/python-fastapi/pro/clean/app/domain/usecases/register_user.py.hbs +0 -30
  261. package/templates/python-fastapi/pro/clean/app/infrastructure/database/in_memory_repository.py.hbs +0 -26
  262. package/templates/python-fastapi/pro/clean/app/infrastructure/http/auth_controller.py.hbs +0 -26
  263. package/templates/python-fastapi/pro/clean/app/infrastructure/security/adapters.py.hbs +0 -23
  264. package/templates/python-fastapi/pro/clean/app/main.py.hbs +0 -10
  265. package/templates/python-fastapi/pro/clean/infra/main.tf.hbs +0 -83
  266. package/templates/python-fastapi/pro/clean/infra/modules/ecs/main.tf.hbs +0 -54
  267. package/templates/python-fastapi/pro/clean/infra/modules/rds/main.tf.hbs +0 -88
  268. package/templates/python-fastapi/pro/clean/infra/modules/vpc/main.tf.hbs +0 -107
  269. package/templates/python-fastapi/pro/clean/requirements.txt.hbs +0 -12
  270. package/templates/python-fastapi/pro/hexagonal/.env.example.hbs +0 -17
  271. package/templates/python-fastapi/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +0 -88
  272. package/templates/python-fastapi/pro/hexagonal/Dockerfile.hbs +0 -20
  273. package/templates/python-fastapi/pro/hexagonal/app/adapters/inbound/http_adapter.py.hbs +0 -29
  274. package/templates/python-fastapi/pro/hexagonal/app/core/domain/user.py.hbs +0 -15
  275. package/templates/python-fastapi/pro/hexagonal/app/core/ports.py.hbs +0 -25
  276. package/templates/python-fastapi/pro/hexagonal/app/core/service.py.hbs +0 -28
  277. package/templates/python-fastapi/pro/hexagonal/app/main.py.hbs +0 -22
  278. package/templates/python-fastapi/pro/hexagonal/infra/main.tf.hbs +0 -83
  279. package/templates/python-fastapi/pro/hexagonal/infra/modules/ecs/main.tf.hbs +0 -54
  280. package/templates/python-fastapi/pro/hexagonal/infra/modules/rds/main.tf.hbs +0 -88
  281. package/templates/python-fastapi/pro/hexagonal/infra/modules/vpc/main.tf.hbs +0 -107
  282. package/templates/python-fastapi/pro/hexagonal/requirements.txt.hbs +0 -12
  283. package/templates/python-fastapi/pro/mvc/.env.example.hbs +0 -17
  284. package/templates/python-fastapi/pro/mvc/.github/workflows/ci-cd.yml.hbs +0 -88
  285. package/templates/python-fastapi/pro/mvc/Dockerfile.hbs +0 -20
  286. package/templates/python-fastapi/pro/mvc/README.md.hbs +0 -41
  287. package/templates/python-fastapi/pro/mvc/app/controllers/auth.py.hbs +0 -46
  288. package/templates/python-fastapi/pro/mvc/app/controllers/health.py.hbs +0 -7
  289. package/templates/python-fastapi/pro/mvc/app/controllers/items.py.hbs +0 -21
  290. package/templates/python-fastapi/pro/mvc/app/controllers/payments.py.hbs +0 -32
  291. package/templates/python-fastapi/pro/mvc/app/main.py.hbs +0 -20
  292. package/templates/python-fastapi/pro/mvc/app/middleware/security.py.hbs +0 -39
  293. package/templates/python-fastapi/pro/mvc/app/models/item.py.hbs +0 -11
  294. package/templates/python-fastapi/pro/mvc/app/schemas/item.py.hbs +0 -16
  295. package/templates/python-fastapi/pro/mvc/app/services/item_service.py.hbs +0 -24
  296. package/templates/python-fastapi/pro/mvc/infra/main.tf.hbs +0 -83
  297. package/templates/python-fastapi/pro/mvc/infra/modules/ecs/main.tf.hbs +0 -54
  298. package/templates/python-fastapi/pro/mvc/infra/modules/rds/main.tf.hbs +0 -88
  299. package/templates/python-fastapi/pro/mvc/infra/modules/vpc/main.tf.hbs +0 -107
  300. package/templates/python-fastapi/pro/mvc/requirements.txt.hbs +0 -12
@@ -1,83 +0,0 @@
1
- # Terraform Infrastructure for {{projectName}}
2
-
3
- terraform {
4
- required_version = ">= 1.0.0"
5
-
6
- required_providers {
7
- aws = {
8
- source = "hashicorp/aws"
9
- version = "~> 5.0"
10
- }
11
- }
12
-
13
- # Uncomment for remote state (recommended for production)
14
- # backend "s3" {
15
- # bucket = "your-terraform-state-bucket"
16
- # key = "{{projectNameKebabCase}}/terraform.tfstate"
17
- # region = "us-east-1"
18
- # encrypt = true
19
- # dynamodb_table = "terraform-locks"
20
- # }
21
- }
22
-
23
- provider "aws" {
24
- region = var.aws_region
25
- }
26
-
27
- # Variables
28
- variable "aws_region" {
29
- description = "AWS region"
30
- type = string
31
- default = "us-east-1"
32
- }
33
-
34
- variable "environment" {
35
- description = "Environment name (dev, staging, prod)"
36
- type = string
37
- default = "dev"
38
- }
39
-
40
- variable "app_name" {
41
- description = "Application name"
42
- type = string
43
- default = "{{projectNameKebabCase}}"
44
- }
45
-
46
- # VPC
47
- module "vpc" {
48
- source = "./modules/vpc"
49
-
50
- app_name = var.app_name
51
- environment = var.environment
52
- }
53
-
54
- # ECS Cluster
55
- module "ecs" {
56
- source = "./modules/ecs"
57
-
58
- app_name = var.app_name
59
- environment = var.environment
60
- vpc_id = module.vpc.vpc_id
61
- subnet_ids = module.vpc.private_subnet_ids
62
- }
63
-
64
- # RDS PostgreSQL
65
- module "rds" {
66
- source = "./modules/rds"
67
-
68
- app_name = var.app_name
69
- environment = var.environment
70
- vpc_id = module.vpc.vpc_id
71
- subnet_ids = module.vpc.private_subnet_ids
72
- security_group_id = module.vpc.db_security_group_id
73
- }
74
-
75
- # Outputs
76
- output "ecs_cluster_name" {
77
- value = module.ecs.cluster_name
78
- }
79
-
80
- output "rds_endpoint" {
81
- value = module.rds.endpoint
82
- sensitive = true
83
- }
@@ -1,54 +0,0 @@
1
- # ECS Module
2
-
3
- variable "app_name" {
4
- type = string
5
- }
6
-
7
- variable "environment" {
8
- type = string
9
- }
10
-
11
- variable "vpc_id" {
12
- type = string
13
- }
14
-
15
- variable "subnet_ids" {
16
- type = list(string)
17
- }
18
-
19
- # ECS Cluster
20
- resource "aws_ecs_cluster" "main" {
21
- name = "${var.app_name}-${var.environment}"
22
-
23
- setting {
24
- name = "containerInsights"
25
- value = "enabled"
26
- }
27
-
28
- tags = {
29
- Name = "${var.app_name}-${var.environment}"
30
- Environment = var.environment
31
- }
32
- }
33
-
34
- # ECS Capacity Provider
35
- resource "aws_ecs_cluster_capacity_providers" "main" {
36
- cluster_name = aws_ecs_cluster.main.name
37
-
38
- capacity_providers = ["FARGATE", "FARGATE_SPOT"]
39
-
40
- default_capacity_provider_strategy {
41
- base = 1
42
- weight = 100
43
- capacity_provider = "FARGATE"
44
- }
45
- }
46
-
47
- # Outputs
48
- output "cluster_name" {
49
- value = aws_ecs_cluster.main.name
50
- }
51
-
52
- output "cluster_arn" {
53
- value = aws_ecs_cluster.main.arn
54
- }
@@ -1,88 +0,0 @@
1
- # RDS Module
2
-
3
- variable "app_name" {
4
- type = string
5
- }
6
-
7
- variable "environment" {
8
- type = string
9
- }
10
-
11
- variable "vpc_id" {
12
- type = string
13
- }
14
-
15
- variable "subnet_ids" {
16
- type = list(string)
17
- }
18
-
19
- variable "security_group_id" {
20
- type = string
21
- }
22
-
23
- # DB Subnet Group
24
- resource "aws_db_subnet_group" "main" {
25
- name = "${var.app_name}-${var.environment}"
26
- subnet_ids = var.subnet_ids
27
-
28
- tags = {
29
- Name = "${var.app_name}-${var.environment}"
30
- Environment = var.environment
31
- }
32
- }
33
-
34
- # RDS PostgreSQL Instance
35
- resource "aws_db_instance" "main" {
36
- identifier = "${var.app_name}-${var.environment}"
37
-
38
- engine = "postgres"
39
- engine_version = "16"
40
- instance_class = "db.t3.micro"
41
-
42
- allocated_storage = 20
43
- max_allocated_storage = 100
44
- storage_type = "gp3"
45
- storage_encrypted = true
46
-
47
- db_name = replace(var.app_name, "-", "_")
48
- username = "postgres"
49
- password = random_password.db_password.result
50
-
51
- db_subnet_group_name = aws_db_subnet_group.main.name
52
- vpc_security_group_ids = [var.security_group_id]
53
-
54
- backup_retention_period = 7
55
- skip_final_snapshot = var.environment != "prod"
56
-
57
- tags = {
58
- Name = "${var.app_name}-${var.environment}"
59
- Environment = var.environment
60
- }
61
- }
62
-
63
- # Random password for DB
64
- resource "random_password" "db_password" {
65
- length = 32
66
- special = false
67
- }
68
-
69
- # Store password in SSM
70
- resource "aws_ssm_parameter" "db_password" {
71
- name = "/${var.app_name}/${var.environment}/db-password"
72
- description = "Database password for ${var.app_name}"
73
- type = "SecureString"
74
- value = random_password.db_password.result
75
-
76
- tags = {
77
- Environment = var.environment
78
- }
79
- }
80
-
81
- # Outputs
82
- output "endpoint" {
83
- value = aws_db_instance.main.endpoint
84
- }
85
-
86
- output "db_name" {
87
- value = aws_db_instance.main.db_name
88
- }
@@ -1,107 +0,0 @@
1
- # VPC Module
2
-
3
- variable "app_name" {
4
- type = string
5
- }
6
-
7
- variable "environment" {
8
- type = string
9
- }
10
-
11
- # VPC
12
- resource "aws_vpc" "main" {
13
- cidr_block = "10.0.0.0/16"
14
- enable_dns_hostnames = true
15
- enable_dns_support = true
16
-
17
- tags = {
18
- Name = "${var.app_name}-${var.environment}-vpc"
19
- Environment = var.environment
20
- }
21
- }
22
-
23
- # Public Subnets
24
- resource "aws_subnet" "public" {
25
- count = 2
26
- vpc_id = aws_vpc.main.id
27
- cidr_block = "10.0.${count.index + 1}.0/24"
28
- availability_zone = data.aws_availability_zones.available.names[count.index]
29
-
30
- map_public_ip_on_launch = true
31
-
32
- tags = {
33
- Name = "${var.app_name}-${var.environment}-public-${count.index + 1}"
34
- Environment = var.environment
35
- }
36
- }
37
-
38
- # Private Subnets
39
- resource "aws_subnet" "private" {
40
- count = 2
41
- vpc_id = aws_vpc.main.id
42
- cidr_block = "10.0.${count.index + 10}.0/24"
43
- availability_zone = data.aws_availability_zones.available.names[count.index]
44
-
45
- tags = {
46
- Name = "${var.app_name}-${var.environment}-private-${count.index + 1}"
47
- Environment = var.environment
48
- }
49
- }
50
-
51
- # Internet Gateway
52
- resource "aws_internet_gateway" "main" {
53
- vpc_id = aws_vpc.main.id
54
-
55
- tags = {
56
- Name = "${var.app_name}-${var.environment}-igw"
57
- Environment = var.environment
58
- }
59
- }
60
-
61
- # Data source for AZs
62
- data "aws_availability_zones" "available" {
63
- state = "available"
64
- }
65
-
66
- # Security Group for DB
67
- resource "aws_security_group" "db" {
68
- name = "${var.app_name}-${var.environment}-db-sg"
69
- description = "Security group for database"
70
- vpc_id = aws_vpc.main.id
71
-
72
- ingress {
73
- from_port = 5432
74
- to_port = 5432
75
- protocol = "tcp"
76
- cidr_blocks = ["10.0.0.0/16"]
77
- }
78
-
79
- egress {
80
- from_port = 0
81
- to_port = 0
82
- protocol = "-1"
83
- cidr_blocks = ["0.0.0.0/0"]
84
- }
85
-
86
- tags = {
87
- Name = "${var.app_name}-${var.environment}-db-sg"
88
- Environment = var.environment
89
- }
90
- }
91
-
92
- # Outputs
93
- output "vpc_id" {
94
- value = aws_vpc.main.id
95
- }
96
-
97
- output "public_subnet_ids" {
98
- value = aws_subnet.public[*].id
99
- }
100
-
101
- output "private_subnet_ids" {
102
- value = aws_subnet.private[*].id
103
- }
104
-
105
- output "db_security_group_id" {
106
- value = aws_security_group.db.id
107
- }
@@ -1,55 +0,0 @@
1
- {
2
- "name": "{{kebabCase projectName}}",
3
- "version": "1.0.0",
4
- "description": "Generated by Kybernus CLI (Pro)",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "dev": "tsx watch src/index.ts",
8
- "build": "rimraf dist && tsc",
9
- "start": "node dist/index.js",
10
- "lint": "eslint src --ext .ts",
11
- "format": "prettier --write \"src/**/*.ts\"",
12
- "test": "jest"
13
- },
14
- "keywords": [
15
- "express",
16
- "api",
17
- "typescript",
18
- "mvc",
19
- "saas",
20
- "stripe",
21
- "auth"
22
- ],
23
- "author": "",
24
- "license": "MIT",
25
- "dependencies": {
26
- "express": "^4.18.2",
27
- "dotenv": "^16.4.5",
28
- "cors": "^2.8.5",
29
- "helmet": "^7.1.0",
30
- "morgan": "^1.10.0",
31
- "jsonwebtoken": "^9.0.2",
32
- "bcryptjs": "^2.4.3",
33
- "stripe": "^14.14.0"
34
- },
35
- "devDependencies": {
36
- "@types/express": "^4.17.21",
37
- "@types/node": "^20.11.19",
38
- "@types/cors": "^2.8.17",
39
- "@types/morgan": "^1.9.9",
40
- "@types/jsonwebtoken": "^9.0.5",
41
- "@types/bcryptjs": "^2.4.6",
42
- "typescript": "^5.3.3",
43
- "tsx": "^4.7.1",
44
- "rimraf": "^5.0.5",
45
- "eslint": "^8.56.0",
46
- "@typescript-eslint/eslint-plugin": "^6.21.0",
47
- "@typescript-eslint/parser": "^6.21.0",
48
- "prettier": "^3.2.5",
49
- "jest": "^29.7.0",
50
- "@types/jest": "^29.5.12"
51
- },
52
- "engines": {
53
- "node": ">=18.0.0"
54
- }
55
- }
@@ -1,34 +0,0 @@
1
- import express from 'express';
2
- import cors from 'cors';
3
- import helmet from 'helmet';
4
- import morgan from 'morgan';
5
- import routes from './routes';
6
- import authRoutes from './controllers/auth.controller';
7
- import paymentsRoutes from './controllers/payments.controller';
8
- import { errorHandler } from './middleware/errorHandler';
9
-
10
- const app = express();
11
-
12
- // Security middleware
13
- app.use(helmet());
14
-
15
- // CORS
16
- app.use(cors());
17
-
18
- // Logging
19
- app.use(morgan('dev'));
20
-
21
- // Body parsing (raw for Stripe webhooks)
22
- app.use('/api/payments/webhook', express.raw({ type: 'application/json' }));
23
- app.use(express.json());
24
- app.use(express.urlencoded({ extended: true }));
25
-
26
- // Routes
27
- app.use('/api', routes);
28
- app.use('/api/auth', authRoutes);
29
- app.use('/api/payments', paymentsRoutes);
30
-
31
- // Error handling (must be last)
32
- app.use(errorHandler);
33
-
34
- export default app;
@@ -1,10 +0,0 @@
1
- /**
2
- * Database configuration
3
- *
4
- * Add your database connection logic here
5
- * Example with PostgreSQL / Prisma / TypeORM
6
- */
7
-
8
- export const databaseConfig = {
9
- url: process.env.DATABASE_URL || 'postgresql://localhost:5432/{{snakeCase projectName}}',
10
- };
@@ -1,91 +0,0 @@
1
- import { Router, Request, Response } from 'express';
2
- import jwt from 'jsonwebtoken';
3
- import bcrypt from 'bcryptjs';
4
- import { authMiddleware, AuthRequest } from '../middlewares/auth.middleware';
5
-
6
- const router = Router();
7
-
8
- // In-memory users store (replace with database in production)
9
- const users: { id: string; email: string; password: string }[] = [];
10
-
11
- /**
12
- * @route POST /api/auth/register
13
- * @desc Register a new user
14
- */
15
- router.post('/register', async (req: Request, res: Response) => {
16
- try {
17
- const { email, password } = req.body;
18
-
19
- if (!email || !password) {
20
- return res.status(400).json({ error: 'Email and password are required' });
21
- }
22
-
23
- const existingUser = users.find(u => u.email === email);
24
- if (existingUser) {
25
- return res.status(400).json({ error: 'User already exists' });
26
- }
27
-
28
- const hashedPassword = await bcrypt.hash(password, 10);
29
- const user = {
30
- id: Date.now().toString(),
31
- email,
32
- password: hashedPassword,
33
- };
34
-
35
- users.push(user);
36
-
37
- const token = jwt.sign(
38
- { id: user.id, email: user.email },
39
- process.env.JWT_SECRET || 'your-secret-key',
40
- { expiresIn: '7d' }
41
- );
42
-
43
- res.status(201).json({ token, user: { id: user.id, email: user.email } });
44
- } catch (error) {
45
- res.status(500).json({ error: 'Internal server error' });
46
- }
47
- });
48
-
49
- /**
50
- * @route POST /api/auth/login
51
- * @desc Authenticate user and return token
52
- */
53
- router.post('/login', async (req: Request, res: Response) => {
54
- try {
55
- const { email, password } = req.body;
56
-
57
- if (!email || !password) {
58
- return res.status(400).json({ error: 'Email and password are required' });
59
- }
60
-
61
- const user = users.find(u => u.email === email);
62
- if (!user) {
63
- return res.status(401).json({ error: 'Invalid credentials' });
64
- }
65
-
66
- const isValidPassword = await bcrypt.compare(password, user.password);
67
- if (!isValidPassword) {
68
- return res.status(401).json({ error: 'Invalid credentials' });
69
- }
70
-
71
- const token = jwt.sign(
72
- { id: user.id, email: user.email },
73
- process.env.JWT_SECRET || 'your-secret-key',
74
- { expiresIn: '7d' }
75
- );
76
-
77
- res.json({ token, user: { id: user.id, email: user.email } });
78
- } catch (error) {
79
- res.status(500).json({ error: 'Internal server error' });
80
- }
81
- });
82
-
83
- /**
84
- * @route GET /api/auth/me
85
- * @desc Get current user info
86
- */
87
- router.get('/me', authMiddleware, (req: AuthRequest, res: Response) => {
88
- res.json({ user: req.user });
89
- });
90
-
91
- export default router;
@@ -1,20 +0,0 @@
1
- import { Request, Response } from 'express';
2
-
3
- /**
4
- * Health check controller
5
- */
6
- class HealthController {
7
- /**
8
- * Check server health
9
- */
10
- check(req: Request, res: Response) {
11
- res.status(200).json({
12
- status: 'ok',
13
- message: '{{pascalCase projectName}} API is running',
14
- timestamp: new Date().toISOString(),
15
- uptime: process.uptime(),
16
- });
17
- }
18
- }
19
-
20
- export default new HealthController();
@@ -1,72 +0,0 @@
1
- import { Router, Request, Response } from 'express';
2
- import { stripeService } from '../services/stripe.service';
3
- import { authMiddleware, AuthRequest } from '../middlewares/auth.middleware';
4
-
5
- const router = Router();
6
-
7
- /**
8
- * @route POST /api/payments/checkout
9
- * @desc Create a Stripe checkout session
10
- */
11
- router.post('/checkout', authMiddleware, async (req: AuthRequest, res: Response) => {
12
- try {
13
- const { priceId } = req.body;
14
-
15
- if (!priceId) {
16
- return res.status(400).json({ error: 'Price ID is required' });
17
- }
18
-
19
- const session = await stripeService.createCheckoutSession({
20
- priceId,
21
- successUrl: `${process.env.FRONTEND_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
22
- cancelUrl: `${process.env.FRONTEND_URL}/cancel`,
23
- });
24
-
25
- res.json({ url: session.url });
26
- } catch (error) {
27
- console.error('Checkout error:', error);
28
- res.status(500).json({ error: 'Failed to create checkout session' });
29
- }
30
- });
31
-
32
- /**
33
- * @route POST /api/payments/portal
34
- * @desc Create a Stripe customer portal session
35
- */
36
- router.post('/portal', authMiddleware, async (req: AuthRequest, res: Response) => {
37
- try {
38
- const { customerId } = req.body;
39
-
40
- if (!customerId) {
41
- return res.status(400).json({ error: 'Customer ID is required' });
42
- }
43
-
44
- const session = await stripeService.createPortalSession(
45
- customerId,
46
- `${process.env.FRONTEND_URL}/dashboard`
47
- );
48
-
49
- res.json({ url: session.url });
50
- } catch (error) {
51
- console.error('Portal error:', error);
52
- res.status(500).json({ error: 'Failed to create portal session' });
53
- }
54
- });
55
-
56
- /**
57
- * @route POST /api/payments/webhook
58
- * @desc Handle Stripe webhook events
59
- */
60
- router.post('/webhook', async (req: Request, res: Response) => {
61
- const signature = req.headers['stripe-signature'] as string;
62
-
63
- try {
64
- const result = await stripeService.handleWebhook(req.body, signature);
65
- res.json(result);
66
- } catch (error) {
67
- console.error('Webhook error:', error);
68
- res.status(400).json({ error: 'Webhook handling failed' });
69
- }
70
- });
71
-
72
- export default router;
@@ -1,12 +0,0 @@
1
- import app from './app';
2
- import dotenv from 'dotenv';
3
-
4
- dotenv.config();
5
-
6
- const PORT = process.env.PORT || 3000;
7
-
8
- app.listen(PORT, () => {
9
- console.log(`🚀 {{pascalCase projectName}} server running on port ${PORT}`);
10
- console.log(`📝 Environment: ${process.env.NODE_ENV || 'development'}`);
11
- console.log(`🔗 Health check: http://localhost:${PORT}/api/health`);
12
- });
@@ -1,22 +0,0 @@
1
- import { Request, Response, NextFunction } from 'express';
2
-
3
- /**
4
- * Global error handling middleware
5
- */
6
- export function errorHandler(
7
- err: Error,
8
- req: Request,
9
- res: Response,
10
- next: NextFunction
11
- ) {
12
- console.error('❌ Error:', err);
13
-
14
- const statusCode = res.statusCode !== 200 ? res.statusCode : 500;
15
-
16
- res.status(statusCode).json({
17
- error: {
18
- message: err.message,
19
- ...(process.env.NODE_ENV === 'development' && { stack: err.stack }),
20
- },
21
- });
22
- }
@@ -1,31 +0,0 @@
1
- import jwt from 'jsonwebtoken';
2
- import { Request, Response, NextFunction } from 'express';
3
-
4
- export interface AuthRequest extends Request {
5
- user?: {
6
- id: string;
7
- email: string;
8
- };
9
- }
10
-
11
- export function authMiddleware(req: AuthRequest, res: Response, next: NextFunction) {
12
- const authHeader = req.headers.authorization;
13
-
14
- if (!authHeader || !authHeader.startsWith('Bearer ')) {
15
- return res.status(401).json({ error: 'Token not provided' });
16
- }
17
-
18
- const token = authHeader.split(' ')[1];
19
-
20
- try {
21
- const decoded = jwt.verify(token, process.env.JWT_SECRET || 'your-secret-key') as {
22
- id: string;
23
- email: string;
24
- };
25
-
26
- req.user = decoded;
27
- next();
28
- } catch (error) {
29
- return res.status(401).json({ error: 'Invalid token' });
30
- }
31
- }