@cubocicloide/stack-react-fastapi 13.0.6

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 (295) hide show
  1. package/LICENSE +33 -0
  2. package/README.md +66 -0
  3. package/dist/commands/lint/checks/BE/001.d.ts +6 -0
  4. package/dist/commands/lint/checks/BE/001.js +95 -0
  5. package/dist/commands/lint/checks/BE/001.js.map +1 -0
  6. package/dist/commands/lint/checks/BE/002.d.ts +6 -0
  7. package/dist/commands/lint/checks/BE/002.js +30 -0
  8. package/dist/commands/lint/checks/BE/002.js.map +1 -0
  9. package/dist/commands/lint/checks/BE/003.d.ts +11 -0
  10. package/dist/commands/lint/checks/BE/003.js +46 -0
  11. package/dist/commands/lint/checks/BE/003.js.map +1 -0
  12. package/dist/commands/lint/checks/BE/004.d.ts +6 -0
  13. package/dist/commands/lint/checks/BE/004.js +27 -0
  14. package/dist/commands/lint/checks/BE/004.js.map +1 -0
  15. package/dist/commands/lint/checks/BE/005.d.ts +6 -0
  16. package/dist/commands/lint/checks/BE/005.js +107 -0
  17. package/dist/commands/lint/checks/BE/005.js.map +1 -0
  18. package/dist/commands/lint/checks/BE/006.d.ts +6 -0
  19. package/dist/commands/lint/checks/BE/006.js +27 -0
  20. package/dist/commands/lint/checks/BE/006.js.map +1 -0
  21. package/dist/commands/lint/checks/BE/007.d.ts +31 -0
  22. package/dist/commands/lint/checks/BE/007.js +109 -0
  23. package/dist/commands/lint/checks/BE/007.js.map +1 -0
  24. package/dist/commands/lint/checks/BE/008.d.ts +12 -0
  25. package/dist/commands/lint/checks/BE/008.js +57 -0
  26. package/dist/commands/lint/checks/BE/008.js.map +1 -0
  27. package/dist/commands/lint/checks/BE/009.d.ts +12 -0
  28. package/dist/commands/lint/checks/BE/009.js +104 -0
  29. package/dist/commands/lint/checks/BE/009.js.map +1 -0
  30. package/dist/commands/lint/checks/BE/010.d.ts +12 -0
  31. package/dist/commands/lint/checks/BE/010.js +54 -0
  32. package/dist/commands/lint/checks/BE/010.js.map +1 -0
  33. package/dist/commands/lint/checks/BE/011.d.ts +16 -0
  34. package/dist/commands/lint/checks/BE/011.js +46 -0
  35. package/dist/commands/lint/checks/BE/011.js.map +1 -0
  36. package/dist/commands/lint/checks/E2E/001.d.ts +6 -0
  37. package/dist/commands/lint/checks/E2E/001.js +35 -0
  38. package/dist/commands/lint/checks/E2E/001.js.map +1 -0
  39. package/dist/commands/lint/checks/E2E/002.d.ts +6 -0
  40. package/dist/commands/lint/checks/E2E/002.js +37 -0
  41. package/dist/commands/lint/checks/E2E/002.js.map +1 -0
  42. package/dist/commands/lint/checks/E2E/003.d.ts +6 -0
  43. package/dist/commands/lint/checks/E2E/003.js +42 -0
  44. package/dist/commands/lint/checks/E2E/003.js.map +1 -0
  45. package/dist/commands/lint/checks/E2E/004.d.ts +6 -0
  46. package/dist/commands/lint/checks/E2E/004.js +37 -0
  47. package/dist/commands/lint/checks/E2E/004.js.map +1 -0
  48. package/dist/commands/lint/checks/E2E/005.d.ts +6 -0
  49. package/dist/commands/lint/checks/E2E/005.js +47 -0
  50. package/dist/commands/lint/checks/E2E/005.js.map +1 -0
  51. package/dist/commands/lint/checks/E2E/006.d.ts +6 -0
  52. package/dist/commands/lint/checks/E2E/006.js +28 -0
  53. package/dist/commands/lint/checks/E2E/006.js.map +1 -0
  54. package/dist/commands/lint/checks/E2E/007.d.ts +6 -0
  55. package/dist/commands/lint/checks/E2E/007.js +47 -0
  56. package/dist/commands/lint/checks/E2E/007.js.map +1 -0
  57. package/dist/commands/lint/checks/FE/001.d.ts +6 -0
  58. package/dist/commands/lint/checks/FE/001.js +56 -0
  59. package/dist/commands/lint/checks/FE/001.js.map +1 -0
  60. package/dist/commands/lint/checks/FE/002.d.ts +6 -0
  61. package/dist/commands/lint/checks/FE/002.js +80 -0
  62. package/dist/commands/lint/checks/FE/002.js.map +1 -0
  63. package/dist/commands/lint/checks/FE/003.d.ts +6 -0
  64. package/dist/commands/lint/checks/FE/003.js +65 -0
  65. package/dist/commands/lint/checks/FE/003.js.map +1 -0
  66. package/dist/commands/lint/checks/FE/004.d.ts +6 -0
  67. package/dist/commands/lint/checks/FE/004.js +72 -0
  68. package/dist/commands/lint/checks/FE/004.js.map +1 -0
  69. package/dist/commands/lint/checks/FE/005.d.ts +6 -0
  70. package/dist/commands/lint/checks/FE/005.js +103 -0
  71. package/dist/commands/lint/checks/FE/005.js.map +1 -0
  72. package/dist/commands/lint/checks/FE/006.d.ts +6 -0
  73. package/dist/commands/lint/checks/FE/006.js +102 -0
  74. package/dist/commands/lint/checks/FE/006.js.map +1 -0
  75. package/dist/commands/lint/checks/FE/007.d.ts +6 -0
  76. package/dist/commands/lint/checks/FE/007.js +60 -0
  77. package/dist/commands/lint/checks/FE/007.js.map +1 -0
  78. package/dist/commands/lint/checks/FE/008.d.ts +6 -0
  79. package/dist/commands/lint/checks/FE/008.js +115 -0
  80. package/dist/commands/lint/checks/FE/008.js.map +1 -0
  81. package/dist/commands/lint/checks/FE/009.d.ts +6 -0
  82. package/dist/commands/lint/checks/FE/009.js +83 -0
  83. package/dist/commands/lint/checks/FE/009.js.map +1 -0
  84. package/dist/commands/lint/checks/FE/010.d.ts +6 -0
  85. package/dist/commands/lint/checks/FE/010.js +105 -0
  86. package/dist/commands/lint/checks/FE/010.js.map +1 -0
  87. package/dist/commands/lint/checks/FE/011.d.ts +6 -0
  88. package/dist/commands/lint/checks/FE/011.js +43 -0
  89. package/dist/commands/lint/checks/FE/011.js.map +1 -0
  90. package/dist/commands/lint/checks/FE/012.d.ts +6 -0
  91. package/dist/commands/lint/checks/FE/012.js +150 -0
  92. package/dist/commands/lint/checks/FE/012.js.map +1 -0
  93. package/dist/index.d.ts +5 -0
  94. package/dist/index.js +3491 -0
  95. package/dist/index.js.map +1 -0
  96. package/dude.stack.json +7 -0
  97. package/package.json +43 -0
  98. package/templates/aws-eks/backend/Dockerfile.prod.hbs +22 -0
  99. package/templates/aws-eks/docs/docs/deploy.md.hbs +159 -0
  100. package/templates/aws-eks/frontend/Dockerfile.prod +28 -0
  101. package/templates/aws-eks/frontend/nginx.conf +19 -0
  102. package/templates/aws-eks/iac/README.md.hbs +311 -0
  103. package/templates/aws-eks/iac/_gitignore +24 -0
  104. package/templates/aws-eks/iac/helm/app/.helmignore +7 -0
  105. package/templates/aws-eks/iac/helm/app/Chart.yaml.hbs +6 -0
  106. package/templates/aws-eks/iac/helm/app/templates/NOTES.txt +23 -0
  107. package/templates/aws-eks/iac/helm/app/templates/backend-deployment.yaml +44 -0
  108. package/templates/aws-eks/iac/helm/app/templates/backend-service.yaml +16 -0
  109. package/templates/aws-eks/iac/helm/app/templates/celery-beat-deployment.yaml +34 -0
  110. package/templates/aws-eks/iac/helm/app/templates/celery-worker-deployment.yaml +31 -0
  111. package/templates/aws-eks/iac/helm/app/templates/configmap.yaml +15 -0
  112. package/templates/aws-eks/iac/helm/app/templates/flower-deployment.yaml +28 -0
  113. package/templates/aws-eks/iac/helm/app/templates/flower-service.yaml +19 -0
  114. package/templates/aws-eks/iac/helm/app/templates/frontend-deployment.yaml +34 -0
  115. package/templates/aws-eks/iac/helm/app/templates/frontend-service.yaml +16 -0
  116. package/templates/aws-eks/iac/helm/app/templates/helpers.tpl +90 -0
  117. package/templates/aws-eks/iac/helm/app/templates/hpa.yaml +23 -0
  118. package/templates/aws-eks/iac/helm/app/templates/ingress.yaml +30 -0
  119. package/templates/aws-eks/iac/helm/app/templates/migration-job.yaml +38 -0
  120. package/templates/aws-eks/iac/helm/app/templates/redis-deployment.yaml +33 -0
  121. package/templates/aws-eks/iac/helm/app/templates/redis-service.yaml +18 -0
  122. package/templates/aws-eks/iac/helm/app/templates/secret.yaml +17 -0
  123. package/templates/aws-eks/iac/helm/app/templates/serviceaccount.yaml +12 -0
  124. package/templates/aws-eks/iac/helm/app/values-dev.yaml.hbs +35 -0
  125. package/templates/aws-eks/iac/helm/app/values.yaml.hbs +130 -0
  126. package/templates/aws-eks/iac/runner/Dockerfile +53 -0
  127. package/templates/aws-eks/iac/terraform/bootstrap/main.tf.hbs +101 -0
  128. package/templates/aws-eks/iac/terraform/bootstrap/outputs.tf +19 -0
  129. package/templates/aws-eks/iac/terraform/bootstrap/variables.tf.hbs +17 -0
  130. package/templates/aws-eks/iac/terraform/environments/dev/backend.hcl.hbs +12 -0
  131. package/templates/aws-eks/iac/terraform/environments/dev/terraform.tfvars.hbs +32 -0
  132. package/templates/aws-eks/iac/terraform/main.tf.hbs +305 -0
  133. package/templates/aws-eks/iac/terraform/outputs.tf.hbs +52 -0
  134. package/templates/aws-eks/iac/terraform/providers.tf +47 -0
  135. package/templates/aws-eks/iac/terraform/variables.tf.hbs +181 -0
  136. package/templates/aws-eks/iac/terraform/versions.tf +27 -0
  137. package/templates/base/.claude/agents/issue-fixer.md +190 -0
  138. package/templates/base/.claude/agents/security-fixer.md +250 -0
  139. package/templates/base/.claude/rules/BE/001.md +25 -0
  140. package/templates/base/.claude/rules/BE/002.md +15 -0
  141. package/templates/base/.claude/rules/BE/003.md +18 -0
  142. package/templates/base/.claude/rules/BE/004.md +14 -0
  143. package/templates/base/.claude/rules/BE/005.md +15 -0
  144. package/templates/base/.claude/rules/BE/006.md +17 -0
  145. package/templates/base/.claude/rules/BE/007.md +21 -0
  146. package/templates/base/.claude/rules/BE/008.md +19 -0
  147. package/templates/base/.claude/rules/BE/009.md +27 -0
  148. package/templates/base/.claude/rules/BE/010.md +16 -0
  149. package/templates/base/.claude/rules/BE/011.md +15 -0
  150. package/templates/base/.claude/rules/E2E/001.md +13 -0
  151. package/templates/base/.claude/rules/E2E/002.md +14 -0
  152. package/templates/base/.claude/rules/E2E/003.md +10 -0
  153. package/templates/base/.claude/rules/E2E/004.md +23 -0
  154. package/templates/base/.claude/rules/E2E/005.md +15 -0
  155. package/templates/base/.claude/rules/E2E/006.md +13 -0
  156. package/templates/base/.claude/rules/E2E/007.md +18 -0
  157. package/templates/base/.claude/rules/FE/001.md +22 -0
  158. package/templates/base/.claude/rules/FE/002.md +39 -0
  159. package/templates/base/.claude/rules/FE/003.md +19 -0
  160. package/templates/base/.claude/rules/FE/004.md +21 -0
  161. package/templates/base/.claude/rules/FE/005.md +33 -0
  162. package/templates/base/.claude/rules/FE/006.md +24 -0
  163. package/templates/base/.claude/rules/FE/007.md +19 -0
  164. package/templates/base/.claude/rules/FE/008.md +26 -0
  165. package/templates/base/.claude/rules/FE/009.md +30 -0
  166. package/templates/base/.claude/rules/FE/010.md +25 -0
  167. package/templates/base/.claude/rules/FE/011.md +22 -0
  168. package/templates/base/.claude/rules/FE/012.md +32 -0
  169. package/templates/base/.claude/settings.json +53 -0
  170. package/templates/base/.claude/skills/clean-branches/SKILL.md +100 -0
  171. package/templates/base/.claude/skills/create/SKILL.md +47 -0
  172. package/templates/base/.claude/skills/create-jira-issue/SKILL.md +174 -0
  173. package/templates/base/.claude/skills/create-page/SKILL.md +195 -0
  174. package/templates/base/.claude/skills/create-route/SKILL.md +199 -0
  175. package/templates/base/.claude/skills/draft-email/SKILL.md +104 -0
  176. package/templates/base/.claude/skills/fix-issues/SKILL.md +238 -0
  177. package/templates/base/.claude/skills/security-scan/SKILL.md +297 -0
  178. package/templates/base/.claude/skills/verify-security-fixes/SKILL.md +180 -0
  179. package/templates/base/.dude/commands/README.md +85 -0
  180. package/templates/base/.dude/commands/hello.ts +34 -0
  181. package/templates/base/.dude/lint/checks/PRJ/001.ts +26 -0
  182. package/templates/base/.dude/lint/checks/README.md +69 -0
  183. package/templates/base/.vscode/tasks.json +44 -0
  184. package/templates/base/.worktreeinclude +2 -0
  185. package/templates/base/CLAUDE.md.hbs +364 -0
  186. package/templates/base/README.md.hbs +187 -0
  187. package/templates/base/_env.example.hbs +29 -0
  188. package/templates/base/_env.hbs +25 -0
  189. package/templates/base/_gitignore +31 -0
  190. package/templates/base/_npmrc +2 -0
  191. package/templates/base/backend/Dockerfile.hbs +22 -0
  192. package/templates/base/backend/README.md.hbs +74 -0
  193. package/templates/base/backend/_dockerignore +11 -0
  194. package/templates/base/backend/app/__init__.py +1 -0
  195. package/templates/base/backend/app/core/__init__.py +0 -0
  196. package/templates/base/backend/app/core/config.py.hbs +23 -0
  197. package/templates/base/backend/app/fixtures/__init__.py +0 -0
  198. package/templates/base/backend/app/main.py.hbs +41 -0
  199. package/templates/base/backend/app/management/__init__.py +0 -0
  200. package/templates/base/backend/app/models/__init__.py +0 -0
  201. package/templates/base/backend/app/queries/__init__.py +0 -0
  202. package/templates/base/backend/app/routers/__init__.py +0 -0
  203. package/templates/base/backend/app/routers/health.py +13 -0
  204. package/templates/base/backend/app/schemas/__init__.py +0 -0
  205. package/templates/base/backend/app/schemas/health.py +7 -0
  206. package/templates/base/backend/app/tasks/__init__.py +1 -0
  207. package/templates/base/backend/app/tests/__init__.py +0 -0
  208. package/templates/base/backend/app/tests/conftest.py +13 -0
  209. package/templates/base/backend/app/tests/models/__init__.py +0 -0
  210. package/templates/base/backend/app/tests/queries/__init__.py +0 -0
  211. package/templates/base/backend/app/tests/routers/__init__.py +0 -0
  212. package/templates/base/backend/app/tests/routers/test_health.py +10 -0
  213. package/templates/base/backend/app/tests/tasks/__init__.py +1 -0
  214. package/templates/base/backend/app/tests/utils/__init__.py +0 -0
  215. package/templates/base/backend/app/utils/__init__.py +0 -0
  216. package/templates/base/backend/pyproject.toml.hbs +40 -0
  217. package/templates/base/docker-compose.yml.hbs +128 -0
  218. package/templates/base/docs/docs/api.md +21 -0
  219. package/templates/base/docs/docs/dude.md.hbs +316 -0
  220. package/templates/base/docs/docs/index.md.hbs +100 -0
  221. package/templates/base/docs/docs/mkdocs.md +238 -0
  222. package/templates/base/docs/mkdocs.yml.hbs +52 -0
  223. package/templates/base/e2e/.prettierrc.json +1 -0
  224. package/templates/base/e2e/_prettierignore +3 -0
  225. package/templates/base/e2e/cucumber.js +21 -0
  226. package/templates/base/e2e/eslint.config.mjs +14 -0
  227. package/templates/base/e2e/features/example.feature +13 -0
  228. package/templates/base/e2e/package.json.hbs +30 -0
  229. package/templates/base/e2e/pages/ExamplePage.ts +16 -0
  230. package/templates/base/e2e/playwright.config.ts +27 -0
  231. package/templates/base/e2e/steps/common.steps.ts +32 -0
  232. package/templates/base/e2e/steps/example.steps.ts +4 -0
  233. package/templates/base/e2e/support/hooks.ts +72 -0
  234. package/templates/base/e2e/support/world.ts +24 -0
  235. package/templates/base/e2e/tsconfig.json +22 -0
  236. package/templates/base/frontend/.prettierrc.json +6 -0
  237. package/templates/base/frontend/Dockerfile +10 -0
  238. package/templates/base/frontend/_dockerignore +4 -0
  239. package/templates/base/frontend/eslint.config.js +32 -0
  240. package/templates/base/frontend/index.html.hbs +13 -0
  241. package/templates/base/frontend/package.json.hbs +38 -0
  242. package/templates/base/frontend/public/favicon.svg +5 -0
  243. package/templates/base/frontend/src/$components/Layout/$assets/logo.svg +5 -0
  244. package/templates/base/frontend/src/$components/Layout/constants.tsx.hbs +10 -0
  245. package/templates/base/frontend/src/$components/Layout/index.tsx +80 -0
  246. package/templates/base/frontend/src/$components/Layout/types.tsx +9 -0
  247. package/templates/base/frontend/src/$components/index.tsx +1 -0
  248. package/templates/base/frontend/src/$hooks/index.tsx +2 -0
  249. package/templates/base/frontend/src/$hooks/useCounterStore/index.tsx +28 -0
  250. package/templates/base/frontend/src/$hooks/useCounterStore/types.tsx +7 -0
  251. package/templates/base/frontend/src/$hooks/usePageTitle/index.tsx +21 -0
  252. package/templates/base/frontend/src/$types/vite-env.d.ts +10 -0
  253. package/templates/base/frontend/src/App.tsx.hbs +40 -0
  254. package/templates/base/frontend/src/main.tsx +10 -0
  255. package/templates/base/frontend/src/openapi/utils/openapi.yaml.hbs +28 -0
  256. package/templates/base/frontend/src/pages/constants.tsx +31 -0
  257. package/templates/base/frontend/src/pages/index.tsx +192 -0
  258. package/templates/base/frontend/src/pages/types.tsx +6 -0
  259. package/templates/base/frontend/src/styles.module.css +7 -0
  260. package/templates/base/frontend/src/utils/constants.tsx +11 -0
  261. package/templates/base/frontend/src/utils/formatters/index.tsx +49 -0
  262. package/templates/base/frontend/src/utils/functions.tsx +70 -0
  263. package/templates/base/frontend/src/utils/index.tsx +3 -0
  264. package/templates/base/frontend/tsconfig.json +24 -0
  265. package/templates/base/frontend/vite.config.ts +20 -0
  266. package/templates/base/package.json.hbs +11 -0
  267. package/templates/base/security/baseline.json +4 -0
  268. package/templates/celery/backend/app/tasks/__init__.py +1 -0
  269. package/templates/celery/backend/app/tasks/example.py +21 -0
  270. package/templates/celery/backend/app/tests/tasks/test_example.py +7 -0
  271. package/templates/celery/backend/app/worker.py.hbs +33 -0
  272. package/templates/celerybeat/backend/app/tasks/scheduled.py +16 -0
  273. package/templates/celerybeat/backend/app/tests/tasks/test_scheduled.py +7 -0
  274. package/templates/postgres/.dude/commands/reset.ts +76 -0
  275. package/templates/postgres/backend/alembic/env.py +55 -0
  276. package/templates/postgres/backend/alembic/script.py.mako +27 -0
  277. package/templates/postgres/backend/alembic/versions/0001_create_user_table.py +38 -0
  278. package/templates/postgres/backend/alembic.ini +42 -0
  279. package/templates/postgres/backend/app/core/database.py +15 -0
  280. package/templates/postgres/backend/app/models/__init__.py +5 -0
  281. package/templates/postgres/backend/app/models/user.py +15 -0
  282. package/templates/postgres/backend/app/queries/__init__.py +5 -0
  283. package/templates/postgres/backend/app/queries/users.py +18 -0
  284. package/templates/postgres/backend/app/routers/users.py +19 -0
  285. package/templates/postgres/backend/app/routers/users__id.py +20 -0
  286. package/templates/postgres/backend/app/tests/conftest.py +33 -0
  287. package/templates/postgres/backend/app/tests/models/test_user.py +12 -0
  288. package/templates/postgres/backend/app/tests/queries/test_users.py +12 -0
  289. package/templates/postgres/backend/app/tests/routers/test_users.py +10 -0
  290. package/templates/postgres/backend/app/tests/routers/test_users__id.py +9 -0
  291. package/templates/postgres/backend/start.sh +32 -0
  292. package/templates/postgres/frontend/src/openapi/utils/openapi.yaml.hbs +138 -0
  293. package/templates/postgres/frontend/src/pages/users/[id]/index.tsx +51 -0
  294. package/templates/postgres/frontend/src/pages/users/index.tsx +54 -0
  295. package/templates/postgres/frontend/src/pages/users/types.tsx +4 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "react-fastapi",
3
+ "version": "0.1.0",
4
+ "minDudeVersion": "0.1.0",
5
+ "entry": "dist/index.js",
6
+ "tags": ["frontend:react", "backend:fastapi", "lang:typescript", "lang:python"]
7
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@cubocicloide/stack-react-fastapi",
3
+ "version": "13.0.6",
4
+ "description": "React (Vite) + FastAPI stack plugin for the dude CLI.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "templates",
12
+ "dude.stack.json",
13
+ "README.md"
14
+ ],
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org",
17
+ "access": "public"
18
+ },
19
+ "dependencies": {
20
+ "openapi-typescript": "^7.13.0",
21
+ "pathe": "^1.1.2",
22
+ "yaml": "^2.6.0",
23
+ "@cubocicloide/dude": "0.15.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^22.7.5",
27
+ "tsup": "^8.3.0",
28
+ "typescript": "^5.6.3",
29
+ "vitest": "^2.1.9"
30
+ },
31
+ "engines": {
32
+ "node": ">=20"
33
+ },
34
+ "scripts": {
35
+ "build": "tsup",
36
+ "dev": "tsup --watch",
37
+ "typecheck": "tsc --noEmit",
38
+ "test": "vitest run --passWithNoTests",
39
+ "test:watch": "vitest --passWithNoTests",
40
+ "lint": "echo \"(lint placeholder)\"",
41
+ "clean": "rm -rf dist .turbo"
42
+ }
43
+ }
@@ -0,0 +1,22 @@
1
+ # Production image for the backend: no --reload, no dev dependencies, app code
2
+ # baked in (no bind mounts in Kubernetes). Migrations run as a Helm pre-upgrade
3
+ # Job (`alembic upgrade head`), not on container start.
4
+ #
5
+ # docker build -f Dockerfile.prod -t <ecr>/<proj>-backend:<tag> .
6
+
7
+ FROM python:3.13-slim
8
+ WORKDIR /app
9
+
10
+ RUN pip install --no-cache-dir uv
11
+
12
+ COPY pyproject.toml .
13
+ RUN uv sync --no-cache --no-dev
14
+
15
+ COPY app ./app
16
+ {{#if withPostgres}}
17
+ COPY alembic ./alembic
18
+ COPY alembic.ini ./alembic.ini
19
+ {{/if}}
20
+
21
+ EXPOSE 8000
22
+ CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
@@ -0,0 +1,159 @@
1
+ # Deploy — AWS EKS (Terraform + Helm)
2
+
3
+ This project was scaffolded with the **AWS EKS** IaC target. Infrastructure is
4
+ described with Terraform and the application is released with Helm. Every command
5
+ is scoped per environment via `--env`, which is **required** (no default) — run a
6
+ command without it to list the environments discovered under
7
+ `iac/terraform/environments/`. Add a new one with `dude iac new-env --env <name>`.
8
+ State lives in S3 + DynamoDB, so the same commands run locally and in CI.
9
+
10
+ !!! info "The IaC runner (Docker)"
11
+ `dude iac *` runs terraform / kubectl / helm / k9s inside a pinned container
12
+ built from `iac/runner/Dockerfile` (yours to edit) — so you only need
13
+ **Docker** and the `aws` CLI installed, not the whole toolchain. Your
14
+ `~/.aws` and `~/.kube` are mounted in, so profiles, SSO and the cluster
15
+ context keep working. `dude iac login` stays on the host (it needs a browser
16
+ for SSO). Set `DUDE_IAC_RUNNER=host` to use your local tools instead.
17
+
18
+ ## What gets provisioned
19
+
20
+ | Layer | Resource | Notes |
21
+ |-------|----------|-------|
22
+ | Network | VPC, public/private subnets, single NAT gateway | cost-conscious dev defaults |
23
+ | Cluster | EKS control plane + managed node group | Kubernetes **1.36** (standard support, no extended-support fees), `t3.medium` nodes |
24
+ | Registry | 2× ECR repositories | `{{projectName}}-backend`, `{{projectName}}-frontend` — **shared** across envs, created once by `dude iac bootstrap` |
25
+ | Ingress | AWS Load Balancer Controller | provisions an internet-facing ALB from the Helm `Ingress` |
26
+ | TLS / DNS *(optional)* | ACM certificate + external-dns | set `domain_name`/`route53_zone_name` to serve HTTPS on your domain |
27
+ {{#if withPostgres}}| Database | RDS PostgreSQL | managed; password generated by Terraform, `DATABASE_URL` wired into Helm automatically by `dude iac ship` |
28
+ {{/if}}{{#if withRedis}}| Cache/broker | Redis (in-cluster) | broker/result backend for Celery |
29
+ {{/if}}| Release | Helm chart `iac/helm/app` | backend + frontend{{#if withCelery}} + Celery worker{{/if}}{{#if withCeleryBeat}} + Celery Beat{{/if}} |
30
+ | State backend | S3 bucket (versioned) + DynamoDB lock table | created once by `dude iac bootstrap` |
31
+
32
+ ## Deploy, in order
33
+
34
+ ```bash
35
+ # 1. Authenticate to AWS for this environment (maps --env → an AWS profile)
36
+ dude iac login --env dev
37
+
38
+ # 2. One-time per project: create the shared backend (S3 state + DynamoDB lock)
39
+ # and the shared ECR repos, then wire backend.hcl. The prefix must be globally
40
+ # unique (e.g. your org slug). You do NOT repeat this for additional envs.
41
+ dude iac bootstrap --state-bucket-prefix <your-org> --env dev --yes
42
+
43
+ # 3. Initialise Terraform against the remote backend
44
+ dude iac init --env dev
45
+
46
+ # 4. Provision the infrastructure (VPC, EKS, ALB controller, …; ECR comes from bootstrap)
47
+ dude iac apply --env dev
48
+
49
+ # 5. Point kubectl at the new cluster
50
+ dude iac kubeconfig --env dev
51
+
52
+ # 6. Build, push and deploy the app in one step (build + push + helm upgrade --install).
53
+ # The ECR registry, image tag, and (when a domain is set) the TLS cert + host
54
+ # are wired automatically — no need to hand-edit values files.
55
+ dude iac ship --env dev
56
+ ```
57
+
58
+ Check what's running:
59
+
60
+ ```bash
61
+ dude iac status --env dev # helm release + pods
62
+ dude iac output --env dev # cluster name, ECR URLs, app domain…
63
+ ```
64
+
65
+ ## Add another environment (staging, prod, …)
66
+
67
+ Environments are independent infrastructure (their own VPC, cluster, database)
68
+ that **share one backend and one set of ECR repositories** — they differ only by
69
+ their Terraform state `key`. So adding `staging` does **not** require another
70
+ `bootstrap`; you scaffold the env folder, adjust its knobs, then init + apply.
71
+
72
+ ```bash
73
+ # 1. Scaffold environments/staging/ by copying an existing env (default: dev).
74
+ # Also copies its gitignored helm/app/values-<from>.yaml → values-staging.yaml.
75
+ dude iac new-env --env staging # or --from prod to copy a different one
76
+
77
+ # 2. Review the new env's settings — set its domain and bump sizing for the tier.
78
+ # Edit iac/terraform/environments/staging/terraform.tfvars:
79
+ # domain_name = "staging.example.com" # (optional) its own hostname
80
+ # node_desired_size / db_instance_class / … to taste
81
+ # …and iac/helm/app/values-staging.yaml (replicas, autoscaling, secrets, …).
82
+
83
+ # 3. Authenticate, initialise, and provision — same flow as the first env,
84
+ # minus bootstrap (the backend + ECR already exist).
85
+ dude iac login --env staging
86
+ dude iac init --env staging
87
+ dude iac apply --env staging
88
+ dude iac kubeconfig --env staging
89
+ dude iac ship --env staging
90
+ ```
91
+
92
+ > **Promoting an image.** Because the ECR repos are shared, you can deploy the
93
+ > exact image already built for one env to another instead of rebuilding:
94
+ > `dude iac deploy --env staging --tag <sha>` (use the tag from
95
+ > `dude iac status --env dev`).
96
+
97
+ ## HTTPS on a custom domain *(optional)*
98
+
99
+ Set these in `iac/terraform/environments/dev/terraform.tfvars` (the Route53
100
+ hosted zone must already exist), then re-run `dude iac init && dude iac apply`:
101
+
102
+ ```hcl
103
+ domain_name = "dev.example.com"
104
+ route53_zone_name = "example.com"
105
+ ```
106
+
107
+ Terraform issues a DNS-validated ACM certificate and runs external-dns to create
108
+ the record; `dude iac deploy`/`ship` then makes the ALB listen on 443 and
109
+ redirect HTTP→HTTPS automatically.
110
+
111
+ ## Ad-hoc work with `dude iac shell`
112
+
113
+ When you need to run commands directly against an environment — inspect state,
114
+ force-unlock a Terraform lock, debug a failing pod, or run a one-off Helm
115
+ operation — drop into the runner:
116
+
117
+ ```bash
118
+ dude iac shell --env dev
119
+ ```
120
+
121
+ This opens an interactive shell inside the Docker runner with the project
122
+ mounted at `/work`, the env's `AWS_PROFILE` set, and `kubectl`/`helm`/`k9s`
123
+ **already pointed at this env's cluster and namespace** — so you don't inherit
124
+ whatever context your host's `kubectl` happened to be on. (If the cluster isn't
125
+ reachable yet, it falls back to your mounted `~/.kube`.) The full toolchain is
126
+ available:
127
+
128
+ | Tool | Example |
129
+ |------|---------|
130
+ | `terraform` | `terraform state list` · `terraform force-unlock <id>` |
131
+ | `kubectl` | `kubectl get pods -n dev` · `kubectl logs <pod> -n dev -f` · `kubectl describe ingress -n dev` |
132
+ | `helm` | `helm get values {{projectName}} -n dev` · `helm history {{projectName}} -n dev` |
133
+ | `k9s` | `k9s` — full interactive cluster UI |
134
+ | `aws` | `aws eks list-clusters` · `aws s3 ls` |
135
+
136
+ The project root is `/work` — relative paths in Terraform and Helm configs
137
+ resolve correctly from there. Type `exit` (or Ctrl-D) to leave the runner.
138
+
139
+ ## Tear down
140
+
141
+ ```bash
142
+ dude iac destroy --env staging # destroy non-last envs first
143
+ dude iac destroy --env dev # the last env also removes the shared backend + ECR
144
+ ```
145
+
146
+ For each environment, `destroy` uninstalls the Helm release, deletes the
147
+ ALB / target groups / security groups the controller created, removes the Route53
148
+ records external-dns created for the env, and runs `terraform destroy`.
149
+
150
+ The **shared bootstrap** — the S3 state backend, the DynamoDB lock table, and the
151
+ ECR repositories — is torn down **only when no other environment is still
152
+ provisioned** (i.e. when you destroy the last one). "Still provisioned" is judged
153
+ from each sibling's remote Terraform state, not its folder on disk — so a
154
+ leftover `staging/` folder whose infrastructure you already destroyed won't keep
155
+ the backend alive. Destroying a non-last environment never touches another env's
156
+ state or the shared registry. Pass `--keep-backend` to keep the bootstrap even
157
+ when destroying the last environment.
158
+
159
+ See `iac/README.md` for the full command reference and flags.
@@ -0,0 +1,28 @@
1
+ # Production image for the frontend: build the Vite app, serve the static
2
+ # bundle with nginx. Used by the Helm deployment (port 80). The dev Dockerfile
3
+ # (Vite dev server) is kept for `dude up`.
4
+ #
5
+ # VITE_* values are baked in at build time — pass them as build args:
6
+ # docker build -f Dockerfile.prod --build-arg VITE_APP_TITLE="My App" -t <ecr>/<proj>-frontend:<tag> .
7
+
8
+ FROM node:22-alpine AS build
9
+ WORKDIR /app
10
+
11
+ RUN npm install -g pnpm@9
12
+
13
+ COPY package.json pnpm-lock.yaml* ./
14
+ RUN pnpm install --frozen-lockfile || pnpm install
15
+
16
+ ARG VITE_APP_TITLE=app
17
+ ARG VITE_REACT_QUERY_DEVTOOLS=false
18
+ ENV VITE_APP_TITLE=$VITE_APP_TITLE
19
+ ENV VITE_REACT_QUERY_DEVTOOLS=$VITE_REACT_QUERY_DEVTOOLS
20
+
21
+ COPY . .
22
+ RUN pnpm build
23
+
24
+ FROM nginx:1.27-alpine
25
+ COPY --from=build /app/dist /usr/share/nginx/html
26
+ COPY nginx.conf /etc/nginx/conf.d/default.conf
27
+ EXPOSE 80
28
+ CMD ["nginx", "-g", "daemon off;"]
@@ -0,0 +1,19 @@
1
+ # SPA routing. The /api traffic is routed to the backend by the ALB Ingress
2
+ # (path-based), so nginx only needs to serve the static bundle and fall back to
3
+ # index.html for client-side routes.
4
+ server {
5
+ listen 80;
6
+ server_name _;
7
+ root /usr/share/nginx/html;
8
+ index index.html;
9
+
10
+ location / {
11
+ try_files $uri $uri/ /index.html;
12
+ }
13
+
14
+ # Long-cache hashed assets.
15
+ location /assets/ {
16
+ expires 1y;
17
+ add_header Cache-Control "public, immutable";
18
+ }
19
+ }
@@ -0,0 +1,311 @@
1
+ # Infrastructure as Code — {{projectName}}
2
+
3
+ Deploys {{projectName}} to **AWS EKS** with **Terraform** (infrastructure) and
4
+ **Helm** (the application). Everything is environment-scoped and driven by
5
+ `dude iac …`, which works identically on your laptop and in CI/CD.
6
+
7
+ ```
8
+ iac/
9
+ ├── terraform/
10
+ │ ├── versions.tf # provider + S3 backend (partial)
11
+ │ ├── providers.tf # aws / kubernetes / helm (exec auth)
12
+ │ ├── variables.tf # all inputs (sane defaults)
13
+ │ ├── main.tf # VPC + EKS + ALB controller{{#if withPostgres}} + RDS{{/if}} (reads shared ECR)
14
+ │ ├── outputs.tf # cluster name, ECR URLs{{#if withPostgres}}, RDS endpoint{{/if}}
15
+ │ ├── bootstrap/ # one-time shared infra: S3 state bucket + DynamoDB lock + ECR repos
16
+ │ └── environments/
17
+ │ └── dev/
18
+ │ ├── backend.hcl # remote-state location for this env
19
+ │ └── terraform.tfvars # this env's sizing/knobs
20
+ └── helm/
21
+ └── app/ # the application chart (backend, frontend,{{#if withRedis}} redis,{{/if}}{{#if withCelery}} celery,{{/if}} ingress…)
22
+ ```
23
+
24
+ ## What gets provisioned
25
+
26
+ - **VPC** across 3 AZs (public + private{{#if withPostgres}} + database{{/if}} subnets), NAT gateway.
27
+ - **EKS** cluster + a managed node group.
28
+ - **ECR** repositories for the backend and frontend images — **shared** across
29
+ all environments (created by `bootstrap`), so one image is promoted dev →
30
+ staging → prod by tag rather than rebuilt per env.
31
+ - **AWS Load Balancer Controller** (for ALB Ingress), wired via IRSA.
32
+ {{#if withPostgres}}- **RDS PostgreSQL** (managed); the master password is generated by Terraform and exposed as the sensitive `database_url` output — **no AWS Secrets Manager**.
33
+ {{/if}}- **Redis**{{#if withRedis}} runs **in-cluster** via the Helm chart{{else}} is not used{{/if}}.
34
+
35
+ The application itself (backend, frontend,{{#if withCelery}} Celery worker{{#if withCeleryBeat}}, beat{{/if}}, Flower,{{/if}}{{#if withRedis}} Redis,{{/if}} Ingress) is deployed by the Helm chart.
36
+
37
+ ## Prerequisites
38
+
39
+ - **Docker** running, plus the `aws` CLI on your PATH.
40
+ - AWS credentials configured (`aws configure` or environment variables / SSO).
41
+
42
+ You do **not** need terraform, kubectl, helm or k9s installed — `dude iac` runs
43
+ them inside a container (see below). The `aws` CLI is still needed on the host
44
+ because `dude iac login` opens a browser for SSO.
45
+
46
+ ## The IaC runner (Docker)
47
+
48
+ `dude iac *` runs terraform / kubectl / helm / k9s inside a pinned container so
49
+ you don't have to install or version-match any of them locally. The image is
50
+ built on first use from `iac/runner/Dockerfile` — **which is yours to edit**
51
+ (bump a tool version, add a CLI). The image is tagged by a hash of that file, so
52
+ any change rebuilds automatically on the next command.
53
+
54
+ - **Credentials** are never copied in: your `~/.aws` is mounted read-only and
55
+ the environment's `AWS_PROFILE` is passed through, so named profiles and SSO
56
+ keep working. `~/.kube` is mounted too, so `kubeconfig`/`status`/`deploy`
57
+ share the cluster context.
58
+ - **`dude iac login`** is the one command that stays on the host (it needs a
59
+ browser for SSO); it writes the SSO token the container then reads.
60
+ - **`dude iac build`/`push`** use the host Docker daemon (they build app images);
61
+ everything else runs in the container.
62
+ - **Escape hatch**: set `DUDE_IAC_RUNNER=host` to run the tools natively from
63
+ your PATH instead (the legacy behaviour). If Docker isn't running, `dude iac`
64
+ falls back to native tools automatically.
65
+ - **`dude iac shell --env <env>`** drops you into the runner with all tools +
66
+ k9s, the env's profile and kubeconfig already wired — handy for ad-hoc
67
+ inspection or changes.
68
+
69
+ ## Credentials per environment
70
+
71
+ Each `dude iac …` command is environment-scoped via `--env`, which is
72
+ **required** — there is no default, so you never act on the wrong environment by
73
+ accident. Run any command without it to list the environments discovered under
74
+ `iac/terraform/environments/`. Each env resolves an **AWS profile**, so different
75
+ environments can point at different accounts/keys. The profile precedence:
76
+
77
+ 1. an explicit `--profile <name>` flag,
78
+ 2. an already-exported `AWS_PROFILE`,
79
+ 3. the convention `{{projectName}}-<env>` (e.g. `{{projectName}}-dev`, `{{projectName}}-prod`).
80
+
81
+ `dude iac login` configures/verifies that profile for you:
82
+
83
+ ```bash
84
+ dude iac login --env dev # configures {{projectName}}-dev if missing, else verifies it
85
+ ```
86
+
87
+ - If the profile doesn't exist, it runs `aws configure --profile {{projectName}}-<env>`.
88
+ - If it's an SSO profile, it runs `aws sso login --profile {{projectName}}-<env>`.
89
+ - Either way it ends with `aws sts get-caller-identity` to confirm you're in the
90
+ right account.
91
+
92
+ Once logged in, every other command targets the same profile automatically — no
93
+ need to `export AWS_PROFILE` by hand.
94
+
95
+ ## One-time: shared infra (state backend + ECR)
96
+
97
+ The Terraform state (S3 bucket + DynamoDB lock) and the ECR repositories are
98
+ shared by every environment. Create them and wire the backend into `backend.hcl`
99
+ in one step:
100
+
101
+ ```bash
102
+ dude iac bootstrap --state-bucket-prefix <your-org> --region eu-west-1 --env dev --yes
103
+ ```
104
+
105
+ This runs `terraform init/apply` inside `iac/terraform/bootstrap/` (local
106
+ state) — creating the state bucket, lock table, and the `{{projectName}}-backend`
107
+ / `{{projectName}}-frontend` ECR repos — then writes the resulting bucket and
108
+ table names directly into `iac/terraform/environments/dev/backend.hcl`. No manual
109
+ copy-paste needed. Per-env Terraform then reads the ECR repos by name, so the
110
+ bootstrap must run before the first `apply`.
111
+
112
+ ## Provision an environment
113
+
114
+ ```bash
115
+ dude iac login --env dev # configure/verify AWS credentials for this env
116
+ dude iac bootstrap --state-bucket-prefix <your-org> --env dev --yes # one-time
117
+ dude iac init --env dev # terraform init (configures the S3 backend)
118
+ dude iac plan --env dev # review changes
119
+ dude iac apply --env dev # create/update infrastructure
120
+ dude iac output --env dev # cluster name, ECR URLs{{#if withPostgres}}, RDS endpoint{{/if}}
121
+ ```
122
+
123
+ ## Build, push & deploy
124
+
125
+ `dude` drives the whole release. The ECR registry is read from Terraform
126
+ outputs and the image tag defaults to the **git short SHA** (with a `-dirty`
127
+ suffix if you have uncommitted changes), so every deploy is traceable to an
128
+ exact commit. Override with `--tag <tag>` (e.g. `--tag v1.2.3`).
129
+
130
+ The fast inner loop — build, push, and deploy in one step:
131
+
132
+ ```bash
133
+ dude iac kubeconfig --env dev # once per cluster: point kubectl/helm at it
134
+ dude iac ship --env dev # build → push → helm upgrade --install
135
+ dude iac status --env dev # release status + pods
136
+ ```
137
+
138
+ Or run the stages individually (handy in CI, where each is a separate stage):
139
+
140
+ ```bash
141
+ dude iac build --env dev # docker build BE+FE (linux/amd64) for the ECR repos
142
+ dude iac push --env dev # ECR login + docker push BE+FE
143
+ dude iac deploy --env dev # helm upgrade --install (auto-sets registry + tag)
144
+ ```
145
+
146
+ > **Platform** — images are built for `linux/amd64` by default to match the EKS
147
+ > x86 nodes. Building on Apple Silicon without this flag yields arm64 images that
148
+ > crash on the cluster with `exec format error`. Override with `--platform` if
149
+ > your node group is arm64 (Graviton).
150
+
151
+ `deploy` injects `image.registry` and the image tags via `--set`, so you do not
152
+ hand-edit them into `values-dev.yaml` — that file is still layered for the rest
153
+ (resources, replicas{{#if withPostgres}}, secrets{{/if}}…).
154
+
155
+ > **Config & secrets** — every app container loads its env via `envFrom` from a
156
+ > ConfigMap (`.Values.config`) and a Secret (`.Values.secrets`). Each key is the
157
+ > ENV VAR NAME exactly as `app/core/config.py` reads it, so adding a variable is
158
+ > one line under `config:` / `secrets:` plus the field in `config.py`. Per-env
159
+ > `values-<env>.yaml` files are **gitignored** (they may hold secrets like API
160
+ > keys); the committed `values.yaml` is the documented reference.
161
+
162
+ {{#if withPostgres}}`secrets.DATABASE_URL` must be present (the chart refuses to deploy otherwise),
163
+ but you don't set it by hand: `dude iac ship`/`deploy` injects it via
164
+ `--set-string` from the Terraform `database_url` output (`dude iac output database_url`).
165
+
166
+ {{/if}}Find the public URL:
167
+
168
+ ```bash
169
+ kubectl get ingress -n dev
170
+ ```
171
+
172
+ ## HTTPS / TLS (custom domain)
173
+
174
+ By default the app is served over plain **HTTP** via the ALB's own DNS name.
175
+ The ALB hostname (`*.elb.amazonaws.com`) belongs to AWS, so you can't put a
176
+ browser-trusted certificate on it — TLS requires **a domain you own**.
177
+
178
+ If your domain's hosted zone is in **Route53**, it's fully automated. Set two
179
+ variables in `iac/terraform/environments/<env>/terraform.tfvars`:
180
+
181
+ ```hcl
182
+ domain_name = "dev.example.com" # the hostname for this environment
183
+ route53_zone_name = "example.com" # the existing Route53 hosted zone
184
+ ```
185
+
186
+ Then re-apply and re-deploy:
187
+
188
+ ```bash
189
+ dude iac apply --env dev # issues an ACM cert (DNS-validated) + runs external-dns
190
+ dude iac deploy --env dev # wires the cert ARN + host into the ALB Ingress
191
+ ```
192
+
193
+ What happens under the hood:
194
+
195
+ - Terraform issues a **regional ACM certificate** for `domain_name` and validates
196
+ it automatically by writing the DNS records into your Route53 zone.
197
+ - Terraform installs **external-dns**, which watches the Ingress and creates the
198
+ Route53 record pointing `domain_name` at the ALB (it runs `upsert-only`, so it
199
+ never deletes records).
200
+ - `dude iac deploy` passes the cert ARN and host to Helm, so the ALB listens on
201
+ **443** with the cert and **redirects HTTP→HTTPS**.
202
+
203
+ The certificate is regional and lives in `var.region` (same region as the ALB).
204
+ DNS propagation + cert validation take a couple of minutes on first apply.
205
+
206
+ > **DNS elsewhere (not Route53)?** Keep `route53_zone_name` empty isn't an option —
207
+ > instead create the ACM cert manually (or import the zone), add the validation
208
+ > CNAME at your provider, point a CNAME at the ALB by hand, and set
209
+ > `ingress.certificateArn` / `ingress.host` in `values-<env>.yaml`. The Route53
210
+ > path above is the only fully-automated one.
211
+
212
+ ## Add a new environment
213
+
214
+ ```bash
215
+ dude iac new-env --env prod # copies dev by default; use --from <env> to pick the source
216
+ ```
217
+
218
+ This scaffolds `iac/terraform/environments/prod/{backend.hcl,terraform.tfvars}`,
219
+ setting `environment = "prod"` and a per-env state `key` (the S3 bucket + lock
220
+ table **and the ECR repos** are **shared** across environments, so you don't
221
+ bootstrap again unless this is the first env on a brand-new backend). It also
222
+ copies the source env's gitignored `iac/helm/app/values-<from>.yaml` to
223
+ `values-prod.yaml` when present, so the new env starts from the same Helm
224
+ overrides + secrets instead of the bare `values.yaml` defaults. After
225
+ scaffolding, run `dude iac init --env prod` then `apply`.
226
+
227
+ Then edit `environments/prod/terraform.tfvars` (bigger nodes,{{#if withPostgres}} `db_multi_az = true`, `db_deletion_protection = true`,{{/if}} domain, …)
228
+ and `iac/helm/app/values-prod.yaml` (replicas, autoscaling, secrets, …), and run
229
+ every command with `--env prod`:
230
+
231
+ ```bash
232
+ dude iac init --env prod && dude iac apply --env prod && dude iac ship --env prod
233
+ ```
234
+
235
+ ## Local vs CI/CD
236
+
237
+ The exact same commands run in CI — state is remote (S3) and auth is via the
238
+ AWS CLI exec plugin, so no kubeconfig file is committed. A pipeline typically
239
+ runs: `dude iac init/plan/apply` → `dude iac build` → `dude iac push` →
240
+ `dude iac deploy` (or `dude iac ship` to collapse the last three). Pass an
241
+ explicit `--tag $CI_COMMIT_SHA` so the pipeline controls provenance.
242
+
243
+ ## Tear down
244
+
245
+ ```bash
246
+ dude iac destroy --env dev
247
+ ```
248
+
249
+ `destroy` tears down **everything** for the environment, in order:
250
+
251
+ 1. uninstalls the Helm release;
252
+ 2. deletes any load balancers, target groups and managed security groups still
253
+ tagged for the cluster (these are created by the in-cluster controller, not
254
+ Terraform, and otherwise block the VPC/subnet teardown);
255
+ 3. removes the Route53 records external-dns created for this env (it runs
256
+ upsert-only and never deletes them itself, so they would otherwise outlive
257
+ the ALB they point at and block the next deploy from reusing the hostname);
258
+ 4. `terraform destroy` of the environment infrastructure (this never touches the
259
+ shared ECR repos — they live in the bootstrap state, not the per-env one);
260
+ 5. tears down the bootstrap — the shared state backend (S3 bucket + DynamoDB lock
261
+ table) **and** the shared ECR repos — but **only if no other environment still
262
+ uses it** (see the note below).
263
+
264
+ Flags for finer control:
265
+
266
+ | Flag | Effect |
267
+ | ---------------- | ------------------------------------------------------------------- |
268
+ | `--keep-backend` | Keep the shared bootstrap (S3/DynamoDB state backend **+ ECR repos**). It is kept automatically while another environment still uses it; pass this to force-keep it even when destroying the last environment. |
269
+ | `--skip-helm` | Skip the Helm uninstall (the release is already gone). LB cleanup still runs. |
270
+ | `--skip-tf` | Skip the per-env `terraform destroy` — only run cleanup + backend teardown. |
271
+
272
+ > The bootstrap holds the project-wide shared resources — the state backend (S3
273
+ > bucket + DynamoDB lock table) **and** the ECR repos — used by every environment
274
+ > (they differ only by their state `key`). To protect the other environments'
275
+ > state *and registry*, `destroy` automatically **keeps** the bootstrap whenever
276
+ > another environment is **still provisioned**, and only tears it down when
277
+ > you're destroying the **last** one. Whether a sibling is "still provisioned" is
278
+ > read from its remote Terraform state (empty after a destroy), not from its
279
+ > folder on disk — so a leftover env folder you already destroyed won't keep the
280
+ > backend alive. Pass `--keep-backend` to force-keep it even then. (A per-env
281
+ > `destroy` never deletes the shared ECR — the repos aren't in the per-env state.)
282
+
283
+ ## Commands
284
+
285
+ | Command | Wraps |
286
+ |---------|-------|
287
+ | `dude iac login` | `aws configure` / `aws sso login` + `sts get-caller-identity` |
288
+ | `dude iac new-env` | scaffolds `environments/<name>/` from an existing env (`--env <name>`, `--from <src>`) |
289
+ | `dude iac bootstrap` | `terraform init/apply` in `bootstrap/`, patches `backend.hcl` |
290
+ | `dude iac init` | `terraform init` (S3 backend per env) |
291
+ | `dude iac plan` | `terraform plan` |
292
+ | `dude iac apply` | `terraform apply` (`--yes` to auto-approve) |
293
+ | `dude iac destroy` | helm uninstall + ALB/SG cleanup + `terraform destroy` + backend teardown (`--yes`, `--keep-backend`, `--skip-helm`, `--skip-tf`) |
294
+ | `dude iac output` | `terraform output` (`--json`) |
295
+ | `dude iac fmt` | `terraform fmt -recursive` |
296
+ | `dude iac validate` | `terraform validate` |
297
+ | `dude iac build` | `docker build` BE+FE prod images (`linux/amd64`) |
298
+ | `dude iac push` | ECR login + `docker push` BE+FE |
299
+ | `dude iac kubeconfig`| `aws eks update-kubeconfig` from outputs |
300
+ | `dude iac deploy` | `helm upgrade --install` (auto-sets registry + tag + TLS cert/host) |
301
+ | `dude iac ship` | `build` + `push` + `deploy` |
302
+ | `dude iac status` | `helm status` + `kubectl get pods` |
303
+ | `dude iac shell` | interactive shell in the IaC runner container (terraform, kubectl, helm, k9s, aws) |
304
+
305
+ All commands take `--env <name>` (**required**; autodiscovered from
306
+ `environments/*`) and `--profile <name>` (AWS profile override; defaults to
307
+ `{{projectName}}-<env>` or `$AWS_PROFILE`).
308
+ `build`/`push`/`deploy`/`ship` take `--tag <tag>` (default: git short SHA,
309
+ `-dirty` if uncommitted); `build`/`ship` also take `--platform` (default
310
+ `linux/amd64`). `bootstrap` accepts `--state-bucket-prefix` (required) and
311
+ `--region` (default `eu-west-1`).
@@ -0,0 +1,24 @@
1
+ # Terraform
2
+ **/.terraform/*
3
+ *.tfstate
4
+ *.tfstate.*
5
+ crash.log
6
+ crash.*.log
7
+ *.tfvars.local
8
+ override.tf
9
+ override.tf.json
10
+ *_override.tf
11
+ *_override.tf.json
12
+ .terraformrc
13
+ terraform.rc
14
+ .terraform.lock.hcl
15
+
16
+ # Helm
17
+ *.tgz
18
+ charts/*.tgz
19
+
20
+ # Per-environment Helm values hold real config + secrets (e.g. API keys) and are
21
+ # never committed. The committed `values.yaml` is the documented reference; copy
22
+ # its structure into `values-<env>.yaml` locally. DATABASE_URL is injected at
23
+ # deploy time from Terraform, so it doesn't belong in any committed file.
24
+ **/values-*.yaml
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ .git/
3
+ .gitignore
4
+ *.tmp
5
+ *.bak
6
+ *.orig
7
+ .vscode/
@@ -0,0 +1,6 @@
1
+ apiVersion: v2
2
+ name: {{projectName}}
3
+ description: Helm chart for the {{projectName}} application (React + FastAPI on EKS).
4
+ type: application
5
+ version: 0.1.0
6
+ appVersion: "0.1.0"
@@ -0,0 +1,23 @@
1
+ {{ .Chart.Name }} deployed as release "{{ .Release.Name }}" in namespace "{{ .Release.Namespace }}".
2
+
3
+ 1. Find the ALB address (may take a minute to provision):
4
+
5
+ kubectl get ingress {{ include "app.fullname" . }} -n {{ .Release.Namespace }} \
6
+ -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
7
+
8
+ Then open http://<that-hostname>/ (API is served under /api).
9
+ {{- if .Values.database.enabled }}
10
+
11
+ 2. Database: the pre-upgrade migration job runs `alembic upgrade head`.
12
+ The app reads DATABASE_URL from the Secret {{ include "app.fullname" . }}-secret;
13
+ `dude iac ship`/`deploy` wires it in automatically from the Terraform output.
14
+ {{- end }}
15
+ {{- if and .Values.celery.enabled .Values.celery.flower.enabled }}
16
+
17
+ 3. Flower (Celery monitor) is internal. Reach it with:
18
+
19
+ kubectl port-forward svc/{{ include "app.fullname" . }}-flower {{ .Values.celery.flower.port }}:{{ .Values.celery.flower.port }} -n {{ .Release.Namespace }}
20
+ {{- end }}
21
+
22
+ Pods: kubectl get pods -n {{ .Release.Namespace }}
23
+ Status: dude iac status --env <env>