@cubocicloide/stack-react-django 3.0.4

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 (289) 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 +94 -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 +136 -0
  8. package/dist/commands/lint/checks/BE/002.js.map +1 -0
  9. package/dist/commands/lint/checks/BE/003.d.ts +6 -0
  10. package/dist/commands/lint/checks/BE/003.js +89 -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 +68 -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 +55 -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 +95 -0
  20. package/dist/commands/lint/checks/BE/006.js.map +1 -0
  21. package/dist/commands/lint/checks/BE/007.d.ts +6 -0
  22. package/dist/commands/lint/checks/BE/007.js +53 -0
  23. package/dist/commands/lint/checks/BE/007.js.map +1 -0
  24. package/dist/commands/lint/checks/BE/008.d.ts +6 -0
  25. package/dist/commands/lint/checks/BE/008.js +70 -0
  26. package/dist/commands/lint/checks/BE/008.js.map +1 -0
  27. package/dist/commands/lint/checks/BE/009.d.ts +6 -0
  28. package/dist/commands/lint/checks/BE/009.js +112 -0
  29. package/dist/commands/lint/checks/BE/009.js.map +1 -0
  30. package/dist/commands/lint/checks/BE/010.d.ts +6 -0
  31. package/dist/commands/lint/checks/BE/010.js +76 -0
  32. package/dist/commands/lint/checks/BE/010.js.map +1 -0
  33. package/dist/commands/lint/checks/BE/011.d.ts +6 -0
  34. package/dist/commands/lint/checks/BE/011.js +76 -0
  35. package/dist/commands/lint/checks/BE/011.js.map +1 -0
  36. package/dist/commands/lint/checks/BE/012.d.ts +6 -0
  37. package/dist/commands/lint/checks/BE/012.js +61 -0
  38. package/dist/commands/lint/checks/BE/012.js.map +1 -0
  39. package/dist/commands/lint/checks/BE/013.d.ts +6 -0
  40. package/dist/commands/lint/checks/BE/013.js +98 -0
  41. package/dist/commands/lint/checks/BE/013.js.map +1 -0
  42. package/dist/commands/lint/checks/BE/014.d.ts +6 -0
  43. package/dist/commands/lint/checks/BE/014.js +64 -0
  44. package/dist/commands/lint/checks/BE/014.js.map +1 -0
  45. package/dist/commands/lint/checks/E2E/001.d.ts +6 -0
  46. package/dist/commands/lint/checks/E2E/001.js +35 -0
  47. package/dist/commands/lint/checks/E2E/001.js.map +1 -0
  48. package/dist/commands/lint/checks/E2E/002.d.ts +6 -0
  49. package/dist/commands/lint/checks/E2E/002.js +37 -0
  50. package/dist/commands/lint/checks/E2E/002.js.map +1 -0
  51. package/dist/commands/lint/checks/E2E/003.d.ts +6 -0
  52. package/dist/commands/lint/checks/E2E/003.js +42 -0
  53. package/dist/commands/lint/checks/E2E/003.js.map +1 -0
  54. package/dist/commands/lint/checks/E2E/004.d.ts +6 -0
  55. package/dist/commands/lint/checks/E2E/004.js +37 -0
  56. package/dist/commands/lint/checks/E2E/004.js.map +1 -0
  57. package/dist/commands/lint/checks/E2E/005.d.ts +6 -0
  58. package/dist/commands/lint/checks/E2E/005.js +47 -0
  59. package/dist/commands/lint/checks/E2E/005.js.map +1 -0
  60. package/dist/commands/lint/checks/E2E/006.d.ts +6 -0
  61. package/dist/commands/lint/checks/E2E/006.js +28 -0
  62. package/dist/commands/lint/checks/E2E/006.js.map +1 -0
  63. package/dist/commands/lint/checks/E2E/007.d.ts +6 -0
  64. package/dist/commands/lint/checks/E2E/007.js +47 -0
  65. package/dist/commands/lint/checks/E2E/007.js.map +1 -0
  66. package/dist/commands/lint/checks/FE/001.d.ts +6 -0
  67. package/dist/commands/lint/checks/FE/001.js +56 -0
  68. package/dist/commands/lint/checks/FE/001.js.map +1 -0
  69. package/dist/commands/lint/checks/FE/002.d.ts +6 -0
  70. package/dist/commands/lint/checks/FE/002.js +80 -0
  71. package/dist/commands/lint/checks/FE/002.js.map +1 -0
  72. package/dist/commands/lint/checks/FE/003.d.ts +6 -0
  73. package/dist/commands/lint/checks/FE/003.js +65 -0
  74. package/dist/commands/lint/checks/FE/003.js.map +1 -0
  75. package/dist/commands/lint/checks/FE/004.d.ts +6 -0
  76. package/dist/commands/lint/checks/FE/004.js +72 -0
  77. package/dist/commands/lint/checks/FE/004.js.map +1 -0
  78. package/dist/commands/lint/checks/FE/005.d.ts +6 -0
  79. package/dist/commands/lint/checks/FE/005.js +103 -0
  80. package/dist/commands/lint/checks/FE/005.js.map +1 -0
  81. package/dist/commands/lint/checks/FE/006.d.ts +6 -0
  82. package/dist/commands/lint/checks/FE/006.js +102 -0
  83. package/dist/commands/lint/checks/FE/006.js.map +1 -0
  84. package/dist/commands/lint/checks/FE/007.d.ts +6 -0
  85. package/dist/commands/lint/checks/FE/007.js +60 -0
  86. package/dist/commands/lint/checks/FE/007.js.map +1 -0
  87. package/dist/commands/lint/checks/FE/008.d.ts +6 -0
  88. package/dist/commands/lint/checks/FE/008.js +115 -0
  89. package/dist/commands/lint/checks/FE/008.js.map +1 -0
  90. package/dist/commands/lint/checks/FE/009.d.ts +6 -0
  91. package/dist/commands/lint/checks/FE/009.js +83 -0
  92. package/dist/commands/lint/checks/FE/009.js.map +1 -0
  93. package/dist/commands/lint/checks/FE/010.d.ts +6 -0
  94. package/dist/commands/lint/checks/FE/010.js +105 -0
  95. package/dist/commands/lint/checks/FE/010.js.map +1 -0
  96. package/dist/commands/lint/checks/FE/011.d.ts +6 -0
  97. package/dist/commands/lint/checks/FE/011.js +43 -0
  98. package/dist/commands/lint/checks/FE/011.js.map +1 -0
  99. package/dist/commands/lint/checks/FE/012.d.ts +6 -0
  100. package/dist/commands/lint/checks/FE/012.js +150 -0
  101. package/dist/commands/lint/checks/FE/012.js.map +1 -0
  102. package/dist/index.d.ts +5 -0
  103. package/dist/index.js +3436 -0
  104. package/dist/index.js.map +1 -0
  105. package/dude.stack.json +13 -0
  106. package/package.json +43 -0
  107. package/templates/aws-ecs/backend/Dockerfile.prod +34 -0
  108. package/templates/aws-ecs/docs/docs/deploy.md.hbs +54 -0
  109. package/templates/aws-ecs/frontend/Dockerfile.prod +28 -0
  110. package/templates/aws-ecs/frontend/nginx.conf +21 -0
  111. package/templates/aws-ecs/iac/README.md.hbs +75 -0
  112. package/templates/aws-ecs/iac/_gitignore +14 -0
  113. package/templates/aws-ecs/iac/runner/Dockerfile +35 -0
  114. package/templates/aws-ecs/iac/terraform/bootstrap/main.tf.hbs +102 -0
  115. package/templates/aws-ecs/iac/terraform/bootstrap/outputs.tf +19 -0
  116. package/templates/aws-ecs/iac/terraform/bootstrap/variables.tf.hbs +17 -0
  117. package/templates/aws-ecs/iac/terraform/environments/dev/backend.hcl.hbs +12 -0
  118. package/templates/aws-ecs/iac/terraform/environments/dev/terraform.tfvars.hbs +43 -0
  119. package/templates/aws-ecs/iac/terraform/main.tf.hbs +949 -0
  120. package/templates/aws-ecs/iac/terraform/outputs.tf.hbs +71 -0
  121. package/templates/aws-ecs/iac/terraform/providers.tf +19 -0
  122. package/templates/aws-ecs/iac/terraform/variables.tf.hbs +113 -0
  123. package/templates/aws-ecs/iac/terraform/versions.tf +19 -0
  124. package/templates/base/.claude/agents/issue-fixer.md +190 -0
  125. package/templates/base/.claude/agents/security-fixer.md +250 -0
  126. package/templates/base/.claude/rules/BE/001.md +19 -0
  127. package/templates/base/.claude/rules/BE/002.md +21 -0
  128. package/templates/base/.claude/rules/BE/003.md +19 -0
  129. package/templates/base/.claude/rules/BE/004.md +16 -0
  130. package/templates/base/.claude/rules/BE/005.md +23 -0
  131. package/templates/base/.claude/rules/BE/006.md +13 -0
  132. package/templates/base/.claude/rules/BE/007.md +24 -0
  133. package/templates/base/.claude/rules/BE/008.md +19 -0
  134. package/templates/base/.claude/rules/BE/009.md +18 -0
  135. package/templates/base/.claude/rules/BE/010.md +15 -0
  136. package/templates/base/.claude/rules/BE/011.md +17 -0
  137. package/templates/base/.claude/rules/BE/012.md +18 -0
  138. package/templates/base/.claude/rules/BE/013.md +22 -0
  139. package/templates/base/.claude/rules/BE/014.md +15 -0
  140. package/templates/base/.claude/rules/E2E/001.md +13 -0
  141. package/templates/base/.claude/rules/E2E/002.md +14 -0
  142. package/templates/base/.claude/rules/E2E/003.md +10 -0
  143. package/templates/base/.claude/rules/E2E/004.md +23 -0
  144. package/templates/base/.claude/rules/E2E/005.md +15 -0
  145. package/templates/base/.claude/rules/E2E/006.md +13 -0
  146. package/templates/base/.claude/rules/E2E/007.md +18 -0
  147. package/templates/base/.claude/rules/FE/001.md +22 -0
  148. package/templates/base/.claude/rules/FE/002.md +39 -0
  149. package/templates/base/.claude/rules/FE/003.md +19 -0
  150. package/templates/base/.claude/rules/FE/004.md +21 -0
  151. package/templates/base/.claude/rules/FE/005.md +33 -0
  152. package/templates/base/.claude/rules/FE/006.md +24 -0
  153. package/templates/base/.claude/rules/FE/007.md +19 -0
  154. package/templates/base/.claude/rules/FE/008.md +26 -0
  155. package/templates/base/.claude/rules/FE/009.md +30 -0
  156. package/templates/base/.claude/rules/FE/010.md +25 -0
  157. package/templates/base/.claude/rules/FE/011.md +22 -0
  158. package/templates/base/.claude/rules/FE/012.md +32 -0
  159. package/templates/base/.claude/settings.json +53 -0
  160. package/templates/base/.claude/skills/clean-branches/SKILL.md +100 -0
  161. package/templates/base/.claude/skills/create/SKILL.md +47 -0
  162. package/templates/base/.claude/skills/create-jira-issue/SKILL.md +174 -0
  163. package/templates/base/.claude/skills/create-page/SKILL.md +195 -0
  164. package/templates/base/.claude/skills/create-route/SKILL.md +156 -0
  165. package/templates/base/.claude/skills/draft-email/SKILL.md +104 -0
  166. package/templates/base/.claude/skills/fix-issues/SKILL.md +238 -0
  167. package/templates/base/.claude/skills/security-scan/SKILL.md +297 -0
  168. package/templates/base/.claude/skills/verify-security-fixes/SKILL.md +180 -0
  169. package/templates/base/.dude/commands/README.md +85 -0
  170. package/templates/base/.dude/commands/hello.ts +34 -0
  171. package/templates/base/.dude/lint/checks/PRJ/001.ts +26 -0
  172. package/templates/base/.dude/lint/checks/README.md +69 -0
  173. package/templates/base/.vscode/tasks.json +44 -0
  174. package/templates/base/.worktreeinclude +2 -0
  175. package/templates/base/CLAUDE.md.hbs +391 -0
  176. package/templates/base/README.md.hbs +188 -0
  177. package/templates/base/_env.example.hbs +39 -0
  178. package/templates/base/_env.hbs +35 -0
  179. package/templates/base/_gitignore +31 -0
  180. package/templates/base/_npmrc +2 -0
  181. package/templates/base/backend/Dockerfile +16 -0
  182. package/templates/base/backend/README.md.hbs +90 -0
  183. package/templates/base/backend/_dockerignore +12 -0
  184. package/templates/base/backend/apps/__init__.py +0 -0
  185. package/templates/base/backend/apps/core/__init__.py +0 -0
  186. package/templates/base/backend/apps/core/apps.py +6 -0
  187. package/templates/base/backend/apps/core/serializers.py +7 -0
  188. package/templates/base/backend/apps/core/tests/__init__.py +0 -0
  189. package/templates/base/backend/apps/core/tests/test_views.py +16 -0
  190. package/templates/base/backend/apps/core/urls.py +9 -0
  191. package/templates/base/backend/apps/core/views.py +24 -0
  192. package/templates/base/backend/apps/users/__init__.py +0 -0
  193. package/templates/base/backend/apps/users/admin.py +6 -0
  194. package/templates/base/backend/apps/users/apps.py +6 -0
  195. package/templates/base/backend/apps/users/migrations/0001_initial.py +41 -0
  196. package/templates/base/backend/apps/users/migrations/__init__.py +0 -0
  197. package/templates/base/backend/apps/users/models.py +15 -0
  198. package/templates/base/backend/apps/users/serializers.py +16 -0
  199. package/templates/base/backend/apps/users/services.py +25 -0
  200. package/templates/base/backend/apps/users/tests/__init__.py +0 -0
  201. package/templates/base/backend/apps/users/tests/test_models.py +30 -0
  202. package/templates/base/backend/apps/users/tests/test_views.py +55 -0
  203. package/templates/base/backend/apps/users/urls.py +10 -0
  204. package/templates/base/backend/apps/users/views.py +20 -0
  205. package/templates/base/backend/config/__init__.py.hbs +5 -0
  206. package/templates/base/backend/config/asgi.py +9 -0
  207. package/templates/base/backend/config/settings/__init__.py +0 -0
  208. package/templates/base/backend/config/settings/base.py.hbs +197 -0
  209. package/templates/base/backend/config/settings/local.py +31 -0
  210. package/templates/base/backend/config/settings/production.py.hbs +37 -0
  211. package/templates/base/backend/config/urls.py.hbs +22 -0
  212. package/templates/base/backend/config/wsgi.py +9 -0
  213. package/templates/base/backend/manage.py +23 -0
  214. package/templates/base/backend/pyproject.toml.hbs +48 -0
  215. package/templates/base/backend/start.sh +5 -0
  216. package/templates/base/docker-compose.yml.hbs +196 -0
  217. package/templates/base/docs/docs/api.md +21 -0
  218. package/templates/base/docs/docs/dude.md.hbs +305 -0
  219. package/templates/base/docs/docs/index.md.hbs +92 -0
  220. package/templates/base/docs/docs/mkdocs.md +231 -0
  221. package/templates/base/docs/mkdocs.yml.hbs +52 -0
  222. package/templates/base/e2e/.prettierrc.json +1 -0
  223. package/templates/base/e2e/_prettierignore +3 -0
  224. package/templates/base/e2e/cucumber.js +21 -0
  225. package/templates/base/e2e/eslint.config.mjs +14 -0
  226. package/templates/base/e2e/features/example.feature +13 -0
  227. package/templates/base/e2e/package.json.hbs +30 -0
  228. package/templates/base/e2e/pages/ExamplePage.ts +16 -0
  229. package/templates/base/e2e/playwright.config.ts +27 -0
  230. package/templates/base/e2e/steps/common.steps.ts +32 -0
  231. package/templates/base/e2e/steps/example.steps.ts +4 -0
  232. package/templates/base/e2e/support/hooks.ts +72 -0
  233. package/templates/base/e2e/support/world.ts +24 -0
  234. package/templates/base/e2e/tsconfig.json +22 -0
  235. package/templates/base/frontend/.prettierrc.json +6 -0
  236. package/templates/base/frontend/Dockerfile +10 -0
  237. package/templates/base/frontend/_dockerignore +4 -0
  238. package/templates/base/frontend/eslint.config.js +32 -0
  239. package/templates/base/frontend/index.html.hbs +13 -0
  240. package/templates/base/frontend/package.json.hbs +38 -0
  241. package/templates/base/frontend/public/favicon.svg +5 -0
  242. package/templates/base/frontend/src/$components/Layout/$assets/logo.svg +5 -0
  243. package/templates/base/frontend/src/$components/Layout/constants.tsx +8 -0
  244. package/templates/base/frontend/src/$components/Layout/index.tsx +80 -0
  245. package/templates/base/frontend/src/$components/Layout/types.tsx +9 -0
  246. package/templates/base/frontend/src/$components/index.tsx +1 -0
  247. package/templates/base/frontend/src/$hooks/index.tsx +2 -0
  248. package/templates/base/frontend/src/$hooks/useCounterStore/index.tsx +28 -0
  249. package/templates/base/frontend/src/$hooks/useCounterStore/types.tsx +7 -0
  250. package/templates/base/frontend/src/$hooks/usePageTitle/index.tsx +21 -0
  251. package/templates/base/frontend/src/$types/vite-env.d.ts +10 -0
  252. package/templates/base/frontend/src/App.tsx +36 -0
  253. package/templates/base/frontend/src/main.tsx +10 -0
  254. package/templates/base/frontend/src/openapi/utils/openapi.yaml.hbs +129 -0
  255. package/templates/base/frontend/src/pages/constants.tsx +31 -0
  256. package/templates/base/frontend/src/pages/index.tsx +192 -0
  257. package/templates/base/frontend/src/pages/types.tsx +6 -0
  258. package/templates/base/frontend/src/pages/users/[id]/index.tsx +53 -0
  259. package/templates/base/frontend/src/pages/users/index.tsx +57 -0
  260. package/templates/base/frontend/src/pages/users/types.tsx +4 -0
  261. package/templates/base/frontend/src/styles.module.css +7 -0
  262. package/templates/base/frontend/src/utils/constants.tsx +11 -0
  263. package/templates/base/frontend/src/utils/formatters/index.tsx +49 -0
  264. package/templates/base/frontend/src/utils/functions.tsx +70 -0
  265. package/templates/base/frontend/src/utils/index.tsx +3 -0
  266. package/templates/base/frontend/tsconfig.json +24 -0
  267. package/templates/base/frontend/vite.config.ts +20 -0
  268. package/templates/base/package.json.hbs +11 -0
  269. package/templates/base/security/baseline.json +4 -0
  270. package/templates/celery/backend/apps/core/tasks.py +14 -0
  271. package/templates/celery/backend/apps/core/tests/test_tasks.py +6 -0
  272. package/templates/celery/backend/config/celery.py.hbs +26 -0
  273. package/templates/celerybeat/backend/apps/core/tasks_scheduled.py +18 -0
  274. package/templates/celerybeat/backend/apps/core/tests/test_tasks_scheduled.py +6 -0
  275. package/templates/postgres/.dude/commands/reset.ts +83 -0
  276. package/templates/s3/backend/apps/files/__init__.py +0 -0
  277. package/templates/s3/backend/apps/files/admin.py +9 -0
  278. package/templates/s3/backend/apps/files/apps.py +6 -0
  279. package/templates/s3/backend/apps/files/migrations/0001_initial.py +29 -0
  280. package/templates/s3/backend/apps/files/migrations/__init__.py +0 -0
  281. package/templates/s3/backend/apps/files/models.py +21 -0
  282. package/templates/s3/backend/apps/files/serializers.py +27 -0
  283. package/templates/s3/backend/apps/files/services.py +19 -0
  284. package/templates/s3/backend/apps/files/tests/__init__.py +0 -0
  285. package/templates/s3/backend/apps/files/tests/test_models.py +10 -0
  286. package/templates/s3/backend/apps/files/tests/test_views.py +32 -0
  287. package/templates/s3/backend/apps/files/urls.py +10 -0
  288. package/templates/s3/backend/apps/files/views.py +29 -0
  289. package/templates/s3/frontend/src/openapi/utils/openapi.yaml.hbs +253 -0
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "react-django",
3
+ "version": "0.1.0",
4
+ "minDudeVersion": "0.1.0",
5
+ "entry": "dist/index.js",
6
+ "tags": [
7
+ "frontend:react",
8
+ "backend:django",
9
+ "api:drf",
10
+ "lang:typescript",
11
+ "lang:python"
12
+ ]
13
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@cubocicloide/stack-react-django",
3
+ "version": "3.0.4",
4
+ "description": "React (Vite) + Django REST Framework 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,34 @@
1
+ # Production image — self-contained (no bind mounts), runtime deps only,
2
+ # non-root, gunicorn. Built and pushed to ECR by `dude iac build` / `dude iac ship`.
3
+ #
4
+ # There is deliberately NO ENTRYPOINT: the one-off ECS tasks (migrate) and the
5
+ # Celery worker/beat services reuse this image and fully replace CMD with their
6
+ # own command (e.g. ["/app/.venv/bin/python", "manage.py", "migrate", "--noinput"]).
7
+ FROM python:3.13-slim
8
+ WORKDIR /app
9
+
10
+ # Install uv (fast Python package manager)
11
+ RUN pip install --no-cache-dir uv
12
+
13
+ # Runtime dependencies only (no pytest/ruff/mypy in the production image).
14
+ # pyproject includes gunicorn + whitenoise for production serving.
15
+ COPY pyproject.toml uv.lock* ./
16
+ RUN uv sync --no-cache --no-dev
17
+
18
+ # Bake the application in — unlike the dev image, nothing is bind-mounted.
19
+ COPY manage.py ./
20
+ COPY config/ ./config/
21
+ COPY apps/ ./apps/
22
+
23
+ # Collect static assets (admin, DRF) at build time so whitenoise can serve
24
+ # them at /django-static/. The local settings + a dummy SECRET_KEY are only
25
+ # used for this build step — at runtime ECS injects the production settings
26
+ # module and the real key from Secrets Manager.
27
+ RUN DJANGO_SECRET_KEY=build DJANGO_SETTINGS_MODULE=config.settings.local \
28
+ uv run python manage.py collectstatic --noinput
29
+
30
+ RUN useradd --system --create-home appuser
31
+ USER appuser
32
+
33
+ EXPOSE 8000
34
+ CMD ["/app/.venv/bin/gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "2"]
@@ -0,0 +1,54 @@
1
+ # Deploy to AWS
2
+
3
+ The project ships Terraform for **AWS ECS Fargate** under `iac/`, driven
4
+ entirely by `dude iac …` commands. Architecture:
5
+
6
+ ```
7
+ ┌────────────────────────────┐
8
+ Internet ──────▶│ ALB (HTTP/HTTPS) │
9
+ │ /api/* /admin/* │
10
+ │ /django-static/* ────────┼──▶ ECS backend (gunicorn :8000)
11
+ │ everything else ─────────┼──▶ ECS frontend (nginx :80)
12
+ └────────────────────────────┘ │
13
+ ▼
14
+ RDS PostgreSQL ◀── Secrets Manager (DATABASE_URL,
15
+ DJANGO_SECRET_KEY)
16
+ {{#if withS3}} S3 media bucket ◀── django-storages (uploads)
17
+ {{/if}}{{#if withRedis}} ElastiCache Redis ◀── Celery{{#if withCeleryBeat}} (+ beat){{/if}}
18
+ {{/if}}```
19
+
20
+ Production always runs **PostgreSQL on RDS**, regardless of the local
21
+ database choice — `config/settings/production.py` requires `DATABASE_URL`.
22
+ Static assets are served by whitenoise from the backend image (collected at
23
+ build time); uploads{{#if withS3}} go to the S3 bucket via presigned URLs{{else}} use the default storage{{/if}}.
24
+
25
+ ## Workflow
26
+
27
+ ```bash
28
+ dude iac login --env dev
29
+ dude iac bootstrap --state-bucket-prefix <your-org> --env dev --yes
30
+ dude iac init --env dev
31
+ dude iac apply --env dev
32
+ dude iac ship --env dev # build + push + deploy backend & frontend images
33
+ dude iac migrate --env dev # one-off Fargate task: manage.py migrate
34
+ ```
35
+
36
+ `dude iac ship` tags both images with the git short SHA (`-dirty` when the
37
+ tree has uncommitted changes), records the tag in the environment's
38
+ `terraform.tfvars`, and lets ECS roll the services with automatic rollback on
39
+ failure.
40
+
41
+ ## Operations
42
+
43
+ | Task | Command |
44
+ | ---- | ------- |
45
+ | Service health | `dude iac status --env dev --service backend` |
46
+ | Tail logs | `dude iac logs --env dev --service backend --follow` |
47
+ | Terraform outputs | `dude iac output --env dev` |
48
+ | Preview infra changes | `dude iac plan --env dev` |
49
+ | New environment | `dude iac new-env --env staging --from dev` |
50
+ | Interactive toolbox | `dude iac shell --env dev` |
51
+ | Tear down | `dude iac destroy --env dev` |
52
+
53
+ See `iac/README.md` for the full reference (custom domains, sizing variables,
54
+ state backend details).
@@ -0,0 +1,28 @@
1
+ # Production image for the frontend: build the Vite app, serve the static
2
+ # bundle with nginx (port 80, behind the ALB). The dev Dockerfile (Vite dev
3
+ # 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,21 @@
1
+ # SPA serving only. The /api/*, /admin/* and /django-static/* traffic is
2
+ # routed straight to the Django backend by the ALB (path-based listener
3
+ # rules), so nginx never proxies to a backend — it just serves the static
4
+ # bundle and falls back to index.html for client-side routes. The ALB target
5
+ # group health-checks GET / and expects a 200 (index.html).
6
+ server {
7
+ listen 80;
8
+ server_name _;
9
+ root /usr/share/nginx/html;
10
+ index index.html;
11
+
12
+ location / {
13
+ try_files $uri $uri/ /index.html;
14
+ }
15
+
16
+ # Long-cache hashed assets.
17
+ location /assets/ {
18
+ expires 1y;
19
+ add_header Cache-Control "public, immutable";
20
+ }
21
+ }
@@ -0,0 +1,75 @@
1
+ # Infrastructure — AWS ECS Fargate (Terraform)
2
+
3
+ Everything needed to run **{{projectName}}** on AWS:
4
+
5
+ - **Networking** — a small public VPC (2 subnets, no NAT gateways: cost-lean).
6
+ - **ALB** — path-routes `/api/*`, `/admin/*`, `/django-static/*` to the Django
7
+ backend and everything else to the nginx frontend. Optional custom domain
8
+ (ACM certificate + Route53 alias, HTTP→HTTPS redirect).
9
+ - **ECS Fargate** — `backend` (gunicorn, port 8000) and `frontend` (nginx,
10
+ port 80) services with deployment circuit breakers{{#if withCelery}}, plus a Celery `worker`{{#if withCeleryBeat}} and `beat`{{/if}} service{{/if}}.
11
+ - **RDS PostgreSQL** — always provisioned (production parity, even when local
12
+ dev runs SQLite). Credentials generated by Terraform and injected from
13
+ **Secrets Manager** (`DATABASE_URL`, `DJANGO_SECRET_KEY`).
14
+ {{#if withS3}}
15
+ - **S3 media bucket** — the `files` app stores uploads here (no MinIO in AWS;
16
+ `AWS_S3_ENDPOINT_URL` stays unset in production).
17
+ {{/if}}
18
+ {{#if withRedis}}
19
+ - **ElastiCache Redis** — Celery broker/result backend.
20
+ {{/if}}
21
+ - **Migrations** — a dedicated one-off task definition; run it with
22
+ `dude iac migrate --env <env>` after every deploy that changes models.
23
+
24
+ State lives in S3 + DynamoDB (created once by `bootstrap`, shared by all
25
+ environments); each environment has its own state key under
26
+ `terraform/environments/<env>/`.
27
+
28
+ ## First deployment
29
+
30
+ ```bash
31
+ dude iac login --env dev # AWS credentials (SSO or keys)
32
+ dude iac bootstrap --state-bucket-prefix <your-org> --env dev --yes # state backend + ECR repos (once)
33
+ dude iac init --env dev # terraform init against the S3 backend
34
+ dude iac apply --env dev # provision the infrastructure
35
+ dude iac ship --env dev # build + push + deploy both images
36
+ dude iac migrate --env dev # apply Django migrations
37
+ dude iac output --env dev # app_url, ECR URLs, RDS endpoint…
38
+ ```
39
+
40
+ ## Day-to-day
41
+
42
+ ```bash
43
+ dude iac ship --env dev # deploy the current commit (tag = git SHA)
44
+ dude iac migrate --env dev # after model changes
45
+ dude iac status --env dev # ECS service health (--service backend|frontend{{#if withCelery}}|worker{{/if}}{{#if withCeleryBeat}}|beat{{/if}})
46
+ dude iac logs --env dev --follow # CloudWatch logs (--service …)
47
+ dude iac plan --env dev # preview infra changes
48
+ ```
49
+
50
+ ## More environments
51
+
52
+ ```bash
53
+ dude iac new-env --env staging --from dev
54
+ dude iac init --env staging && dude iac apply --env staging
55
+ ```
56
+
57
+ ## Custom domain
58
+
59
+ Set `domain_name` and `route53_zone_name` in
60
+ `terraform/environments/<env>/terraform.tfvars`, then `dude iac apply`.
61
+ Terraform requests an ACM certificate (DNS-validated), switches the ALB to
62
+ HTTPS and creates the alias record.
63
+
64
+ ## Teardown
65
+
66
+ ```bash
67
+ dude iac destroy --env dev # helm-free: terraform destroy + backend cleanup
68
+ ```
69
+
70
+ The shared bootstrap (state bucket, lock table, ECR repos) is destroyed only
71
+ when no other environment still uses it — pass `--keep-backend` to force-keep.
72
+
73
+ > All terraform invocations run inside a pinned Docker runner
74
+ > (`iac/runner/Dockerfile`); `aws`, `docker` and `git` stay on the host.
75
+ > Override with `DUDE_IAC_RUNNER=host`.
@@ -0,0 +1,14 @@
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
@@ -0,0 +1,35 @@
1
+ # IaC runner image — the toolchain `dude iac *` runs inside.
2
+ #
3
+ # `dude iac` builds this image on first use and runs terraform inside it, so you
4
+ # don't have to install (or version-match) it on your machine. The image is
5
+ # tagged by a hash of THIS file: edit it (bump a version, add a tool) and the
6
+ # 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` and the
10
+ # aws/docker calls run on the host; terraform 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
+ ARG TF_VERSION=1.10.5
19
+
20
+ RUN apt-get update && apt-get install -y --no-install-recommends \
21
+ curl unzip ca-certificates bash less groff git \
22
+ && rm -rf /var/lib/apt/lists/*
23
+
24
+ # terraform
25
+ RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
26
+ "https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip" -o /tmp/tf.zip \
27
+ && unzip -q /tmp/tf.zip -d /usr/local/bin && rm /tmp/tf.zip
28
+
29
+ # aws cli v2 (arch naming differs: amd64 -> x86_64, arm64 -> aarch64)
30
+ RUN case "${TARGETARCH}" in amd64) A=x86_64;; arm64) A=aarch64;; *) A=${TARGETARCH};; esac \
31
+ && curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
32
+ "https://awscli.amazonaws.com/awscli-exe-linux-${A}.zip" -o /tmp/aws.zip \
33
+ && unzip -q /tmp/aws.zip -d /tmp && /tmp/aws/install && rm -rf /tmp/aws*
34
+
35
+ WORKDIR /work
@@ -0,0 +1,102 @@
1
+ # Bootstrap — creates the project-wide shared resources: the S3 bucket +
2
+ # DynamoDB table that hold Terraform remote state for every environment, and
3
+ # the two ECR repositories the backend + frontend images are pushed to. These
4
+ # are SHARED across all environments (one image per service, promoted dev →
5
+ # staging → prod by tag), so they have a single owner here rather than being
6
+ # recreated by each per-env config — which would otherwise collide
7
+ # (RepositoryAlreadyExistsException) and let one env's `destroy` delete another
8
+ # env's registry. Run ONCE per project, with LOCAL state (this config has no
9
+ # remote backend on purpose), then paste the outputs into each environment's
10
+ # backend.hcl.
11
+ #
12
+ # cd iac/terraform/bootstrap
13
+ # terraform init
14
+ # terraform apply -var project_name={{projectName}} -var region=eu-west-1
15
+
16
+ terraform {
17
+ required_version = ">= 1.6.0"
18
+ required_providers {
19
+ aws = {
20
+ source = "hashicorp/aws"
21
+ version = "~> 5.60"
22
+ }
23
+ }
24
+ }
25
+
26
+ provider "aws" {
27
+ region = var.region
28
+
29
+ # Pin to the standard public endpoints — the AWS provider 5.x enables
30
+ # endpoint discovery by default for DynamoDB, which can return a
31
+ # VPC-endpoint-scoped URL that doesn't resolve from a local machine.
32
+ endpoints {
33
+ dynamodb = "https://dynamodb.${var.region}.amazonaws.com"
34
+ s3 = "https://s3.${var.region}.amazonaws.com"
35
+ }
36
+ }
37
+
38
+ resource "aws_s3_bucket" "state" {
39
+ bucket = "${var.state_bucket_prefix}-${var.project_name}-tfstate"
40
+
41
+ # Allow `dude iac destroy` to remove the bucket even though versioning keeps
42
+ # old object versions around (the command also empties it first).
43
+ force_destroy = true
44
+ }
45
+
46
+ resource "aws_s3_bucket_versioning" "state" {
47
+ bucket = aws_s3_bucket.state.id
48
+ versioning_configuration {
49
+ status = "Enabled"
50
+ }
51
+ }
52
+
53
+ resource "aws_s3_bucket_server_side_encryption_configuration" "state" {
54
+ bucket = aws_s3_bucket.state.id
55
+ rule {
56
+ apply_server_side_encryption_by_default {
57
+ sse_algorithm = "AES256"
58
+ }
59
+ }
60
+ }
61
+
62
+ resource "aws_s3_bucket_public_access_block" "state" {
63
+ bucket = aws_s3_bucket.state.id
64
+ block_public_acls = true
65
+ block_public_policy = true
66
+ ignore_public_acls = true
67
+ restrict_public_buckets = true
68
+ }
69
+
70
+ resource "aws_dynamodb_table" "lock" {
71
+ name = "${var.project_name}-tflock"
72
+ billing_mode = "PAY_PER_REQUEST"
73
+ hash_key = "LockID"
74
+
75
+ attribute {
76
+ name = "LockID"
77
+ type = "S"
78
+ }
79
+ }
80
+
81
+ # Shared ECR repositories — one per image (backend + frontend), used by every
82
+ # environment. Per-env Terraform reads them by name via data sources; they are
83
+ # created/destroyed only here, with the rest of the shared backend.
84
+ resource "aws_ecr_repository" "backend" {
85
+ name = "${var.project_name}-backend"
86
+ image_tag_mutability = "MUTABLE"
87
+ force_delete = true
88
+
89
+ image_scanning_configuration {
90
+ scan_on_push = true
91
+ }
92
+ }
93
+
94
+ resource "aws_ecr_repository" "frontend" {
95
+ name = "${var.project_name}-frontend"
96
+ image_tag_mutability = "MUTABLE"
97
+ force_delete = true
98
+
99
+ image_scanning_configuration {
100
+ scan_on_push = true
101
+ }
102
+ }
@@ -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, lock table and ECR repositories."
3
+ type = string
4
+ default = "{{projectName}}"
5
+ }
6
+
7
+ variable "region" {
8
+ description = "AWS region for the state bucket + lock table + ECR repositories."
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,43 @@
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
+ # The image tag currently deployed (backend + frontend are built and pushed
9
+ # together under the same tag). `dude iac deploy` (and `ship`) rewrite this
10
+ # line, so a plain `dude iac apply` always re-deploys the same build.
11
+ image_tag = "latest"
12
+
13
+ # Fargate sizing.
14
+ backend_cpu = 512
15
+ backend_memory = 1024
16
+ frontend_cpu = 256
17
+ frontend_memory = 512
18
+
19
+ backend_desired_count = 1
20
+ frontend_desired_count = 1
21
+ {{#if withCelery}}
22
+
23
+ # Celery worker sizing.
24
+ worker_cpu = 512
25
+ worker_memory = 1024
26
+ worker_desired_count = 1
27
+ {{/if}}
28
+
29
+ # Database. Production parity: this environment always runs RDS PostgreSQL,
30
+ # even when local development was scaffolded on SQLite.
31
+ db_instance_class = "db.t4g.micro"
32
+ db_allocated_storage = 20
33
+
34
+ # Who may reach the app. Consider restricting to your org's networks for
35
+ # non-production environments.
36
+ allowed_cidrs = ["0.0.0.0/0"]
37
+
38
+ # TLS + DNS (optional) — uncomment and set to serve HTTPS on your own domain.
39
+ # The hosted zone must already exist in Route53. Terraform then issues an ACM
40
+ # certificate (DNS-validated), points the domain at the ALB, and the ALB
41
+ # listens on 443 redirecting HTTP→HTTPS. Leave commented for plain HTTP.
42
+ # domain_name = "app.example.com"
43
+ # route53_zone_name = "example.com"