@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,53 @@
1
+ # IaC runner image — the toolchain `dude iac *` runs inside.
2
+ #
3
+ # `dude iac` builds this image on first use and runs terraform / kubectl / helm /
4
+ # k9s inside it, so you don't have to install (or version-match) any of them on
5
+ # your machine. The image is tagged by a hash of THIS file: edit it (bump a
6
+ # version, add a tool) and the next `dude iac` command rebuilds automatically.
7
+ #
8
+ # Your AWS credentials are NOT baked in — `dude iac` mounts ~/.aws read-only at
9
+ # run time, so named profiles and SSO keep working. `dude iac login` runs on the
10
+ # host (it needs a browser); everything else runs in here.
11
+ #
12
+ # TARGETARCH is set automatically by Docker BuildKit (amd64 or arm64).
13
+
14
+ FROM debian:bookworm-slim
15
+ ARG TARGETARCH
16
+ ENV DEBIAN_FRONTEND=noninteractive
17
+
18
+ # Keep kubectl within ±1 minor of the EKS control plane (currently 1.36).
19
+ ARG TF_VERSION=1.10.5
20
+ ARG KUBECTL_VERSION=1.36.0
21
+ ARG HELM_VERSION=3.16.4
22
+ ARG K9S_VERSION=0.32.7
23
+
24
+ RUN apt-get update && apt-get install -y --no-install-recommends \
25
+ curl unzip ca-certificates bash less groff git \
26
+ && rm -rf /var/lib/apt/lists/*
27
+
28
+ # terraform
29
+ RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
30
+ "https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip" -o /tmp/tf.zip \
31
+ && unzip -q /tmp/tf.zip -d /usr/local/bin && rm /tmp/tf.zip
32
+
33
+ # kubectl
34
+ RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
35
+ "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl" -o /usr/local/bin/kubectl \
36
+ && chmod +x /usr/local/bin/kubectl
37
+
38
+ # helm
39
+ RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
40
+ "https://get.helm.sh/helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz" | tar xz -C /tmp \
41
+ && mv /tmp/linux-${TARGETARCH}/helm /usr/local/bin/helm && rm -rf /tmp/linux-${TARGETARCH}
42
+
43
+ # k9s
44
+ RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
45
+ "https://github.com/derailed/k9s/releases/download/v${K9S_VERSION}/k9s_Linux_${TARGETARCH}.tar.gz" | tar xz -C /usr/local/bin k9s
46
+
47
+ # aws cli v2 (arch naming differs: amd64 -> x86_64, arm64 -> aarch64)
48
+ RUN case "${TARGETARCH}" in amd64) A=x86_64;; arm64) A=aarch64;; *) A=${TARGETARCH};; esac \
49
+ && curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
50
+ "https://awscli.amazonaws.com/awscli-exe-linux-${A}.zip" -o /tmp/aws.zip \
51
+ && unzip -q /tmp/aws.zip -d /tmp && /tmp/aws/install && rm -rf /tmp/aws*
52
+
53
+ WORKDIR /work
@@ -0,0 +1,101 @@
1
+ # Bootstrap — creates the project-wide shared resources: the S3 bucket +
2
+ # DynamoDB table that hold Terraform remote state for every environment, and the
3
+ # ECR repositories the app images are pushed to. These are SHARED across all
4
+ # environments (one image, promoted dev → staging → prod by tag), so they have a
5
+ # single owner here rather than being recreated by each per-env config — which
6
+ # would otherwise collide (RepositoryAlreadyExistsException) and let one env's
7
+ # `destroy` delete another env's registry. Run ONCE per project, with LOCAL state
8
+ # (this config has no remote backend on purpose), then paste the outputs into
9
+ # each environment's backend.hcl.
10
+ #
11
+ # cd iac/terraform/bootstrap
12
+ # terraform init
13
+ # terraform apply -var project_name={{projectName}} -var region=eu-west-1
14
+
15
+ terraform {
16
+ required_version = ">= 1.6.0"
17
+ required_providers {
18
+ aws = {
19
+ source = "hashicorp/aws"
20
+ version = "~> 5.60"
21
+ }
22
+ }
23
+ }
24
+
25
+ provider "aws" {
26
+ region = var.region
27
+
28
+ # Pin to the standard public endpoints — the AWS provider 5.x enables
29
+ # endpoint discovery by default for DynamoDB, which can return a
30
+ # VPC-endpoint-scoped URL that doesn't resolve from a local machine.
31
+ endpoints {
32
+ dynamodb = "https://dynamodb.${var.region}.amazonaws.com"
33
+ s3 = "https://s3.${var.region}.amazonaws.com"
34
+ }
35
+ }
36
+
37
+ resource "aws_s3_bucket" "state" {
38
+ bucket = "${var.state_bucket_prefix}-${var.project_name}-tfstate"
39
+
40
+ # Allow `dude iac destroy` to remove the bucket even though versioning keeps
41
+ # old object versions around (the command also empties it first).
42
+ force_destroy = true
43
+ }
44
+
45
+ resource "aws_s3_bucket_versioning" "state" {
46
+ bucket = aws_s3_bucket.state.id
47
+ versioning_configuration {
48
+ status = "Enabled"
49
+ }
50
+ }
51
+
52
+ resource "aws_s3_bucket_server_side_encryption_configuration" "state" {
53
+ bucket = aws_s3_bucket.state.id
54
+ rule {
55
+ apply_server_side_encryption_by_default {
56
+ sse_algorithm = "AES256"
57
+ }
58
+ }
59
+ }
60
+
61
+ resource "aws_s3_bucket_public_access_block" "state" {
62
+ bucket = aws_s3_bucket.state.id
63
+ block_public_acls = true
64
+ block_public_policy = true
65
+ ignore_public_acls = true
66
+ restrict_public_buckets = true
67
+ }
68
+
69
+ resource "aws_dynamodb_table" "lock" {
70
+ name = "${var.project_name}-tflock"
71
+ billing_mode = "PAY_PER_REQUEST"
72
+ hash_key = "LockID"
73
+
74
+ attribute {
75
+ name = "LockID"
76
+ type = "S"
77
+ }
78
+ }
79
+
80
+ # Shared ECR repositories — one per image, used by every environment. Per-env
81
+ # Terraform reads these by name via a data source; they are created/destroyed
82
+ # only here, with the rest of the shared backend.
83
+ resource "aws_ecr_repository" "backend" {
84
+ name = "${var.project_name}-backend"
85
+ image_tag_mutability = "MUTABLE"
86
+ force_delete = true
87
+
88
+ image_scanning_configuration {
89
+ scan_on_push = true
90
+ }
91
+ }
92
+
93
+ resource "aws_ecr_repository" "frontend" {
94
+ name = "${var.project_name}-frontend"
95
+ image_tag_mutability = "MUTABLE"
96
+ force_delete = true
97
+
98
+ image_scanning_configuration {
99
+ scan_on_push = true
100
+ }
101
+ }
@@ -0,0 +1,19 @@
1
+ output "state_bucket" {
2
+ description = "Set this as `bucket` in every environment's backend.hcl."
3
+ value = aws_s3_bucket.state.id
4
+ }
5
+
6
+ output "lock_table" {
7
+ description = "Set this as `dynamodb_table` in every environment's backend.hcl."
8
+ value = aws_dynamodb_table.lock.name
9
+ }
10
+
11
+ output "ecr_backend_repository_url" {
12
+ description = "Shared ECR repository URL for the backend image."
13
+ value = aws_ecr_repository.backend.repository_url
14
+ }
15
+
16
+ output "ecr_frontend_repository_url" {
17
+ description = "Shared ECR repository URL for the frontend image."
18
+ value = aws_ecr_repository.frontend.repository_url
19
+ }
@@ -0,0 +1,17 @@
1
+ variable "project_name" {
2
+ description = "Project slug — used to name the state bucket and lock table."
3
+ type = string
4
+ default = "{{projectName}}"
5
+ }
6
+
7
+ variable "region" {
8
+ description = "AWS region for the state bucket + lock table."
9
+ type = string
10
+ default = "eu-west-1"
11
+ }
12
+
13
+ variable "state_bucket_prefix" {
14
+ description = "Prefix to make the S3 bucket name globally unique (e.g. your org slug)."
15
+ type = string
16
+ default = "change-me"
17
+ }
@@ -0,0 +1,12 @@
1
+ # Remote state for the `dev` environment.
2
+ # These resources are created once by `iac/terraform/bootstrap` (see the IaC
3
+ # README). The same backend works locally and from CI/CD.
4
+ #
5
+ # Each environment uses a distinct `key`, so adding `staging`/`prod` is just a
6
+ # new folder with its own backend.hcl + terraform.tfvars.
7
+
8
+ bucket = "CHANGE-ME-{{projectName}}-tfstate"
9
+ key = "{{projectName}}/dev/terraform.tfstate"
10
+ region = "eu-west-1"
11
+ dynamodb_table = "{{projectName}}-tflock"
12
+ encrypt = true
@@ -0,0 +1,32 @@
1
+ # dev environment — small, cost-conscious defaults.
2
+ # Copy this folder to add a new environment (e.g. environments/prod) and bump
3
+ # the sizing / durability knobs there.
4
+
5
+ environment = "dev"
6
+ region = "eu-west-1"
7
+
8
+ # TLS + DNS (optional) — uncomment and set to serve HTTPS on your own domain.
9
+ # The hosted zone must already exist in Route53. Terraform then issues an ACM
10
+ # certificate (DNS-validated) and runs external-dns to create the record; the
11
+ # ALB will listen on 443 and redirect HTTP→HTTPS. Leave commented for plain HTTP.
12
+ # domain_name = "dev.example.com"
13
+ # route53_zone_name = "example.com"
14
+
15
+ # Network
16
+ single_nat_gateway = true
17
+
18
+ # EKS
19
+ cluster_version = "1.36"
20
+ node_instance_types = ["t3.medium"]
21
+ node_min_size = 2
22
+ node_max_size = 4
23
+ node_desired_size = 2
24
+ {{#if withPostgres}}
25
+
26
+ # RDS (PostgreSQL)
27
+ db_instance_class = "db.t4g.micro"
28
+ db_allocated_storage = 20
29
+ db_multi_az = false
30
+ db_deletion_protection = false
31
+ db_skip_final_snapshot = true
32
+ {{/if}}
@@ -0,0 +1,305 @@
1
+ locals {
2
+ name = "${var.project_name}-${var.environment}"
3
+ }
4
+
5
+ data "aws_availability_zones" "available" {
6
+ state = "available"
7
+ }
8
+
9
+ # ── Network ───────────────────────────────────────────────────────────────────
10
+ module "vpc" {
11
+ source = "terraform-aws-modules/vpc/aws"
12
+ version = "~> 5.13"
13
+
14
+ name = local.name
15
+ cidr = var.vpc_cidr
16
+
17
+ azs = slice(data.aws_availability_zones.available.names, 0, 3)
18
+ public_subnets = var.public_subnets
19
+ private_subnets = var.private_subnets
20
+ {{#if withPostgres}}
21
+
22
+ database_subnets = var.database_subnets
23
+ create_database_subnet_group = true
24
+ {{/if}}
25
+
26
+ enable_nat_gateway = true
27
+ single_nat_gateway = var.single_nat_gateway
28
+ enable_dns_hostnames = true
29
+
30
+ # Subnet tags required by the AWS Load Balancer Controller for auto-discovery.
31
+ public_subnet_tags = {
32
+ "kubernetes.io/role/elb" = 1
33
+ }
34
+ private_subnet_tags = {
35
+ "kubernetes.io/role/internal-elb" = 1
36
+ }
37
+ }
38
+
39
+ # ── EKS cluster + managed node group ────────────────────────────────────────────
40
+ module "eks" {
41
+ source = "terraform-aws-modules/eks/aws"
42
+ version = "~> 20.24"
43
+
44
+ cluster_name = local.name
45
+ cluster_version = var.cluster_version
46
+
47
+ cluster_endpoint_public_access = true
48
+ enable_cluster_creator_admin_permissions = true
49
+
50
+ vpc_id = module.vpc.vpc_id
51
+ subnet_ids = module.vpc.private_subnets
52
+
53
+ eks_managed_node_groups = {
54
+ default = {
55
+ instance_types = var.node_instance_types
56
+ min_size = var.node_min_size
57
+ max_size = var.node_max_size
58
+ desired_size = var.node_desired_size
59
+ }
60
+ }
61
+ }
62
+
63
+ # ── Container registries ────────────────────────────────────────────────────────
64
+ # ECR repositories are SHARED across environments and owned by the bootstrap
65
+ # config (one image, promoted dev → staging → prod by tag). Each repo's URL is
66
+ # deterministic — "<account>.dkr.ecr.<region>.amazonaws.com/<name>" — so we
67
+ # build it from the caller's account id rather than querying the ECR API. That
68
+ # keeps a second env from colliding on the repos, stops any env's destroy from
69
+ # deleting another's registry, and (unlike an `aws_ecr_repository` data source)
70
+ # never makes plan/apply/destroy depend on the ECR API being reachable.
71
+ data "aws_caller_identity" "current" {}
72
+
73
+ locals {
74
+ ecr_registry = "${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.region}.amazonaws.com"
75
+ ecr_backend_url = "${local.ecr_registry}/${var.project_name}-backend"
76
+ ecr_frontend_url = "${local.ecr_registry}/${var.project_name}-frontend"
77
+ }
78
+
79
+ # ── AWS Load Balancer Controller (for ALB Ingress) ──────────────────────────────
80
+ module "lb_controller_irsa" {
81
+ source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
82
+ version = "~> 5.44"
83
+
84
+ role_name = "${local.name}-alb-controller"
85
+ attach_load_balancer_controller_policy = true
86
+
87
+ oidc_providers = {
88
+ main = {
89
+ provider_arn = module.eks.oidc_provider_arn
90
+ namespace_service_accounts = ["kube-system:aws-load-balancer-controller"]
91
+ }
92
+ }
93
+ }
94
+
95
+ resource "helm_release" "alb_controller" {
96
+ name = "aws-load-balancer-controller"
97
+ repository = "https://aws.github.io/eks-charts"
98
+ chart = "aws-load-balancer-controller"
99
+ namespace = "kube-system"
100
+ version = var.alb_controller_chart_version
101
+
102
+ set {
103
+ name = "clusterName"
104
+ value = module.eks.cluster_name
105
+ }
106
+ set {
107
+ name = "region"
108
+ value = var.region
109
+ }
110
+ set {
111
+ name = "vpcId"
112
+ value = module.vpc.vpc_id
113
+ }
114
+ set {
115
+ name = "serviceAccount.create"
116
+ value = "true"
117
+ }
118
+ set {
119
+ name = "serviceAccount.name"
120
+ value = "aws-load-balancer-controller"
121
+ }
122
+ set {
123
+ name = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
124
+ value = module.lb_controller_irsa.iam_role_arn
125
+ }
126
+
127
+ depends_on = [module.eks]
128
+ }
129
+
130
+ # ── TLS + DNS (optional — enabled when var.domain_name is set) ───────────────────
131
+ # When you provide a domain whose hosted zone lives in Route53, Terraform:
132
+ # 1. issues a regional ACM certificate for it (validated automatically via DNS), and
133
+ # 2. runs external-dns, which creates/updates the Route53 record pointing the
134
+ # domain at the ALB that the Ingress provisions.
135
+ # `dude iac deploy` then wires the cert ARN + host into the Helm release, so the
136
+ # ALB listens on 443 and redirects HTTP→HTTPS. Leave domain_name empty to keep
137
+ # plain HTTP served via the ALB's own DNS name.
138
+ data "aws_route53_zone" "this" {
139
+ count = var.domain_name == "" ? 0 : 1
140
+ name = var.route53_zone_name
141
+ private_zone = false
142
+ }
143
+
144
+ resource "aws_acm_certificate" "app" {
145
+ count = var.domain_name == "" ? 0 : 1
146
+ domain_name = var.domain_name
147
+ validation_method = "DNS"
148
+
149
+ lifecycle {
150
+ create_before_destroy = true
151
+ }
152
+ }
153
+
154
+ resource "aws_route53_record" "cert_validation" {
155
+ for_each = var.domain_name == "" ? {} : {
156
+ for dvo in aws_acm_certificate.app[0].domain_validation_options : dvo.domain_name => {
157
+ name = dvo.resource_record_name
158
+ type = dvo.resource_record_type
159
+ record = dvo.resource_record_value
160
+ }
161
+ }
162
+
163
+ zone_id = data.aws_route53_zone.this[0].zone_id
164
+ name = each.value.name
165
+ type = each.value.type
166
+ records = [each.value.record]
167
+ ttl = 60
168
+ allow_overwrite = true
169
+ }
170
+
171
+ resource "aws_acm_certificate_validation" "app" {
172
+ count = var.domain_name == "" ? 0 : 1
173
+ certificate_arn = aws_acm_certificate.app[0].arn
174
+ validation_record_fqdns = [for r in aws_route53_record.cert_validation : r.fqdn]
175
+ }
176
+
177
+ # external-dns reconciles Route53 records from Ingress hosts. Policy is
178
+ # upsert-only: it never deletes records at runtime, so a transiently removed
179
+ # Ingress won't take DNS down with it. Deliberate teardown is handled instead by
180
+ # `dude iac destroy`, which removes this env's records (matched by the txtOwnerId
181
+ # below) so they don't outlive the ALB they point at.
182
+ module "external_dns_irsa" {
183
+ count = var.domain_name == "" ? 0 : 1
184
+ source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
185
+ version = "~> 5.44"
186
+
187
+ role_name = "${local.name}-external-dns"
188
+ attach_external_dns_policy = true
189
+ external_dns_hosted_zone_arns = [data.aws_route53_zone.this[0].arn]
190
+
191
+ oidc_providers = {
192
+ main = {
193
+ provider_arn = module.eks.oidc_provider_arn
194
+ namespace_service_accounts = ["kube-system:external-dns"]
195
+ }
196
+ }
197
+ }
198
+
199
+ resource "helm_release" "external_dns" {
200
+ count = var.domain_name == "" ? 0 : 1
201
+ name = "external-dns"
202
+ repository = "https://kubernetes-sigs.github.io/external-dns"
203
+ chart = "external-dns"
204
+ namespace = "kube-system"
205
+ version = var.external_dns_chart_version
206
+
207
+ set {
208
+ name = "provider"
209
+ value = "aws"
210
+ }
211
+ set {
212
+ name = "policy"
213
+ value = "upsert-only"
214
+ }
215
+ set {
216
+ name = "txtOwnerId"
217
+ value = local.name
218
+ }
219
+ set {
220
+ name = "domainFilters[0]"
221
+ value = var.route53_zone_name
222
+ }
223
+ set {
224
+ name = "serviceAccount.name"
225
+ value = "external-dns"
226
+ }
227
+ set {
228
+ name = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
229
+ value = module.external_dns_irsa[0].iam_role_arn
230
+ }
231
+
232
+ depends_on = [module.eks]
233
+ }
234
+ {{#if withPostgres}}
235
+
236
+ # ── RDS (PostgreSQL) ────────────────────────────────────────────────────────────
237
+ # Master password is generated here and surfaced through the `database_url`
238
+ # output (sensitive) — we do NOT use AWS Secrets Manager. `special = false`
239
+ # keeps it URL- and `helm --set`-safe (no characters that need escaping).
240
+ resource "random_password" "db" {
241
+ length = 32
242
+ special = false
243
+ }
244
+
245
+ resource "aws_security_group" "rds" {
246
+ name_prefix = "${local.name}-rds-"
247
+ description = "Allow PostgreSQL from within the VPC"
248
+ vpc_id = module.vpc.vpc_id
249
+
250
+ ingress {
251
+ description = "PostgreSQL from the VPC"
252
+ from_port = 5432
253
+ to_port = 5432
254
+ protocol = "tcp"
255
+ cidr_blocks = [var.vpc_cidr]
256
+ }
257
+
258
+ egress {
259
+ from_port = 0
260
+ to_port = 0
261
+ protocol = "-1"
262
+ cidr_blocks = ["0.0.0.0/0"]
263
+ }
264
+
265
+ lifecycle {
266
+ create_before_destroy = true
267
+ }
268
+ }
269
+
270
+ module "rds" {
271
+ source = "terraform-aws-modules/rds/aws"
272
+ version = "~> 6.10"
273
+
274
+ identifier = "${local.name}-postgres"
275
+
276
+ engine = "postgres"
277
+ engine_version = var.db_engine_version
278
+ family = var.db_parameter_group_family
279
+ major_engine_version = var.db_major_engine_version
280
+ instance_class = var.db_instance_class
281
+
282
+ allocated_storage = var.db_allocated_storage
283
+ max_allocated_storage = var.db_max_allocated_storage
284
+
285
+ db_name = var.db_name
286
+ username = var.db_username
287
+ password = random_password.db.result
288
+ port = 5432
289
+
290
+ # Manage the password ourselves via random_password (above) — not Secrets Manager.
291
+ manage_master_user_password = false
292
+
293
+ multi_az = var.db_multi_az
294
+ create_db_subnet_group = true
295
+ subnet_ids = module.vpc.database_subnets
296
+ vpc_security_group_ids = [aws_security_group.rds.id]
297
+
298
+ maintenance_window = "Mon:00:00-Mon:03:00"
299
+ backup_window = "03:00-06:00"
300
+ backup_retention_period = var.db_backup_retention_period
301
+
302
+ deletion_protection = var.db_deletion_protection
303
+ skip_final_snapshot = var.db_skip_final_snapshot
304
+ }
305
+ {{/if}}
@@ -0,0 +1,52 @@
1
+ output "region" {
2
+ description = "AWS region the cluster runs in."
3
+ value = var.region
4
+ }
5
+
6
+ output "cluster_name" {
7
+ description = "EKS cluster name (use with `aws eks update-kubeconfig`)."
8
+ value = module.eks.cluster_name
9
+ }
10
+
11
+ output "cluster_endpoint" {
12
+ description = "EKS API server endpoint."
13
+ value = module.eks.cluster_endpoint
14
+ }
15
+
16
+ output "ecr_backend_repository_url" {
17
+ description = "ECR repository URL for the backend image (shared; owned by bootstrap)."
18
+ value = local.ecr_backend_url
19
+ }
20
+
21
+ output "ecr_frontend_repository_url" {
22
+ description = "ECR repository URL for the frontend image (shared; owned by bootstrap)."
23
+ value = local.ecr_frontend_url
24
+ }
25
+
26
+ output "acm_certificate_arn" {
27
+ description = "ACM certificate ARN for the app domain (empty when no domain is configured)."
28
+ value = var.domain_name == "" ? "" : aws_acm_certificate.app[0].arn
29
+ }
30
+
31
+ output "app_domain" {
32
+ description = "Public hostname the app is served on (empty when no domain is configured)."
33
+ value = var.domain_name
34
+ }
35
+ {{#if withPostgres}}
36
+
37
+ output "rds_endpoint" {
38
+ description = "RDS PostgreSQL connection endpoint (host:port)."
39
+ value = module.rds.db_instance_endpoint
40
+ }
41
+
42
+ output "rds_database_name" {
43
+ description = "Initial database name."
44
+ value = var.db_name
45
+ }
46
+
47
+ output "database_url" {
48
+ description = "Full PostgreSQL connection string for the app. `dude iac ship`/`deploy` wires this into the Helm release automatically."
49
+ value = "postgresql://${var.db_username}:${random_password.db.result}@${module.rds.db_instance_endpoint}/${var.db_name}"
50
+ sensitive = true
51
+ }
52
+ {{/if}}
@@ -0,0 +1,47 @@
1
+ provider "aws" {
2
+ region = var.region
3
+
4
+ # Pin to the standard public endpoints — the AWS provider 5.x enables
5
+ # endpoint discovery by default and can return VPC-endpoint-scoped URLs
6
+ # that don't resolve from a local machine.
7
+ endpoints {
8
+ dynamodb = "https://dynamodb.${var.region}.amazonaws.com"
9
+ rds = "https://rds.${var.region}.amazonaws.com"
10
+ s3 = "https://s3.${var.region}.amazonaws.com"
11
+ }
12
+
13
+ default_tags {
14
+ tags = {
15
+ Project = var.project_name
16
+ Environment = var.environment
17
+ ManagedBy = "terraform"
18
+ }
19
+ }
20
+ }
21
+
22
+ # Authenticate the kubernetes/helm providers against the cluster created in this
23
+ # same configuration, using a short-lived token from the AWS CLI (exec plugin).
24
+ # No kubeconfig file is required, so the flow is identical locally and in CI.
25
+ provider "kubernetes" {
26
+ host = module.eks.cluster_endpoint
27
+ cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
28
+
29
+ exec {
30
+ api_version = "client.authentication.k8s.io/v1beta1"
31
+ command = "aws"
32
+ args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name, "--region", var.region]
33
+ }
34
+ }
35
+
36
+ provider "helm" {
37
+ kubernetes {
38
+ host = module.eks.cluster_endpoint
39
+ cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
40
+
41
+ exec {
42
+ api_version = "client.authentication.k8s.io/v1beta1"
43
+ command = "aws"
44
+ args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name, "--region", var.region]
45
+ }
46
+ }
47
+ }