kybernus 1.0.0

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 (407) hide show
  1. package/README.md +321 -0
  2. package/dist/cli/commands/init.d.ts +12 -0
  3. package/dist/cli/commands/init.d.ts.map +1 -0
  4. package/dist/cli/commands/init.js +71 -0
  5. package/dist/cli/commands/init.js.map +1 -0
  6. package/dist/cli/commands/login.d.ts +6 -0
  7. package/dist/cli/commands/login.d.ts.map +1 -0
  8. package/dist/cli/commands/login.js +42 -0
  9. package/dist/cli/commands/login.js.map +1 -0
  10. package/dist/cli/commands/logout.d.ts +2 -0
  11. package/dist/cli/commands/logout.d.ts.map +1 -0
  12. package/dist/cli/commands/logout.js +22 -0
  13. package/dist/cli/commands/logout.js.map +1 -0
  14. package/dist/cli/commands/register.d.ts +2 -0
  15. package/dist/cli/commands/register.d.ts.map +1 -0
  16. package/dist/cli/commands/register.js +69 -0
  17. package/dist/cli/commands/register.js.map +1 -0
  18. package/dist/cli/commands/status.d.ts +2 -0
  19. package/dist/cli/commands/status.d.ts.map +1 -0
  20. package/dist/cli/commands/status.js +46 -0
  21. package/dist/cli/commands/status.js.map +1 -0
  22. package/dist/cli/commands/upgrade.d.ts +2 -0
  23. package/dist/cli/commands/upgrade.d.ts.map +1 -0
  24. package/dist/cli/commands/upgrade.js +62 -0
  25. package/dist/cli/commands/upgrade.js.map +1 -0
  26. package/dist/cli/prompts/wizard.d.ts +3 -0
  27. package/dist/cli/prompts/wizard.d.ts.map +1 -0
  28. package/dist/cli/prompts/wizard.js +121 -0
  29. package/dist/cli/prompts/wizard.js.map +1 -0
  30. package/dist/cli/services/AnalyticsClient.d.ts +11 -0
  31. package/dist/cli/services/AnalyticsClient.d.ts.map +1 -0
  32. package/dist/cli/services/AnalyticsClient.js +32 -0
  33. package/dist/cli/services/AnalyticsClient.js.map +1 -0
  34. package/dist/core/ai/documentation-generator.d.ts +36 -0
  35. package/dist/core/ai/documentation-generator.d.ts.map +1 -0
  36. package/dist/core/ai/documentation-generator.js +111 -0
  37. package/dist/core/ai/documentation-generator.js.map +1 -0
  38. package/dist/core/ai/gemini-service.d.ts +17 -0
  39. package/dist/core/ai/gemini-service.d.ts.map +1 -0
  40. package/dist/core/ai/gemini-service.js +68 -0
  41. package/dist/core/ai/gemini-service.js.map +1 -0
  42. package/dist/core/ai/prompts/documentation-prompts.d.ts +17 -0
  43. package/dist/core/ai/prompts/documentation-prompts.d.ts.map +1 -0
  44. package/dist/core/ai/prompts/documentation-prompts.js +195 -0
  45. package/dist/core/ai/prompts/documentation-prompts.js.map +1 -0
  46. package/dist/core/auth/license-validator.d.ts +33 -0
  47. package/dist/core/auth/license-validator.d.ts.map +1 -0
  48. package/dist/core/auth/license-validator.js +81 -0
  49. package/dist/core/auth/license-validator.js.map +1 -0
  50. package/dist/core/config/config-manager.d.ts +24 -0
  51. package/dist/core/config/config-manager.d.ts.map +1 -0
  52. package/dist/core/config/config-manager.js +56 -0
  53. package/dist/core/config/config-manager.js.map +1 -0
  54. package/dist/core/generator/context-builder.d.ts +10 -0
  55. package/dist/core/generator/context-builder.d.ts.map +1 -0
  56. package/dist/core/generator/context-builder.js +43 -0
  57. package/dist/core/generator/context-builder.js.map +1 -0
  58. package/dist/core/generator/project.d.ts +42 -0
  59. package/dist/core/generator/project.d.ts.map +1 -0
  60. package/dist/core/generator/project.js +278 -0
  61. package/dist/core/generator/project.js.map +1 -0
  62. package/dist/core/templates/engine.d.ts +25 -0
  63. package/dist/core/templates/engine.d.ts.map +1 -0
  64. package/dist/core/templates/engine.js +78 -0
  65. package/dist/core/templates/engine.js.map +1 -0
  66. package/dist/core/templates/helpers.d.ts +6 -0
  67. package/dist/core/templates/helpers.d.ts.map +1 -0
  68. package/dist/core/templates/helpers.js +63 -0
  69. package/dist/core/templates/helpers.js.map +1 -0
  70. package/dist/index.d.ts +3 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +48 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/models/config.d.ts +38 -0
  75. package/dist/models/config.d.ts.map +1 -0
  76. package/dist/models/config.js +2 -0
  77. package/dist/models/config.js.map +1 -0
  78. package/package.json +66 -0
  79. package/templates/java-spring/free/mvc/.gitignore.hbs +39 -0
  80. package/templates/java-spring/free/mvc/README.md.hbs +116 -0
  81. package/templates/java-spring/free/mvc/docker-compose.yml.hbs +18 -0
  82. package/templates/java-spring/free/mvc/pom.xml.hbs +92 -0
  83. package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/config/GlobalExceptionHandler.java.hbs +39 -0
  84. package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/config/WebConfig.java.hbs +30 -0
  85. package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/controller/HealthController.java.hbs +30 -0
  86. package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/model/.gitkeep +0 -0
  87. package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/repository/.gitkeep +0 -0
  88. package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/service/.gitkeep +0 -0
  89. package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +13 -0
  90. package/templates/java-spring/free/mvc/src/main/resources/application.yml.hbs +32 -0
  91. package/templates/java-spring/free/mvc/src/test/java/{{packagePath}}/{{projectNamePascalCase}}ApplicationTests.java.hbs +13 -0
  92. package/templates/java-spring/free/mvc/src/test/resources/application.yml.hbs +10 -0
  93. package/templates/java-spring/free/mvc/template.json +14 -0
  94. package/templates/java-spring/pro/clean/.github/workflows/ci-cd.yml.hbs +88 -0
  95. package/templates/java-spring/pro/clean/Dockerfile.hbs +45 -0
  96. package/templates/java-spring/pro/clean/README.md.hbs +31 -0
  97. package/templates/java-spring/pro/clean/docker-compose.yml.hbs +18 -0
  98. package/templates/java-spring/pro/clean/infra/main.tf.hbs +83 -0
  99. package/templates/java-spring/pro/clean/infra/modules/ecs/main.tf.hbs +54 -0
  100. package/templates/java-spring/pro/clean/infra/modules/rds/main.tf.hbs +88 -0
  101. package/templates/java-spring/pro/clean/infra/modules/vpc/main.tf.hbs +107 -0
  102. package/templates/java-spring/pro/clean/pom.xml.hbs +130 -0
  103. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/application/service/AuthService.java.hbs +36 -0
  104. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/entity/User.java.hbs +77 -0
  105. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/repository/UserRepository.java.hbs +15 -0
  106. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/usecase/LoginUserUseCase.java.hbs +36 -0
  107. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/usecase/RegisterUserUseCase.java.hbs +46 -0
  108. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/persistence/InMemoryUserRepository.java.hbs +41 -0
  109. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/security/SecurityAdapters.java.hbs +53 -0
  110. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/web/controller/AuthController.java.hbs +41 -0
  111. package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +14 -0
  112. package/templates/java-spring/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +88 -0
  113. package/templates/java-spring/pro/hexagonal/Dockerfile.hbs +45 -0
  114. package/templates/java-spring/pro/hexagonal/README.md.hbs +38 -0
  115. package/templates/java-spring/pro/hexagonal/docker-compose.yml.hbs +18 -0
  116. package/templates/java-spring/pro/hexagonal/infra/main.tf.hbs +83 -0
  117. package/templates/java-spring/pro/hexagonal/infra/modules/ecs/main.tf.hbs +54 -0
  118. package/templates/java-spring/pro/hexagonal/infra/modules/rds/main.tf.hbs +88 -0
  119. package/templates/java-spring/pro/hexagonal/infra/modules/vpc/main.tf.hbs +107 -0
  120. package/templates/java-spring/pro/hexagonal/pom.xml.hbs +130 -0
  121. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/application/service/AuthService.java.hbs +36 -0
  122. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/entity/User.java.hbs +77 -0
  123. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/repository/UserRepository.java.hbs +15 -0
  124. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/usecase/LoginUserUseCase.java.hbs +36 -0
  125. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/usecase/RegisterUserUseCase.java.hbs +46 -0
  126. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/persistence/InMemoryUserRepository.java.hbs +41 -0
  127. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/security/SecurityAdapters.java.hbs +53 -0
  128. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/web/controller/AuthController.java.hbs +41 -0
  129. package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +14 -0
  130. package/templates/java-spring/pro/mvc/.github/workflows/ci-cd.yml.hbs +88 -0
  131. package/templates/java-spring/pro/mvc/Dockerfile.hbs +45 -0
  132. package/templates/java-spring/pro/mvc/README.md.hbs +116 -0
  133. package/templates/java-spring/pro/mvc/docker-compose.yml.hbs +18 -0
  134. package/templates/java-spring/pro/mvc/infra/main.tf.hbs +83 -0
  135. package/templates/java-spring/pro/mvc/infra/modules/ecs/main.tf.hbs +54 -0
  136. package/templates/java-spring/pro/mvc/infra/modules/rds/main.tf.hbs +88 -0
  137. package/templates/java-spring/pro/mvc/infra/modules/vpc/main.tf.hbs +107 -0
  138. package/templates/java-spring/pro/mvc/pom.xml.hbs +130 -0
  139. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/GlobalExceptionHandler.java.hbs +39 -0
  140. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/SecurityConfig.java.hbs +44 -0
  141. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/WebConfig.java.hbs +30 -0
  142. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/AuthController.java.hbs +69 -0
  143. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/HealthController.java.hbs +30 -0
  144. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/PaymentsController.java.hbs +49 -0
  145. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/dto/AuthRequest.java.hbs +3 -0
  146. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/dto/AuthResponse.java.hbs +3 -0
  147. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/model/.gitkeep +0 -0
  148. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/repository/.gitkeep +0 -0
  149. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/security/JwtAuthenticationFilter.java.hbs +56 -0
  150. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/security/JwtTokenProvider.java.hbs +59 -0
  151. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/service/.gitkeep +0 -0
  152. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/service/StripeService.java.hbs +67 -0
  153. package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +13 -0
  154. package/templates/java-spring/pro/mvc/src/main/resources/application.yml.hbs +32 -0
  155. package/templates/java-spring/pro/mvc/src/test/java/{{packagePath}}/{{projectNamePascalCase}}ApplicationTests.java.hbs +13 -0
  156. package/templates/java-spring/pro/mvc/src/test/resources/application.yml.hbs +10 -0
  157. package/templates/java-spring/pro/mvc/template.json +14 -0
  158. package/templates/nestjs/free/mvc/README.md.hbs +28 -0
  159. package/templates/nestjs/free/mvc/package.json.hbs +29 -0
  160. package/templates/nestjs/free/mvc/src/app.module.ts.hbs +13 -0
  161. package/templates/nestjs/free/mvc/src/controllers/health.controller.ts.hbs +9 -0
  162. package/templates/nestjs/free/mvc/src/controllers/items.controller.ts.hbs +32 -0
  163. package/templates/nestjs/free/mvc/src/main.ts.hbs +17 -0
  164. package/templates/nestjs/free/mvc/src/models/create-item.dto.ts.hbs +10 -0
  165. package/templates/nestjs/free/mvc/src/models/item.model.ts.hbs +6 -0
  166. package/templates/nestjs/free/mvc/src/modules/items.module.ts.hbs +9 -0
  167. package/templates/nestjs/free/mvc/src/services/items.service.ts.hbs +32 -0
  168. package/templates/nestjs/free/mvc/tsconfig.json.hbs +21 -0
  169. package/templates/nestjs/pro/clean/.env.example.hbs +19 -0
  170. package/templates/nestjs/pro/clean/.github/workflows/ci-cd.yml.hbs +88 -0
  171. package/templates/nestjs/pro/clean/Dockerfile.hbs +45 -0
  172. package/templates/nestjs/pro/clean/infra/main.tf.hbs +83 -0
  173. package/templates/nestjs/pro/clean/infra/modules/ecs/main.tf.hbs +54 -0
  174. package/templates/nestjs/pro/clean/infra/modules/rds/main.tf.hbs +88 -0
  175. package/templates/nestjs/pro/clean/infra/modules/vpc/main.tf.hbs +107 -0
  176. package/templates/nestjs/pro/clean/package.json.hbs +37 -0
  177. package/templates/nestjs/pro/clean/src/auth.module.ts.hbs +17 -0
  178. package/templates/nestjs/pro/clean/src/domain/entities/user.entity.ts.hbs +12 -0
  179. package/templates/nestjs/pro/clean/src/domain/repositories/user.repository.ts.hbs +6 -0
  180. package/templates/nestjs/pro/clean/src/domain/use-cases/register.use-case.ts.hbs +18 -0
  181. package/templates/nestjs/pro/clean/src/infrastructure/database/in-memory.repository.ts.hbs +17 -0
  182. package/templates/nestjs/pro/clean/src/infrastructure/http/auth.controller.ts.hbs +16 -0
  183. package/templates/nestjs/pro/clean/tsconfig.json.hbs +21 -0
  184. package/templates/nestjs/pro/hexagonal/.env.example.hbs +19 -0
  185. package/templates/nestjs/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +88 -0
  186. package/templates/nestjs/pro/hexagonal/Dockerfile.hbs +45 -0
  187. package/templates/nestjs/pro/hexagonal/infra/main.tf.hbs +83 -0
  188. package/templates/nestjs/pro/hexagonal/infra/modules/ecs/main.tf.hbs +54 -0
  189. package/templates/nestjs/pro/hexagonal/infra/modules/rds/main.tf.hbs +88 -0
  190. package/templates/nestjs/pro/hexagonal/infra/modules/vpc/main.tf.hbs +107 -0
  191. package/templates/nestjs/pro/hexagonal/package.json.hbs +37 -0
  192. package/templates/nestjs/pro/hexagonal/src/adapters/inbound/http.adapter.ts.hbs +12 -0
  193. package/templates/nestjs/pro/hexagonal/src/adapters/outbound/persistence.adapter.ts.hbs +13 -0
  194. package/templates/nestjs/pro/hexagonal/src/auth.module.ts.hbs +19 -0
  195. package/templates/nestjs/pro/hexagonal/src/core/auth.service.ts.hbs +16 -0
  196. package/templates/nestjs/pro/hexagonal/src/core/domain/user.entity.ts.hbs +8 -0
  197. package/templates/nestjs/pro/hexagonal/src/core/ports/ports.ts.hbs +9 -0
  198. package/templates/nestjs/pro/hexagonal/tsconfig.json.hbs +21 -0
  199. package/templates/nestjs/pro/mvc/.env.example.hbs +19 -0
  200. package/templates/nestjs/pro/mvc/.github/workflows/ci-cd.yml.hbs +88 -0
  201. package/templates/nestjs/pro/mvc/Dockerfile.hbs +45 -0
  202. package/templates/nestjs/pro/mvc/README.md.hbs +28 -0
  203. package/templates/nestjs/pro/mvc/infra/main.tf.hbs +83 -0
  204. package/templates/nestjs/pro/mvc/infra/modules/ecs/main.tf.hbs +54 -0
  205. package/templates/nestjs/pro/mvc/infra/modules/rds/main.tf.hbs +88 -0
  206. package/templates/nestjs/pro/mvc/infra/modules/vpc/main.tf.hbs +107 -0
  207. package/templates/nestjs/pro/mvc/package.json.hbs +37 -0
  208. package/templates/nestjs/pro/mvc/src/app.module.ts.hbs +17 -0
  209. package/templates/nestjs/pro/mvc/src/auth/auth.controller.ts.hbs +35 -0
  210. package/templates/nestjs/pro/mvc/src/auth/auth.module.ts.hbs +25 -0
  211. package/templates/nestjs/pro/mvc/src/auth/auth.service.ts.hbs +55 -0
  212. package/templates/nestjs/pro/mvc/src/auth/jwt.strategy.ts.hbs +19 -0
  213. package/templates/nestjs/pro/mvc/src/controllers/health.controller.ts.hbs +9 -0
  214. package/templates/nestjs/pro/mvc/src/controllers/items.controller.ts.hbs +32 -0
  215. package/templates/nestjs/pro/mvc/src/main.ts.hbs +17 -0
  216. package/templates/nestjs/pro/mvc/src/models/create-item.dto.ts.hbs +10 -0
  217. package/templates/nestjs/pro/mvc/src/models/item.model.ts.hbs +6 -0
  218. package/templates/nestjs/pro/mvc/src/modules/items.module.ts.hbs +9 -0
  219. package/templates/nestjs/pro/mvc/src/payments/payments.controller.ts.hbs +26 -0
  220. package/templates/nestjs/pro/mvc/src/payments/payments.module.ts.hbs +11 -0
  221. package/templates/nestjs/pro/mvc/src/payments/payments.service.ts.hbs +43 -0
  222. package/templates/nestjs/pro/mvc/src/services/items.service.ts.hbs +32 -0
  223. package/templates/nestjs/pro/mvc/tsconfig.json.hbs +21 -0
  224. package/templates/nextjs/free/default/.env.example.hbs +1 -0
  225. package/templates/nextjs/free/default/.gitignore.hbs +8 -0
  226. package/templates/nextjs/free/default/README.md.hbs +96 -0
  227. package/templates/nextjs/free/default/docker-compose.yml.hbs +18 -0
  228. package/templates/nextjs/free/default/next.config.js.hbs +4 -0
  229. package/templates/nextjs/free/default/package.json.hbs +32 -0
  230. package/templates/nextjs/free/default/postcss.config.js.hbs +6 -0
  231. package/templates/nextjs/free/default/prisma/schema.prisma.hbs +18 -0
  232. package/templates/nextjs/free/default/public/.gitkeep +0 -0
  233. package/templates/nextjs/free/default/src/app/api/health/route.ts.hbs +9 -0
  234. package/templates/nextjs/free/default/src/app/globals.css.hbs +3 -0
  235. package/templates/nextjs/free/default/src/app/layout.tsx.hbs +22 -0
  236. package/templates/nextjs/free/default/src/app/page.tsx.hbs +38 -0
  237. package/templates/nextjs/free/default/src/components/.gitkeep +0 -0
  238. package/templates/nextjs/free/default/src/lib/prisma.ts.hbs +13 -0
  239. package/templates/nextjs/free/default/src/proxy.ts.hbs +22 -0
  240. package/templates/nextjs/free/default/tailwind.config.ts.hbs +15 -0
  241. package/templates/nextjs/free/default/template.json +18 -0
  242. package/templates/nextjs/free/default/tsconfig.json.hbs +23 -0
  243. package/templates/nextjs/pro/default/.env.example.hbs +20 -0
  244. package/templates/nextjs/pro/default/.github/workflows/ci-cd.yml.hbs +88 -0
  245. package/templates/nextjs/pro/default/Dockerfile.hbs +45 -0
  246. package/templates/nextjs/pro/default/README.md.hbs +96 -0
  247. package/templates/nextjs/pro/default/docker-compose.yml.hbs +18 -0
  248. package/templates/nextjs/pro/default/infra/main.tf.hbs +83 -0
  249. package/templates/nextjs/pro/default/infra/modules/ecs/main.tf.hbs +54 -0
  250. package/templates/nextjs/pro/default/infra/modules/rds/main.tf.hbs +88 -0
  251. package/templates/nextjs/pro/default/infra/modules/vpc/main.tf.hbs +107 -0
  252. package/templates/nextjs/pro/default/next.config.js.hbs +4 -0
  253. package/templates/nextjs/pro/default/package.json.hbs +34 -0
  254. package/templates/nextjs/pro/default/postcss.config.js.hbs +6 -0
  255. package/templates/nextjs/pro/default/prisma/schema.prisma.hbs +18 -0
  256. package/templates/nextjs/pro/default/public/.gitkeep +0 -0
  257. package/templates/nextjs/pro/default/src/app/api/auth/[...nextauth]/route.ts.hbs +61 -0
  258. package/templates/nextjs/pro/default/src/app/api/checkout/route.ts.hbs +30 -0
  259. package/templates/nextjs/pro/default/src/app/api/health/route.ts.hbs +9 -0
  260. package/templates/nextjs/pro/default/src/app/api/webhook/route.ts.hbs +51 -0
  261. package/templates/nextjs/pro/default/src/app/dashboard/page.tsx.hbs +52 -0
  262. package/templates/nextjs/pro/default/src/app/globals.css.hbs +3 -0
  263. package/templates/nextjs/pro/default/src/app/layout.tsx.hbs +22 -0
  264. package/templates/nextjs/pro/default/src/app/page.tsx.hbs +38 -0
  265. package/templates/nextjs/pro/default/src/components/.gitkeep +0 -0
  266. package/templates/nextjs/pro/default/src/components/AuthButton.tsx.hbs +34 -0
  267. package/templates/nextjs/pro/default/src/components/Providers.tsx.hbs +7 -0
  268. package/templates/nextjs/pro/default/src/lib/prisma.ts.hbs +13 -0
  269. package/templates/nextjs/pro/default/src/proxy.ts.hbs +22 -0
  270. package/templates/nextjs/pro/default/tailwind.config.ts.hbs +15 -0
  271. package/templates/nextjs/pro/default/template.json +18 -0
  272. package/templates/nextjs/pro/default/tsconfig.json.hbs +40 -0
  273. package/templates/nodejs-express/free/mvc/.env.example.hbs +3 -0
  274. package/templates/nodejs-express/free/mvc/.gitignore.hbs +6 -0
  275. package/templates/nodejs-express/free/mvc/README.md.hbs +128 -0
  276. package/templates/nodejs-express/free/mvc/docker-compose.yml.hbs +18 -0
  277. package/templates/nodejs-express/free/mvc/package.json.hbs +39 -0
  278. package/templates/nodejs-express/free/mvc/src/app.ts.hbs +29 -0
  279. package/templates/nodejs-express/free/mvc/src/config/database.ts.hbs +10 -0
  280. package/templates/nodejs-express/free/mvc/src/controllers/healthController.ts.hbs +20 -0
  281. package/templates/nodejs-express/free/mvc/src/index.ts.hbs +12 -0
  282. package/templates/nodejs-express/free/mvc/src/middleware/errorHandler.ts.hbs +22 -0
  283. package/templates/nodejs-express/free/mvc/src/models/.gitkeep +0 -0
  284. package/templates/nodejs-express/free/mvc/src/routes/index.ts.hbs +14 -0
  285. package/templates/nodejs-express/free/mvc/src/services/.gitkeep +0 -0
  286. package/templates/nodejs-express/free/mvc/template.json +18 -0
  287. package/templates/nodejs-express/free/mvc/tsconfig.json.hbs +18 -0
  288. package/templates/nodejs-express/pro/clean/.env.example.hbs +19 -0
  289. package/templates/nodejs-express/pro/clean/.github/workflows/ci-cd.yml.hbs +88 -0
  290. package/templates/nodejs-express/pro/clean/Dockerfile.hbs +45 -0
  291. package/templates/nodejs-express/pro/clean/README.md.hbs +41 -0
  292. package/templates/nodejs-express/pro/clean/docker-compose.yml.hbs +18 -0
  293. package/templates/nodejs-express/pro/clean/infra/main.tf.hbs +83 -0
  294. package/templates/nodejs-express/pro/clean/infra/modules/ecs/main.tf.hbs +54 -0
  295. package/templates/nodejs-express/pro/clean/infra/modules/rds/main.tf.hbs +88 -0
  296. package/templates/nodejs-express/pro/clean/infra/modules/vpc/main.tf.hbs +107 -0
  297. package/templates/nodejs-express/pro/clean/package.json.hbs +55 -0
  298. package/templates/nodejs-express/pro/clean/src/application/services/AuthService.ts.hbs +66 -0
  299. package/templates/nodejs-express/pro/clean/src/domain/entities/User.ts.hbs +38 -0
  300. package/templates/nodejs-express/pro/clean/src/domain/repositories/IUserRepository.ts.hbs +13 -0
  301. package/templates/nodejs-express/pro/clean/src/domain/usecases/LoginUserUseCase.ts.hbs +39 -0
  302. package/templates/nodejs-express/pro/clean/src/domain/usecases/RegisterUserUseCase.ts.hbs +51 -0
  303. package/templates/nodejs-express/pro/clean/src/index.ts.hbs +40 -0
  304. package/templates/nodejs-express/pro/clean/src/infrastructure/database/InMemoryUserRepository.ts.hbs +46 -0
  305. package/templates/nodejs-express/pro/clean/src/infrastructure/http/controllers/AuthController.ts.hbs +45 -0
  306. package/templates/nodejs-express/pro/clean/src/infrastructure/http/middlewares/AuthMiddleware.ts.hbs +27 -0
  307. package/templates/nodejs-express/pro/clean/src/infrastructure/providers/PasswordHasher.ts.hbs +14 -0
  308. package/templates/nodejs-express/pro/clean/src/infrastructure/providers/TokenGenerator.ts.hbs +25 -0
  309. package/templates/nodejs-express/pro/clean/tsconfig.json.hbs +27 -0
  310. package/templates/nodejs-express/pro/hexagonal/.env.example.hbs +19 -0
  311. package/templates/nodejs-express/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +88 -0
  312. package/templates/nodejs-express/pro/hexagonal/Dockerfile.hbs +45 -0
  313. package/templates/nodejs-express/pro/hexagonal/README.md.hbs +42 -0
  314. package/templates/nodejs-express/pro/hexagonal/docker-compose.yml.hbs +18 -0
  315. package/templates/nodejs-express/pro/hexagonal/infra/main.tf.hbs +83 -0
  316. package/templates/nodejs-express/pro/hexagonal/infra/modules/ecs/main.tf.hbs +54 -0
  317. package/templates/nodejs-express/pro/hexagonal/infra/modules/rds/main.tf.hbs +88 -0
  318. package/templates/nodejs-express/pro/hexagonal/infra/modules/vpc/main.tf.hbs +107 -0
  319. package/templates/nodejs-express/pro/hexagonal/package.json.hbs +55 -0
  320. package/templates/nodejs-express/pro/hexagonal/src/adapters/inbound/http/AuthController.ts.hbs +48 -0
  321. package/templates/nodejs-express/pro/hexagonal/src/adapters/outbound/SecurityAdapters.ts.hbs +31 -0
  322. package/templates/nodejs-express/pro/hexagonal/src/adapters/outbound/persistence/InMemoryUserAdapter.ts.hbs +38 -0
  323. package/templates/nodejs-express/pro/hexagonal/src/core/AuthService.ts.hbs +51 -0
  324. package/templates/nodejs-express/pro/hexagonal/src/core/domain/entities/User.ts.hbs +28 -0
  325. package/templates/nodejs-express/pro/hexagonal/src/core/ports/inbound/IAuthPort.ts.hbs +11 -0
  326. package/templates/nodejs-express/pro/hexagonal/src/core/ports/outbound/ISecurityPorts.ts.hbs +15 -0
  327. package/templates/nodejs-express/pro/hexagonal/src/core/ports/outbound/IUserRepositoryPort.ts.hbs +13 -0
  328. package/templates/nodejs-express/pro/hexagonal/src/index.ts.hbs +41 -0
  329. package/templates/nodejs-express/pro/hexagonal/tsconfig.json.hbs +27 -0
  330. package/templates/nodejs-express/pro/mvc/.env.example.hbs +19 -0
  331. package/templates/nodejs-express/pro/mvc/.github/workflows/ci-cd.yml.hbs +88 -0
  332. package/templates/nodejs-express/pro/mvc/Dockerfile.hbs +45 -0
  333. package/templates/nodejs-express/pro/mvc/README.md.hbs +85 -0
  334. package/templates/nodejs-express/pro/mvc/docker-compose.yml.hbs +18 -0
  335. package/templates/nodejs-express/pro/mvc/infra/main.tf.hbs +83 -0
  336. package/templates/nodejs-express/pro/mvc/infra/modules/ecs/main.tf.hbs +54 -0
  337. package/templates/nodejs-express/pro/mvc/infra/modules/rds/main.tf.hbs +88 -0
  338. package/templates/nodejs-express/pro/mvc/infra/modules/vpc/main.tf.hbs +107 -0
  339. package/templates/nodejs-express/pro/mvc/package.json.hbs +55 -0
  340. package/templates/nodejs-express/pro/mvc/src/app.ts.hbs +34 -0
  341. package/templates/nodejs-express/pro/mvc/src/config/database.ts.hbs +10 -0
  342. package/templates/nodejs-express/pro/mvc/src/controllers/auth.controller.ts.hbs +91 -0
  343. package/templates/nodejs-express/pro/mvc/src/controllers/healthController.ts.hbs +20 -0
  344. package/templates/nodejs-express/pro/mvc/src/controllers/payments.controller.ts.hbs +72 -0
  345. package/templates/nodejs-express/pro/mvc/src/index.ts.hbs +12 -0
  346. package/templates/nodejs-express/pro/mvc/src/middleware/errorHandler.ts.hbs +22 -0
  347. package/templates/nodejs-express/pro/mvc/src/middlewares/auth.middleware.ts.hbs +31 -0
  348. package/templates/nodejs-express/pro/mvc/src/models/.gitkeep +0 -0
  349. package/templates/nodejs-express/pro/mvc/src/routes/index.ts.hbs +14 -0
  350. package/templates/nodejs-express/pro/mvc/src/services/.gitkeep +0 -0
  351. package/templates/nodejs-express/pro/mvc/src/services/stripe.service.ts.hbs +102 -0
  352. package/templates/nodejs-express/pro/mvc/template.json +18 -0
  353. package/templates/nodejs-express/pro/mvc/tsconfig.json.hbs +27 -0
  354. package/templates/python-fastapi/free/mvc/README.md.hbs +41 -0
  355. package/templates/python-fastapi/free/mvc/app/controllers/health.py.hbs +7 -0
  356. package/templates/python-fastapi/free/mvc/app/controllers/items.py.hbs +27 -0
  357. package/templates/python-fastapi/free/mvc/app/main.py.hbs +26 -0
  358. package/templates/python-fastapi/free/mvc/app/models/item.py.hbs +11 -0
  359. package/templates/python-fastapi/free/mvc/app/schemas/item.py.hbs +17 -0
  360. package/templates/python-fastapi/free/mvc/app/services/item_service.py.hbs +33 -0
  361. package/templates/python-fastapi/free/mvc/requirements.txt.hbs +4 -0
  362. package/templates/python-fastapi/pro/clean/.env.example.hbs +17 -0
  363. package/templates/python-fastapi/pro/clean/.github/workflows/ci-cd.yml.hbs +88 -0
  364. package/templates/python-fastapi/pro/clean/Dockerfile.hbs +20 -0
  365. package/templates/python-fastapi/pro/clean/app/domain/entities/user.py.hbs +23 -0
  366. package/templates/python-fastapi/pro/clean/app/domain/repositories/user_repository.py.hbs +22 -0
  367. package/templates/python-fastapi/pro/clean/app/domain/usecases/register_user.py.hbs +30 -0
  368. package/templates/python-fastapi/pro/clean/app/infrastructure/database/in_memory_repository.py.hbs +26 -0
  369. package/templates/python-fastapi/pro/clean/app/infrastructure/http/auth_controller.py.hbs +26 -0
  370. package/templates/python-fastapi/pro/clean/app/infrastructure/security/adapters.py.hbs +23 -0
  371. package/templates/python-fastapi/pro/clean/app/main.py.hbs +10 -0
  372. package/templates/python-fastapi/pro/clean/infra/main.tf.hbs +83 -0
  373. package/templates/python-fastapi/pro/clean/infra/modules/ecs/main.tf.hbs +54 -0
  374. package/templates/python-fastapi/pro/clean/infra/modules/rds/main.tf.hbs +88 -0
  375. package/templates/python-fastapi/pro/clean/infra/modules/vpc/main.tf.hbs +107 -0
  376. package/templates/python-fastapi/pro/clean/requirements.txt.hbs +12 -0
  377. package/templates/python-fastapi/pro/hexagonal/.env.example.hbs +17 -0
  378. package/templates/python-fastapi/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +88 -0
  379. package/templates/python-fastapi/pro/hexagonal/Dockerfile.hbs +20 -0
  380. package/templates/python-fastapi/pro/hexagonal/app/adapters/inbound/http_adapter.py.hbs +29 -0
  381. package/templates/python-fastapi/pro/hexagonal/app/core/domain/user.py.hbs +15 -0
  382. package/templates/python-fastapi/pro/hexagonal/app/core/ports.py.hbs +25 -0
  383. package/templates/python-fastapi/pro/hexagonal/app/core/service.py.hbs +28 -0
  384. package/templates/python-fastapi/pro/hexagonal/app/main.py.hbs +22 -0
  385. package/templates/python-fastapi/pro/hexagonal/infra/main.tf.hbs +83 -0
  386. package/templates/python-fastapi/pro/hexagonal/infra/modules/ecs/main.tf.hbs +54 -0
  387. package/templates/python-fastapi/pro/hexagonal/infra/modules/rds/main.tf.hbs +88 -0
  388. package/templates/python-fastapi/pro/hexagonal/infra/modules/vpc/main.tf.hbs +107 -0
  389. package/templates/python-fastapi/pro/hexagonal/requirements.txt.hbs +12 -0
  390. package/templates/python-fastapi/pro/mvc/.env.example.hbs +17 -0
  391. package/templates/python-fastapi/pro/mvc/.github/workflows/ci-cd.yml.hbs +88 -0
  392. package/templates/python-fastapi/pro/mvc/Dockerfile.hbs +20 -0
  393. package/templates/python-fastapi/pro/mvc/README.md.hbs +41 -0
  394. package/templates/python-fastapi/pro/mvc/app/controllers/auth.py.hbs +46 -0
  395. package/templates/python-fastapi/pro/mvc/app/controllers/health.py.hbs +7 -0
  396. package/templates/python-fastapi/pro/mvc/app/controllers/items.py.hbs +21 -0
  397. package/templates/python-fastapi/pro/mvc/app/controllers/payments.py.hbs +32 -0
  398. package/templates/python-fastapi/pro/mvc/app/main.py.hbs +20 -0
  399. package/templates/python-fastapi/pro/mvc/app/middleware/security.py.hbs +39 -0
  400. package/templates/python-fastapi/pro/mvc/app/models/item.py.hbs +11 -0
  401. package/templates/python-fastapi/pro/mvc/app/schemas/item.py.hbs +16 -0
  402. package/templates/python-fastapi/pro/mvc/app/services/item_service.py.hbs +24 -0
  403. package/templates/python-fastapi/pro/mvc/infra/main.tf.hbs +83 -0
  404. package/templates/python-fastapi/pro/mvc/infra/modules/ecs/main.tf.hbs +54 -0
  405. package/templates/python-fastapi/pro/mvc/infra/modules/rds/main.tf.hbs +88 -0
  406. package/templates/python-fastapi/pro/mvc/infra/modules/vpc/main.tf.hbs +107 -0
  407. package/templates/python-fastapi/pro/mvc/requirements.txt.hbs +12 -0
@@ -0,0 +1,33 @@
1
+ from typing import List, Optional
2
+ from app.models.item import Item
3
+ from app.schemas.item import ItemCreate
4
+ from datetime import datetime
5
+ import uuid
6
+
7
+ class ItemService:
8
+ """Item Service - Business Logic Layer"""
9
+
10
+ def __init__(self):
11
+ self._items: dict[str, Item] = {}
12
+
13
+ def get_all(self) -> List[Item]:
14
+ return list(self._items.values())
15
+
16
+ def get_by_id(self, item_id: str) -> Optional[Item]:
17
+ return self._items.get(item_id)
18
+
19
+ def create(self, data: ItemCreate) -> Item:
20
+ item = Item(
21
+ id=str(uuid.uuid4()),
22
+ name=data.name,
23
+ description=data.description,
24
+ created_at=datetime.now()
25
+ )
26
+ self._items[item.id] = item
27
+ return item
28
+
29
+ def delete(self, item_id: str) -> bool:
30
+ if item_id in self._items:
31
+ del self._items[item_id]
32
+ return True
33
+ return False
@@ -0,0 +1,4 @@
1
+ fastapi>=0.109.0
2
+ uvicorn[standard]>=0.27.0
3
+ pydantic>=2.5.0
4
+ python-dotenv>=1.0.0
@@ -0,0 +1,17 @@
1
+ # {{projectName}} Environment Variables
2
+
3
+ # Server
4
+ PORT=8000
5
+
6
+ # Database
7
+ DATABASE_URL=postgresql://postgres:postgres@localhost:5432/{{projectNameSnakeCase}}
8
+
9
+ # JWT
10
+ JWT_SECRET=your-super-secret-jwt-key-change-in-production
11
+
12
+ # Stripe
13
+ STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
14
+ STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
15
+
16
+ # Frontend
17
+ FRONTEND_URL=http://localhost:3000
@@ -0,0 +1,88 @@
1
+ name: CI/CD Pipeline
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ NODE_VERSION: '20'
11
+ AWS_REGION: 'us-east-1'
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup Node.js
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: $\{{ env.NODE_VERSION }}
24
+ cache: 'npm'
25
+
26
+ - name: Install dependencies
27
+ run: npm ci
28
+
29
+ - name: Run linter
30
+ run: npm run lint --if-present
31
+
32
+ - name: Run tests
33
+ run: npm test --if-present
34
+
35
+ - name: Build
36
+ run: npm run build
37
+
38
+ build-and-push:
39
+ needs: test
40
+ runs-on: ubuntu-latest
41
+ if: github.ref == 'refs/heads/main'
42
+
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+
46
+ - name: Configure AWS credentials
47
+ uses: aws-actions/configure-aws-credentials@v4
48
+ with:
49
+ aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
50
+ aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
51
+ aws-region: $\{{ env.AWS_REGION }}
52
+
53
+ - name: Login to Amazon ECR
54
+ id: login-ecr
55
+ uses: aws-actions/amazon-ecr-login@v2
56
+
57
+ - name: Build, tag, and push image to Amazon ECR
58
+ env:
59
+ ECR_REGISTRY: $\{{ steps.login-ecr.outputs.registry }}
60
+ ECR_REPOSITORY: {{projectNameKebabCase}}
61
+ IMAGE_TAG: $\{{ github.sha }}
62
+ run: |
63
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
64
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
65
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
66
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
67
+
68
+ deploy:
69
+ needs: build-and-push
70
+ runs-on: ubuntu-latest
71
+ if: github.ref == 'refs/heads/main'
72
+
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+
76
+ - name: Configure AWS credentials
77
+ uses: aws-actions/configure-aws-credentials@v4
78
+ with:
79
+ aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
80
+ aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
81
+ aws-region: $\{{ env.AWS_REGION }}
82
+
83
+ - name: Deploy to ECS
84
+ run: |
85
+ aws ecs update-service \
86
+ --cluster {{projectNameKebabCase}}-prod \
87
+ --service {{projectNameKebabCase}}-api \
88
+ --force-new-deployment
@@ -0,0 +1,20 @@
1
+ # Production Dockerfile for {{projectName}}
2
+
3
+ FROM python:3.11-slim
4
+
5
+ WORKDIR /app
6
+
7
+ # Install dependencies
8
+ COPY requirements.txt .
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Copy source
12
+ COPY . .
13
+
14
+ # Create non-root user
15
+ RUN adduser --disabled-password --gecos "" appuser
16
+ USER appuser
17
+
18
+ EXPOSE 8000
19
+
20
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
@@ -0,0 +1,23 @@
1
+ from dataclasses import dataclass, field
2
+ from datetime import datetime
3
+ from typing import Optional
4
+ import uuid
5
+
6
+ @dataclass
7
+ class User:
8
+ """User Entity - Domain Layer"""
9
+ email: str
10
+ name: str
11
+ password: str
12
+ id: str = field(default_factory=lambda: str(uuid.uuid4()))
13
+ stripe_customer_id: Optional[str] = None
14
+ created_at: datetime = field(default_factory=datetime.now)
15
+
16
+ def __post_init__(self):
17
+ if "@" not in self.email:
18
+ raise ValueError("Invalid email format")
19
+ if len(self.password) < 8:
20
+ raise ValueError("Password must be at least 8 characters")
21
+
22
+ def set_stripe_customer_id(self, customer_id: str):
23
+ self.stripe_customer_id = customer_id
@@ -0,0 +1,22 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Optional, List
3
+ from app.domain.entities.user import User
4
+
5
+ class IUserRepository(ABC):
6
+ """User Repository Interface - Domain Layer"""
7
+
8
+ @abstractmethod
9
+ async def find_by_id(self, user_id: str) -> Optional[User]:
10
+ pass
11
+
12
+ @abstractmethod
13
+ async def find_by_email(self, email: str) -> Optional[User]:
14
+ pass
15
+
16
+ @abstractmethod
17
+ async def save(self, user: User) -> User:
18
+ pass
19
+
20
+ @abstractmethod
21
+ async def delete(self, user_id: str) -> None:
22
+ pass
@@ -0,0 +1,30 @@
1
+ from app.domain.entities.user import User
2
+ from app.domain.repositories.user_repository import IUserRepository
3
+ from typing import Protocol
4
+
5
+ class IPasswordHasher(Protocol):
6
+ def hash(self, password: str) -> str: ...
7
+ def verify(self, password: str, hashed: str) -> bool: ...
8
+
9
+ class ITokenGenerator(Protocol):
10
+ def generate(self, user_id: str, email: str) -> str: ...
11
+
12
+ class RegisterUserUseCase:
13
+ """Register User Use Case - Domain Layer"""
14
+
15
+ def __init__(self, repository: IUserRepository, hasher: IPasswordHasher, token_gen: ITokenGenerator):
16
+ self.repository = repository
17
+ self.hasher = hasher
18
+ self.token_gen = token_gen
19
+
20
+ async def execute(self, email: str, name: str, password: str):
21
+ existing = await self.repository.find_by_email(email)
22
+ if existing:
23
+ raise ValueError("User already exists")
24
+
25
+ hashed = self.hasher.hash(password)
26
+ user = User(email=email, name=name, password=hashed)
27
+ saved_user = await self.repository.save(user)
28
+ token = self.token_gen.generate(saved_user.id, saved_user.email)
29
+
30
+ return {"user": saved_user, "token": token}
@@ -0,0 +1,26 @@
1
+ from app.domain.repositories.user_repository import IUserRepository
2
+ from app.domain.entities.user import User
3
+ from typing import Optional
4
+
5
+ class InMemoryUserRepository(IUserRepository):
6
+ """In-Memory User Repository - Infrastructure Layer"""
7
+
8
+ def __init__(self):
9
+ self._users: dict[str, User] = {}
10
+
11
+ async def find_by_id(self, user_id: str) -> Optional[User]:
12
+ return self._users.get(user_id)
13
+
14
+ async def find_by_email(self, email: str) -> Optional[User]:
15
+ for user in self._users.values():
16
+ if user.email == email:
17
+ return user
18
+ return None
19
+
20
+ async def save(self, user: User) -> User:
21
+ self._users[user.id] = user
22
+ return user
23
+
24
+ async def delete(self, user_id: str) -> None:
25
+ if user_id in self._users:
26
+ del self._users[user_id]
@@ -0,0 +1,26 @@
1
+ from fastapi import APIRouter, HTTPException, Depends
2
+ from pydantic import BaseModel, EmailStr
3
+ from app.domain.usecases.register_user import RegisterUserUseCase
4
+ from app.infrastructure.database.in_memory_repository import InMemoryUserRepository
5
+ from app.infrastructure.security.adapters import BcryptHasher, JwtTokenGenerator
6
+
7
+ router = APIRouter()
8
+
9
+ # Dependency Injection
10
+ repo = InMemoryUserRepository()
11
+ hasher = BcryptHasher()
12
+ token_gen = JwtTokenGenerator()
13
+ register_usecase = RegisterUserUseCase(repo, hasher, token_gen)
14
+
15
+ class RegisterRequest(BaseModel):
16
+ email: EmailStr
17
+ name: str
18
+ password: str
19
+
20
+ @router.post("/register")
21
+ async def register(req: RegisterRequest):
22
+ try:
23
+ result = await register_usecase.execute(req.email, req.name, req.password)
24
+ return result
25
+ except ValueError as e:
26
+ raise HTTPException(status_code=400, detail=str(e))
@@ -0,0 +1,23 @@
1
+ from passlib.context import CryptContext
2
+ from jose import jwt
3
+ from datetime import datetime, timedelta
4
+ import os
5
+
6
+ SECRET_KEY = os.getenv("JWT_SECRET", "secret")
7
+ ALGORITHM = "HS256"
8
+
9
+ class BcryptHasher:
10
+ def __init__(self):
11
+ self.pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
12
+
13
+ def hash(self, password: str) -> str:
14
+ return self.pwd_context.hash(password)
15
+
16
+ def verify(self, password: str, hashed: str) -> bool:
17
+ return self.pwd_context.verify(password, hashed)
18
+
19
+ class JwtTokenGenerator:
20
+ def generate(self, user_id: str, email: str) -> str:
21
+ expire = datetime.utcnow() + timedelta(days=7)
22
+ to_encode = {"exp": expire, "sub": user_id, "email": email}
23
+ return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
@@ -0,0 +1,10 @@
1
+ from fastapi import FastAPI
2
+ from app.infrastructure.http import auth_controller
3
+
4
+ app = FastAPI(title="{{projectName}} - Clean Architecture")
5
+
6
+ app.include_router(auth_controller.router, prefix="/api/auth", tags=["Auth"])
7
+
8
+ @app.get("/health")
9
+ def health():
10
+ return {"status": "ok", "architecture": "clean"}
@@ -0,0 +1,83 @@
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
+ }
@@ -0,0 +1,54 @@
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
+ }
@@ -0,0 +1,88 @@
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
+ }
@@ -0,0 +1,107 @@
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
+ }
@@ -0,0 +1,12 @@
1
+ fastapi>=0.109.0
2
+ uvicorn[standard]>=0.27.0
3
+ pydantic>=2.5.0
4
+ python-dotenv>=1.0.0
5
+ python-jose[cryptography]>=3.3.0
6
+ passlib[bcrypt]>=1.7.4
7
+ stripe>=8.0.0
8
+ sqlalchemy>=2.0.0
9
+ alembic>=1.13.0
10
+ psycopg2-binary>=2.9.9
11
+ pytest>=8.0.0
12
+ httpx>=0.26.0