@digilogiclabs/create-saas-app 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +975 -891
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/generators/template-generator.d.ts +11 -0
  5. package/dist/generators/template-generator.d.ts.map +1 -1
  6. package/dist/generators/template-generator.js +389 -18
  7. package/dist/generators/template-generator.js.map +1 -1
  8. package/dist/index.js +1837 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/templates/infrastructure/kubernetes/base/template/README.md +253 -0
  11. package/dist/templates/infrastructure/kubernetes/base/template/configmap.yaml +12 -0
  12. package/dist/templates/infrastructure/kubernetes/base/template/deployment.yaml +123 -0
  13. package/dist/templates/infrastructure/kubernetes/base/template/hpa.yaml +45 -0
  14. package/dist/templates/infrastructure/kubernetes/base/template/ingress.yaml +31 -0
  15. package/dist/templates/infrastructure/kubernetes/base/template/kustomization.yaml +25 -0
  16. package/dist/templates/infrastructure/kubernetes/base/template/namespace.yaml +8 -0
  17. package/dist/templates/infrastructure/kubernetes/base/template/networkpolicy.yaml +48 -0
  18. package/dist/templates/infrastructure/kubernetes/base/template/pdb.yaml +14 -0
  19. package/dist/templates/infrastructure/kubernetes/base/template/secret.yaml +17 -0
  20. package/dist/templates/infrastructure/kubernetes/base/template/service.yaml +19 -0
  21. package/dist/templates/infrastructure/kubernetes/base/template/serviceaccount.yaml +9 -0
  22. package/dist/templates/infrastructure/kubernetes/production/template/kustomization.yaml +92 -0
  23. package/dist/templates/infrastructure/terraform/aws/template/README.md +156 -0
  24. package/dist/templates/infrastructure/terraform/aws/template/main.tf +343 -0
  25. package/dist/templates/infrastructure/terraform/aws/template/outputs.tf +66 -0
  26. package/dist/templates/infrastructure/terraform/aws/template/terraform.tfvars.example +28 -0
  27. package/dist/templates/infrastructure/terraform/aws/template/variables.tf +110 -0
  28. package/dist/templates/infrastructure/terraform/gcp/template/README.md +165 -0
  29. package/dist/templates/infrastructure/terraform/gcp/template/main.tf +397 -0
  30. package/dist/templates/infrastructure/terraform/gcp/template/outputs.tf +51 -0
  31. package/dist/templates/infrastructure/terraform/gcp/template/terraform.tfvars.example +29 -0
  32. package/dist/templates/infrastructure/terraform/gcp/template/variables.tf +115 -0
  33. package/dist/templates/shared/admin/web/app/admin/layout.tsx +34 -0
  34. package/dist/templates/shared/admin/web/components/admin-nav.tsx +48 -0
  35. package/dist/templates/shared/audit/web/lib/audit.ts +24 -0
  36. package/dist/templates/shared/auth/keycloak/web/app/api/auth/federated-logout/route.ts +173 -0
  37. package/dist/templates/shared/auth/keycloak/web/auth.config.ts +84 -0
  38. package/dist/templates/shared/auth/keycloak/web/auth.ts +26 -0
  39. package/dist/templates/shared/beta/web/app/api/beta-settings/route.ts +25 -0
  40. package/dist/templates/shared/beta/web/app/api/validate-beta-code/route.ts +67 -0
  41. package/dist/templates/shared/beta/web/lib/beta/settings.ts +31 -0
  42. package/dist/templates/shared/cache/web/lib/cache.ts +44 -0
  43. package/dist/templates/shared/config/web/lib/config.ts +112 -0
  44. package/dist/templates/shared/config/web/next.config.mjs +62 -0
  45. package/dist/templates/shared/contact/web/app/api/contact/route.ts +113 -0
  46. package/dist/templates/shared/contact/web/app/contact/page.tsx +195 -0
  47. package/dist/templates/shared/cookie-consent/web/components/cookie-consent.tsx +54 -0
  48. package/dist/templates/shared/database/postgresql/web/drizzle.config.ts +16 -0
  49. package/dist/templates/shared/database/postgresql/web/lib/db/drizzle.ts +39 -0
  50. package/dist/templates/shared/database/postgresql/web/lib/db/schema.ts +33 -0
  51. package/dist/templates/shared/database/supabase/web/lib/supabase/client.ts +12 -0
  52. package/dist/templates/shared/database/supabase/web/lib/supabase/server.ts +31 -0
  53. package/dist/templates/shared/database/supabase/web/lib/supabase/service.ts +15 -0
  54. package/dist/templates/shared/email/web/lib/email/branding.ts +18 -0
  55. package/dist/templates/shared/email/web/lib/email/client.ts +96 -0
  56. package/dist/templates/shared/error-pages/web/app/error.tsx +70 -0
  57. package/dist/templates/shared/error-pages/web/app/global-error.tsx +102 -0
  58. package/dist/templates/shared/error-pages/web/app/not-found.tsx +39 -0
  59. package/dist/templates/shared/health/web/app/api/health/route.ts +68 -0
  60. package/dist/templates/shared/legal/web/app/(legal)/privacy/page.tsx +205 -0
  61. package/dist/templates/shared/legal/web/app/(legal)/terms/page.tsx +154 -0
  62. package/dist/templates/shared/legal/web/lib/legal-config.ts +50 -0
  63. package/dist/templates/shared/loading/web/app/loading.tsx +5 -0
  64. package/dist/templates/shared/loading/web/components/skeleton.tsx +95 -0
  65. package/dist/templates/shared/middleware/web/middleware.ts +68 -0
  66. package/dist/templates/shared/observability/web/lib/observability.ts +135 -0
  67. package/dist/templates/shared/payments/web/app/api/webhooks/stripe/route.ts +109 -0
  68. package/dist/templates/shared/platform/web/lib/platform.ts +37 -0
  69. package/dist/templates/shared/redis/web/lib/rate-limit-store.ts +18 -0
  70. package/dist/templates/shared/redis/web/lib/redis.ts +48 -0
  71. package/dist/templates/shared/security/web/lib/api-security.ts +318 -0
  72. package/dist/templates/shared/seo/web/app/api/og/route.tsx +97 -0
  73. package/dist/templates/shared/seo/web/app/robots.ts +53 -0
  74. package/dist/templates/shared/seo/web/app/sitemap.ts +53 -0
  75. package/dist/templates/shared/utils/web/lib/api-response.ts +71 -0
  76. package/dist/templates/shared/utils/web/lib/utils.ts +85 -0
  77. package/dist/templates/web/ai-platform/template/.env.example +16 -0
  78. package/dist/templates/web/ai-platform/template/README.md +84 -0
  79. package/dist/templates/web/ai-platform/template/middleware.ts +55 -0
  80. package/dist/templates/web/ai-platform/template/next.config.js +14 -0
  81. package/dist/templates/web/ai-platform/template/package.json +55 -0
  82. package/dist/templates/web/ai-platform/template/src/app/api/chat/route.ts +54 -0
  83. package/dist/templates/web/ai-platform/template/src/app/chat/page.tsx +235 -0
  84. package/dist/templates/web/ai-platform/template/src/app/dashboard/page.tsx +142 -0
  85. package/dist/templates/web/ai-platform/template/src/app/globals.css +34 -0
  86. package/dist/templates/web/ai-platform/template/src/app/layout.tsx +27 -0
  87. package/dist/templates/web/ai-platform/template/src/app/page.tsx +203 -0
  88. package/dist/templates/web/ai-platform/template/src/components/providers/app-providers.tsx +27 -0
  89. package/dist/templates/web/ai-platform/template/src/lib/auth-server.ts +33 -0
  90. package/dist/templates/web/ai-platform/template/src/lib/supabase/client.ts +8 -0
  91. package/dist/templates/web/ai-platform/template/src/lib/supabase/server.ts +27 -0
  92. package/dist/templates/web/ai-platform/template/src/lib/utils.ts +6 -0
  93. package/dist/templates/web/ai-platform/template/tsconfig.json +27 -0
  94. package/dist/templates/web/iot-dashboard/template/.env.example +12 -0
  95. package/dist/templates/web/iot-dashboard/template/README.md +101 -0
  96. package/dist/templates/web/iot-dashboard/template/middleware.ts +56 -0
  97. package/dist/templates/web/iot-dashboard/template/next.config.js +14 -0
  98. package/dist/templates/web/iot-dashboard/template/package.json +49 -0
  99. package/dist/templates/web/iot-dashboard/template/src/app/dashboard/page.tsx +229 -0
  100. package/dist/templates/web/iot-dashboard/template/src/app/globals.css +20 -0
  101. package/dist/templates/web/iot-dashboard/template/src/app/layout.tsx +27 -0
  102. package/dist/templates/web/iot-dashboard/template/src/app/page.tsx +191 -0
  103. package/dist/templates/web/iot-dashboard/template/src/components/providers/app-providers.tsx +24 -0
  104. package/dist/templates/web/iot-dashboard/template/src/lib/auth-server.ts +33 -0
  105. package/dist/templates/web/iot-dashboard/template/src/lib/supabase/client.ts +8 -0
  106. package/dist/templates/web/iot-dashboard/template/src/lib/supabase/server.ts +27 -0
  107. package/dist/templates/web/iot-dashboard/template/src/lib/utils.ts +25 -0
  108. package/dist/templates/web/iot-dashboard/template/tsconfig.json +27 -0
  109. package/dist/templates/web/marketplace/template/.env.example +12 -0
  110. package/dist/templates/web/marketplace/template/README.md +66 -0
  111. package/dist/templates/web/marketplace/template/middleware.ts +56 -0
  112. package/dist/templates/web/marketplace/template/next.config.js +14 -0
  113. package/dist/templates/web/marketplace/template/package.json +51 -0
  114. package/dist/templates/web/marketplace/template/src/app/cart/page.tsx +147 -0
  115. package/dist/templates/web/marketplace/template/src/app/dashboard/page.tsx +149 -0
  116. package/dist/templates/web/marketplace/template/src/app/globals.css +20 -0
  117. package/dist/templates/web/marketplace/template/src/app/layout.tsx +27 -0
  118. package/dist/templates/web/marketplace/template/src/app/page.tsx +167 -0
  119. package/dist/templates/web/marketplace/template/src/app/products/page.tsx +129 -0
  120. package/dist/templates/web/marketplace/template/src/components/providers/app-providers.tsx +27 -0
  121. package/dist/templates/web/marketplace/template/src/lib/auth-server.ts +33 -0
  122. package/dist/templates/web/marketplace/template/src/lib/supabase/client.ts +8 -0
  123. package/dist/templates/web/marketplace/template/src/lib/supabase/server.ts +27 -0
  124. package/dist/templates/web/marketplace/template/src/lib/utils.ts +19 -0
  125. package/dist/templates/web/marketplace/template/tsconfig.json +27 -0
  126. package/dist/templates/web/micro-saas/template/.env.example +10 -0
  127. package/dist/templates/web/micro-saas/template/README.md +63 -0
  128. package/dist/templates/web/micro-saas/template/middleware.ts +53 -0
  129. package/dist/templates/web/micro-saas/template/next.config.js +14 -0
  130. package/dist/templates/web/micro-saas/template/package.json +41 -0
  131. package/dist/templates/web/micro-saas/template/src/app/dashboard/page.tsx +117 -0
  132. package/dist/templates/web/micro-saas/template/src/app/globals.css +20 -0
  133. package/dist/templates/web/micro-saas/template/src/app/layout.tsx +27 -0
  134. package/dist/templates/web/micro-saas/template/src/app/login/page.tsx +87 -0
  135. package/dist/templates/web/micro-saas/template/src/app/page.tsx +137 -0
  136. package/dist/templates/web/micro-saas/template/src/app/signup/page.tsx +108 -0
  137. package/dist/templates/web/micro-saas/template/src/components/providers/app-providers.tsx +24 -0
  138. package/dist/templates/web/micro-saas/template/src/lib/auth-server.ts +33 -0
  139. package/dist/templates/web/micro-saas/template/src/lib/supabase/client.ts +8 -0
  140. package/dist/templates/web/micro-saas/template/src/lib/supabase/server.ts +29 -0
  141. package/dist/templates/web/micro-saas/template/src/lib/utils.ts +6 -0
  142. package/dist/templates/web/micro-saas/template/tsconfig.json +27 -0
  143. package/package.json +5 -4
  144. package/src/templates/infrastructure/kubernetes/base/template/README.md +253 -0
  145. package/src/templates/infrastructure/kubernetes/base/template/configmap.yaml +12 -0
  146. package/src/templates/infrastructure/kubernetes/base/template/deployment.yaml +123 -0
  147. package/src/templates/infrastructure/kubernetes/base/template/hpa.yaml +45 -0
  148. package/src/templates/infrastructure/kubernetes/base/template/ingress.yaml +31 -0
  149. package/src/templates/infrastructure/kubernetes/base/template/kustomization.yaml +25 -0
  150. package/src/templates/infrastructure/kubernetes/base/template/namespace.yaml +8 -0
  151. package/src/templates/infrastructure/kubernetes/base/template/networkpolicy.yaml +48 -0
  152. package/src/templates/infrastructure/kubernetes/base/template/pdb.yaml +14 -0
  153. package/src/templates/infrastructure/kubernetes/base/template/secret.yaml +17 -0
  154. package/src/templates/infrastructure/kubernetes/base/template/service.yaml +19 -0
  155. package/src/templates/infrastructure/kubernetes/base/template/serviceaccount.yaml +9 -0
  156. package/src/templates/infrastructure/kubernetes/production/template/kustomization.yaml +92 -0
  157. package/src/templates/infrastructure/terraform/aws/template/README.md +156 -0
  158. package/src/templates/infrastructure/terraform/aws/template/main.tf +343 -0
  159. package/src/templates/infrastructure/terraform/aws/template/outputs.tf +66 -0
  160. package/src/templates/infrastructure/terraform/aws/template/terraform.tfvars.example +28 -0
  161. package/src/templates/infrastructure/terraform/aws/template/variables.tf +110 -0
  162. package/src/templates/infrastructure/terraform/gcp/template/README.md +165 -0
  163. package/src/templates/infrastructure/terraform/gcp/template/main.tf +397 -0
  164. package/src/templates/infrastructure/terraform/gcp/template/outputs.tf +51 -0
  165. package/src/templates/infrastructure/terraform/gcp/template/terraform.tfvars.example +29 -0
  166. package/src/templates/infrastructure/terraform/gcp/template/variables.tf +115 -0
  167. package/src/templates/shared/admin/web/app/admin/layout.tsx +34 -0
  168. package/src/templates/shared/admin/web/components/admin-nav.tsx +48 -0
  169. package/src/templates/shared/audit/web/lib/audit.ts +24 -0
  170. package/src/templates/shared/auth/keycloak/web/app/api/auth/federated-logout/route.ts +173 -0
  171. package/src/templates/shared/auth/keycloak/web/auth.config.ts +84 -0
  172. package/src/templates/shared/auth/keycloak/web/auth.ts +26 -0
  173. package/src/templates/shared/beta/web/app/api/beta-settings/route.ts +25 -0
  174. package/src/templates/shared/beta/web/app/api/validate-beta-code/route.ts +67 -0
  175. package/src/templates/shared/beta/web/lib/beta/settings.ts +31 -0
  176. package/src/templates/shared/cache/web/lib/cache.ts +44 -0
  177. package/src/templates/shared/config/web/lib/config.ts +112 -0
  178. package/src/templates/shared/config/web/next.config.mjs +62 -0
  179. package/src/templates/shared/contact/web/app/api/contact/route.ts +113 -0
  180. package/src/templates/shared/contact/web/app/contact/page.tsx +195 -0
  181. package/src/templates/shared/cookie-consent/web/components/cookie-consent.tsx +54 -0
  182. package/src/templates/shared/database/postgresql/web/drizzle.config.ts +16 -0
  183. package/src/templates/shared/database/postgresql/web/lib/db/drizzle.ts +39 -0
  184. package/src/templates/shared/database/postgresql/web/lib/db/schema.ts +33 -0
  185. package/src/templates/shared/database/supabase/web/lib/supabase/client.ts +12 -0
  186. package/src/templates/shared/database/supabase/web/lib/supabase/server.ts +31 -0
  187. package/src/templates/shared/database/supabase/web/lib/supabase/service.ts +15 -0
  188. package/src/templates/shared/email/web/lib/email/branding.ts +18 -0
  189. package/src/templates/shared/email/web/lib/email/client.ts +96 -0
  190. package/src/templates/shared/error-pages/web/app/error.tsx +70 -0
  191. package/src/templates/shared/error-pages/web/app/global-error.tsx +102 -0
  192. package/src/templates/shared/error-pages/web/app/not-found.tsx +39 -0
  193. package/src/templates/shared/health/web/app/api/health/route.ts +68 -0
  194. package/src/templates/shared/legal/web/app/(legal)/privacy/page.tsx +205 -0
  195. package/src/templates/shared/legal/web/app/(legal)/terms/page.tsx +154 -0
  196. package/src/templates/shared/legal/web/lib/legal-config.ts +50 -0
  197. package/src/templates/shared/loading/web/app/loading.tsx +5 -0
  198. package/src/templates/shared/loading/web/components/skeleton.tsx +95 -0
  199. package/src/templates/shared/middleware/web/middleware.ts +68 -0
  200. package/src/templates/shared/observability/web/lib/observability.ts +135 -0
  201. package/src/templates/shared/payments/web/app/api/webhooks/stripe/route.ts +109 -0
  202. package/src/templates/shared/platform/web/lib/platform.ts +37 -0
  203. package/src/templates/shared/redis/web/lib/rate-limit-store.ts +18 -0
  204. package/src/templates/shared/redis/web/lib/redis.ts +48 -0
  205. package/src/templates/shared/security/web/lib/api-security.ts +318 -0
  206. package/src/templates/shared/seo/web/app/api/og/route.tsx +97 -0
  207. package/src/templates/shared/seo/web/app/robots.ts +53 -0
  208. package/src/templates/shared/seo/web/app/sitemap.ts +53 -0
  209. package/src/templates/shared/utils/web/lib/api-response.ts +71 -0
  210. package/src/templates/shared/utils/web/lib/utils.ts +85 -0
  211. package/src/templates/web/ai-platform/template/.env.example +16 -0
  212. package/src/templates/web/ai-platform/template/README.md +84 -0
  213. package/src/templates/web/ai-platform/template/middleware.ts +55 -0
  214. package/src/templates/web/ai-platform/template/next.config.js +14 -0
  215. package/src/templates/web/ai-platform/template/package.json +55 -0
  216. package/src/templates/web/ai-platform/template/src/app/api/chat/route.ts +54 -0
  217. package/src/templates/web/ai-platform/template/src/app/chat/page.tsx +235 -0
  218. package/src/templates/web/ai-platform/template/src/app/dashboard/page.tsx +142 -0
  219. package/src/templates/web/ai-platform/template/src/app/globals.css +34 -0
  220. package/src/templates/web/ai-platform/template/src/app/layout.tsx +27 -0
  221. package/src/templates/web/ai-platform/template/src/app/page.tsx +203 -0
  222. package/src/templates/web/ai-platform/template/src/components/providers/app-providers.tsx +27 -0
  223. package/src/templates/web/ai-platform/template/src/lib/auth-server.ts +33 -0
  224. package/src/templates/web/ai-platform/template/src/lib/supabase/client.ts +8 -0
  225. package/src/templates/web/ai-platform/template/src/lib/supabase/server.ts +27 -0
  226. package/src/templates/web/ai-platform/template/src/lib/utils.ts +6 -0
  227. package/src/templates/web/ai-platform/template/tsconfig.json +27 -0
  228. package/src/templates/web/iot-dashboard/template/.env.example +12 -0
  229. package/src/templates/web/iot-dashboard/template/README.md +101 -0
  230. package/src/templates/web/iot-dashboard/template/middleware.ts +56 -0
  231. package/src/templates/web/iot-dashboard/template/next.config.js +14 -0
  232. package/src/templates/web/iot-dashboard/template/package.json +49 -0
  233. package/src/templates/web/iot-dashboard/template/src/app/dashboard/page.tsx +229 -0
  234. package/src/templates/web/iot-dashboard/template/src/app/globals.css +20 -0
  235. package/src/templates/web/iot-dashboard/template/src/app/layout.tsx +27 -0
  236. package/src/templates/web/iot-dashboard/template/src/app/page.tsx +191 -0
  237. package/src/templates/web/iot-dashboard/template/src/components/providers/app-providers.tsx +24 -0
  238. package/src/templates/web/iot-dashboard/template/src/lib/auth-server.ts +33 -0
  239. package/src/templates/web/iot-dashboard/template/src/lib/supabase/client.ts +8 -0
  240. package/src/templates/web/iot-dashboard/template/src/lib/supabase/server.ts +27 -0
  241. package/src/templates/web/iot-dashboard/template/src/lib/utils.ts +25 -0
  242. package/src/templates/web/iot-dashboard/template/tsconfig.json +27 -0
  243. package/src/templates/web/marketplace/template/.env.example +12 -0
  244. package/src/templates/web/marketplace/template/README.md +66 -0
  245. package/src/templates/web/marketplace/template/middleware.ts +56 -0
  246. package/src/templates/web/marketplace/template/next.config.js +14 -0
  247. package/src/templates/web/marketplace/template/package.json +51 -0
  248. package/src/templates/web/marketplace/template/src/app/cart/page.tsx +147 -0
  249. package/src/templates/web/marketplace/template/src/app/dashboard/page.tsx +149 -0
  250. package/src/templates/web/marketplace/template/src/app/globals.css +20 -0
  251. package/src/templates/web/marketplace/template/src/app/layout.tsx +27 -0
  252. package/src/templates/web/marketplace/template/src/app/page.tsx +167 -0
  253. package/src/templates/web/marketplace/template/src/app/products/page.tsx +129 -0
  254. package/src/templates/web/marketplace/template/src/components/providers/app-providers.tsx +27 -0
  255. package/src/templates/web/marketplace/template/src/lib/auth-server.ts +33 -0
  256. package/src/templates/web/marketplace/template/src/lib/supabase/client.ts +8 -0
  257. package/src/templates/web/marketplace/template/src/lib/supabase/server.ts +27 -0
  258. package/src/templates/web/marketplace/template/src/lib/utils.ts +19 -0
  259. package/src/templates/web/marketplace/template/tsconfig.json +27 -0
  260. package/src/templates/web/micro-saas/template/.env.example +10 -0
  261. package/src/templates/web/micro-saas/template/README.md +63 -0
  262. package/src/templates/web/micro-saas/template/middleware.ts +53 -0
  263. package/src/templates/web/micro-saas/template/next.config.js +14 -0
  264. package/src/templates/web/micro-saas/template/package.json +41 -0
  265. package/src/templates/web/micro-saas/template/src/app/dashboard/page.tsx +117 -0
  266. package/src/templates/web/micro-saas/template/src/app/globals.css +20 -0
  267. package/src/templates/web/micro-saas/template/src/app/layout.tsx +27 -0
  268. package/src/templates/web/micro-saas/template/src/app/login/page.tsx +87 -0
  269. package/src/templates/web/micro-saas/template/src/app/page.tsx +137 -0
  270. package/src/templates/web/micro-saas/template/src/app/signup/page.tsx +108 -0
  271. package/src/templates/web/micro-saas/template/src/components/providers/app-providers.tsx +24 -0
  272. package/src/templates/web/micro-saas/template/src/lib/auth-server.ts +33 -0
  273. package/src/templates/web/micro-saas/template/src/lib/supabase/client.ts +8 -0
  274. package/src/templates/web/micro-saas/template/src/lib/supabase/server.ts +29 -0
  275. package/src/templates/web/micro-saas/template/src/lib/utils.ts +6 -0
  276. package/src/templates/web/micro-saas/template/tsconfig.json +27 -0
  277. package/dist/cli/commands/add.d.ts +0 -6
  278. package/dist/cli/commands/add.d.ts.map +0 -1
  279. package/dist/cli/commands/add.js +0 -39
  280. package/dist/cli/commands/add.js.map +0 -1
  281. package/dist/cli/commands/create.d.ts +0 -45
  282. package/dist/cli/commands/create.d.ts.map +0 -1
  283. package/dist/cli/commands/create.js +0 -175
  284. package/dist/cli/commands/create.js.map +0 -1
  285. package/dist/cli/commands/index.d.ts +0 -4
  286. package/dist/cli/commands/index.d.ts.map +0 -1
  287. package/dist/cli/commands/index.js +0 -20
  288. package/dist/cli/commands/index.js.map +0 -1
  289. package/dist/cli/commands/update.d.ts +0 -6
  290. package/dist/cli/commands/update.d.ts.map +0 -1
  291. package/dist/cli/commands/update.js +0 -68
  292. package/dist/cli/commands/update.js.map +0 -1
  293. package/dist/cli/index.d.ts +0 -4
  294. package/dist/cli/index.d.ts.map +0 -1
  295. package/dist/cli/index.js +0 -61
  296. package/dist/cli/index.js.map +0 -1
  297. package/dist/cli/prompts/index.d.ts +0 -2
  298. package/dist/cli/prompts/index.d.ts.map +0 -1
  299. package/dist/cli/prompts/index.js +0 -18
  300. package/dist/cli/prompts/index.js.map +0 -1
  301. package/dist/cli/prompts/project-setup.d.ts +0 -5
  302. package/dist/cli/prompts/project-setup.d.ts.map +0 -1
  303. package/dist/cli/prompts/project-setup.js +0 -316
  304. package/dist/cli/prompts/project-setup.js.map +0 -1
  305. package/dist/cli/utils/git.d.ts +0 -9
  306. package/dist/cli/utils/git.d.ts.map +0 -1
  307. package/dist/cli/utils/git.js +0 -77
  308. package/dist/cli/utils/git.js.map +0 -1
  309. package/dist/cli/utils/index.d.ts +0 -5
  310. package/dist/cli/utils/index.d.ts.map +0 -1
  311. package/dist/cli/utils/index.js +0 -21
  312. package/dist/cli/utils/index.js.map +0 -1
  313. package/dist/cli/utils/logger.d.ts +0 -16
  314. package/dist/cli/utils/logger.d.ts.map +0 -1
  315. package/dist/cli/utils/logger.js +0 -55
  316. package/dist/cli/utils/logger.js.map +0 -1
  317. package/dist/cli/utils/package-manager.d.ts +0 -8
  318. package/dist/cli/utils/package-manager.d.ts.map +0 -1
  319. package/dist/cli/utils/package-manager.js +0 -92
  320. package/dist/cli/utils/package-manager.js.map +0 -1
  321. package/dist/cli/utils/spinner.d.ts +0 -7
  322. package/dist/cli/utils/spinner.d.ts.map +0 -1
  323. package/dist/cli/utils/spinner.js +0 -48
  324. package/dist/cli/utils/spinner.js.map +0 -1
  325. package/dist/cli/validators/dependencies.d.ts +0 -15
  326. package/dist/cli/validators/dependencies.d.ts.map +0 -1
  327. package/dist/cli/validators/dependencies.js +0 -108
  328. package/dist/cli/validators/dependencies.js.map +0 -1
  329. package/dist/cli/validators/index.d.ts +0 -3
  330. package/dist/cli/validators/index.d.ts.map +0 -1
  331. package/dist/cli/validators/index.js +0 -19
  332. package/dist/cli/validators/index.js.map +0 -1
  333. package/dist/cli/validators/project-name.d.ts +0 -5
  334. package/dist/cli/validators/project-name.d.ts.map +0 -1
  335. package/dist/cli/validators/project-name.js +0 -151
  336. package/dist/cli/validators/project-name.js.map +0 -1
  337. package/dist/generators/file-processor.d.ts +0 -28
  338. package/dist/generators/file-processor.d.ts.map +0 -1
  339. package/dist/generators/file-processor.js +0 -224
  340. package/dist/generators/file-processor.js.map +0 -1
  341. package/dist/generators/index.d.ts +0 -4
  342. package/dist/generators/index.d.ts.map +0 -1
  343. package/dist/generators/index.js +0 -20
  344. package/dist/generators/index.js.map +0 -1
  345. package/dist/generators/package-installer.d.ts +0 -29
  346. package/dist/generators/package-installer.d.ts.map +0 -1
  347. package/dist/generators/package-installer.js +0 -177
  348. package/dist/generators/package-installer.js.map +0 -1
@@ -25,6 +25,7 @@ export interface TemplateContext {
25
25
  ai: boolean;
26
26
  observability: boolean;
27
27
  workers: boolean;
28
+ beta: boolean;
28
29
  };
29
30
  packageName: string;
30
31
  className: string;
@@ -62,6 +63,16 @@ export declare class TemplateGenerator {
62
63
  private copyTemplate;
63
64
  private copyAndProcessFiles;
64
65
  private copySharedResources;
66
+ /**
67
+ * Patch the generated package.json to merge aligned dependency versions.
68
+ * Base templates may have stale versions — this ensures the output
69
+ * always matches production-aligned versions from getDependencies().
70
+ */
71
+ private patchPackageJson;
72
+ /**
73
+ * Generate .env.example dynamically based on auth, database, and tier selections.
74
+ */
75
+ private generateEnvExample;
65
76
  private protectJSXObjectLiterals;
66
77
  private isJSXObjectLiteral;
67
78
  private isTextFile;
@@ -1 +1 @@
1
- {"version":3,"file":"template-generator.d.ts","sourceRoot":"","sources":["../../src/generators/template-generator.ts"],"names":[],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EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,EAAE,aAAa;IASjC,OAAO,CAAC,qBAAqB;IAyE7B,OAAO,CAAC,eAAe;IAuKvB,OAAO,CAAC,kBAAkB;IAiC1B,OAAO,CAAC,UAAU;IAwBL,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YA4B1C,kBAAkB;YAKlB,qBAAqB;YA4BrB,YAAY;YASZ,mBAAmB;YA2EnB,mBAAmB;IAwQjC;;;;OAIG;YACW,gBAAgB;IAyB9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAyH1B,OAAO,CAAC,wBAAwB;IAqDhC,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,UAAU;IAmClB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,WAAW;YAQL,kBAAkB;CAmBjC"}
@@ -22,6 +22,7 @@ const TIER_FEATURES = {
22
22
  ai: false,
23
23
  observability: false,
24
24
  workers: false,
25
+ beta: true,
25
26
  },
26
27
  starter: {
27
28
  platformCore: true,
@@ -31,6 +32,7 @@ const TIER_FEATURES = {
31
32
  ai: false,
32
33
  observability: false,
33
34
  workers: false,
35
+ beta: true,
34
36
  },
35
37
  pro: {
36
38
  platformCore: true,
@@ -40,6 +42,7 @@ const TIER_FEATURES = {
40
42
  ai: true,
41
43
  observability: true,
42
44
  workers: false,
45
+ beta: true,
43
46
  },
44
47
  enterprise: {
45
48
  platformCore: true,
@@ -49,6 +52,7 @@ const TIER_FEATURES = {
49
52
  ai: true,
50
53
  observability: true,
51
54
  workers: true,
55
+ beta: true,
52
56
  },
53
57
  };
54
58
  class TemplateGenerator {
@@ -135,7 +139,7 @@ class TemplateGenerator {
135
139
  // ═══════════════════════════════════════════════════════════════
136
140
  // Platform Core - Always included for all tiers (infrastructure abstraction)
137
141
  if (features.platformCore) {
138
- baseDeps['@digilogiclabs/platform-core'] = '^1.1.0';
142
+ baseDeps['@digilogiclabs/platform-core'] = '^1.10.0';
139
143
  }
140
144
  // App SDK - Always included for React apps (unified hooks)
141
145
  if (features.appSdk && (this.config.platform === 'web' || this.config.platform === 'both')) {
@@ -150,36 +154,59 @@ class TemplateGenerator {
150
154
  'ui-auth-payments-video',
151
155
  'ui-auth-payments-ai',
152
156
  'ui-auth-payments-ai-rag',
157
+ // New vertical templates
158
+ 'micro-saas',
159
+ 'marketplace',
160
+ 'ai-platform',
161
+ 'iot-dashboard',
153
162
  ].includes(this.config.template)) {
154
- baseDeps['@digilogiclabs/saas-factory-ui'] = '^1.0.1';
163
+ baseDeps['@digilogiclabs/saas-factory-ui'] = '^1.1.0';
155
164
  }
156
165
  // Auth package (tier: micro+)
157
166
  if (features.auth && this.config.template !== 'base' && this.config.template !== 'ui-only') {
158
- baseDeps['@digilogiclabs/saas-factory-auth'] = '^1.0.0';
167
+ baseDeps['@digilogiclabs/saas-factory-auth'] = '^3.0.0';
159
168
  }
160
169
  // Payments package (tier: starter+)
161
170
  if (features.payments &&
162
171
  (this.config.template.includes('payments') || ['starter', 'pro', 'enterprise'].includes(tier))) {
163
- baseDeps['@digilogiclabs/saas-factory-payments'] = '^1.0.0';
172
+ baseDeps['@digilogiclabs/saas-factory-payments'] = '^3.0.0';
164
173
  }
165
- // AI packages (tier: pro+)
166
- if (features.ai && (this.config.ai.enabled || this.config.template.includes('-ai'))) {
167
- baseDeps['@digilogiclabs/saas-factory-ai'] = '^1.0.0';
174
+ // AI packages (tier: pro+ or AI-focused templates)
175
+ if (features.ai &&
176
+ (this.config.ai.enabled ||
177
+ this.config.template.includes('-ai') ||
178
+ this.config.template === 'ai-platform')) {
179
+ baseDeps['@digilogiclabs/saas-factory-ai'] = '^6.0.0';
168
180
  baseDeps['@digilogiclabs/saas-factory-ai-types'] = '^1.0.0';
181
+ // Add AI SDK for ai-platform template
182
+ if (this.config.template === 'ai-platform') {
183
+ baseDeps['ai'] = '^4.0.0';
184
+ baseDeps['@ai-sdk/openai'] = '^1.0.0';
185
+ baseDeps['@ai-sdk/anthropic'] = '^1.0.0';
186
+ }
187
+ }
188
+ // IoT Dashboard specific dependencies
189
+ if (this.config.template === 'iot-dashboard') {
190
+ baseDeps['recharts'] = '^2.14.0';
191
+ baseDeps['date-fns'] = '^4.1.0';
192
+ }
193
+ // Marketplace specific dependencies
194
+ if (this.config.template === 'marketplace') {
195
+ baseDeps['stripe'] = '^17.4.0';
169
196
  }
170
197
  // ═══════════════════════════════════════════════════════════════
171
198
  // PLATFORM DEPENDENCIES (web/mobile)
172
199
  // ═══════════════════════════════════════════════════════════════
173
200
  if (this.config.platform === 'web' || this.config.platform === 'both') {
174
201
  Object.assign(baseDeps, {
175
- next: '^15.0.0',
202
+ next: '^15.5.0',
176
203
  react: '^19.0.0',
177
204
  'react-dom': '^19.0.0',
178
205
  tailwindcss: '^4.0.0',
179
- typescript: '^5.7.0',
180
- clsx: '^2.0.0',
206
+ typescript: '^5.8.0',
207
+ clsx: '^2.1.0',
181
208
  'class-variance-authority': '^0.7.0',
182
- 'tailwind-merge': '^2.0.0',
209
+ 'tailwind-merge': '^2.6.0',
183
210
  'next-themes': '^0.4.0',
184
211
  'lucide-react': '^0.460.0',
185
212
  });
@@ -213,6 +240,34 @@ class TemplateGenerator {
213
240
  baseDeps['@supabase/ssr'] = '^0.5.0';
214
241
  }
215
242
  }
243
+ else if (this.config.auth === 'keycloak') {
244
+ if (this.config.platform === 'web' || this.config.platform === 'both') {
245
+ baseDeps['next-auth'] = '^5.0.0-beta.30';
246
+ }
247
+ }
248
+ // ═══════════════════════════════════════════════════════════════
249
+ // INFRASTRUCTURE DEPENDENCIES
250
+ // ═══════════════════════════════════════════════════════════════
251
+ // Redis (starter+ tiers — rate limiting, caching)
252
+ if (features.payments || features.ai || features.observability) {
253
+ baseDeps['ioredis'] = '^5.6.0';
254
+ }
255
+ // Database (PostgreSQL + Drizzle)
256
+ if (this.config.database === 'postgresql') {
257
+ baseDeps['drizzle-orm'] = '^0.43.0';
258
+ baseDeps['postgres'] = '^3.4.0';
259
+ baseDeps['dotenv'] = '^16.4.0';
260
+ }
261
+ // Stripe (starter+ tiers — payments)
262
+ if (features.payments) {
263
+ baseDeps['stripe'] = '^17.4.0';
264
+ }
265
+ // Resend (starter+ tiers — transactional email)
266
+ if (features.payments) {
267
+ baseDeps['resend'] = '^4.0.0';
268
+ }
269
+ // Server-only guard
270
+ baseDeps['server-only'] = '^0.0.1';
216
271
  return baseDeps;
217
272
  }
218
273
  getDevDependencies() {
@@ -228,6 +283,10 @@ class TemplateGenerator {
228
283
  '@types/react-dom': '^19.0.0',
229
284
  });
230
285
  }
286
+ // Drizzle Kit for PostgreSQL
287
+ if (this.config.database === 'postgresql') {
288
+ baseDeps['drizzle-kit'] = '^0.30.0';
289
+ }
231
290
  // Add testing dependencies for pro+ tiers
232
291
  const tier = this.config.tier || 'starter';
233
292
  if (['pro', 'enterprise'].includes(tier)) {
@@ -276,6 +335,8 @@ class TemplateGenerator {
276
335
  }
277
336
  // Copy shared resources
278
337
  await this.copySharedResources(outputPath);
338
+ // Patch package.json with aligned dependency versions
339
+ await this.patchPackageJson(outputPath);
279
340
  logger_1.logger.debug('Template generation completed');
280
341
  }
281
342
  catch (error) {
@@ -393,15 +454,319 @@ class TemplateGenerator {
393
454
  return;
394
455
  }
395
456
  const sharedPath = path_1.default.join(this.templatesDir, 'shared');
396
- // Copy auth configuration
397
- const authPath = path_1.default.join(sharedPath, 'auth', this.config.auth);
398
- await this.copyAndProcessFiles(authPath, outputPath);
399
- // Copy theme configuration
457
+ const isWeb = this.config.platform === 'web' || this.config.platform === 'both';
458
+ const tier = this.config.tier || 'starter';
459
+ const features = TIER_FEATURES[tier];
460
+ // ═══════════════════════════════════════════════════════════════
461
+ // AUTH — provider-specific config (Keycloak: auth.config.ts + auth.ts + federated-logout)
462
+ // ═══════════════════════════════════════════════════════════════
463
+ if (isWeb) {
464
+ const authPath = path_1.default.join(sharedPath, 'auth', this.config.auth, 'web');
465
+ await this.copyAndProcessFiles(authPath, outputPath);
466
+ }
467
+ // ═══════════════════════════════════════════════════════════════
468
+ // DATABASE — provider-specific setup (PostgreSQL/Drizzle or Supabase)
469
+ // ═══════════════════════════════════════════════════════════════
470
+ if (isWeb) {
471
+ const dbPath = path_1.default.join(sharedPath, 'database', this.config.database, 'web');
472
+ await this.copyAndProcessFiles(dbPath, outputPath);
473
+ }
474
+ // ═══════════════════════════════════════════════════════════════
475
+ // THEME — theme-specific configuration
476
+ // ═══════════════════════════════════════════════════════════════
400
477
  const themePath = path_1.default.join(sharedPath, 'themes', this.config.theme);
401
478
  await this.copyAndProcessFiles(themePath, outputPath);
402
- // Copy database configuration
403
- const dbPath = path_1.default.join(sharedPath, 'database', this.config.database);
404
- await this.copyAndProcessFiles(dbPath, outputPath);
479
+ // ═══════════════════════════════════════════════════════════════
480
+ // BETA GATE — all tiers (API routes + client wrapper)
481
+ // ═══════════════════════════════════════════════════════════════
482
+ if (features.beta && isWeb) {
483
+ const betaPath = path_1.default.join(sharedPath, 'beta', 'web');
484
+ if (await fs_extra_1.default.pathExists(betaPath)) {
485
+ await this.copyAndProcessFiles(betaPath, path_1.default.join(outputPath, 'src'));
486
+ logger_1.logger.debug('Copied beta gate templates');
487
+ }
488
+ }
489
+ // ═══════════════════════════════════════════════════════════════
490
+ // ENVIRONMENT CONFIG — centralized env validation (all tiers)
491
+ // ═══════════════════════════════════════════════════════════════
492
+ if (isWeb) {
493
+ const configPath = path_1.default.join(sharedPath, 'config', 'web');
494
+ if (await fs_extra_1.default.pathExists(configPath)) {
495
+ await this.copyAndProcessFiles(configPath, outputPath);
496
+ logger_1.logger.debug('Copied environment config template');
497
+ }
498
+ }
499
+ // ═══════════════════════════════════════════════════════════════
500
+ // REDIS — client + rate limit store (starter+ tiers)
501
+ // ═══════════════════════════════════════════════════════════════
502
+ if (isWeb && (features.payments || features.ai || features.observability)) {
503
+ const redisPath = path_1.default.join(sharedPath, 'redis', 'web');
504
+ if (await fs_extra_1.default.pathExists(redisPath)) {
505
+ await this.copyAndProcessFiles(redisPath, outputPath);
506
+ logger_1.logger.debug('Copied Redis client template');
507
+ }
508
+ }
509
+ // ═══════════════════════════════════════════════════════════════
510
+ // API SECURITY — wrapper + rate limiting (all tiers)
511
+ // ═══════════════════════════════════════════════════════════════
512
+ if (isWeb) {
513
+ const securityPath = path_1.default.join(sharedPath, 'security', 'web');
514
+ if (await fs_extra_1.default.pathExists(securityPath)) {
515
+ await this.copyAndProcessFiles(securityPath, outputPath);
516
+ logger_1.logger.debug('Copied API security wrapper template');
517
+ }
518
+ }
519
+ // ═══════════════════════════════════════════════════════════════
520
+ // MIDDLEWARE — route protection + auth (all tiers)
521
+ // ═══════════════════════════════════════════════════════════════
522
+ if (isWeb && this.config.auth === 'keycloak') {
523
+ const middlewarePath = path_1.default.join(sharedPath, 'middleware', 'web');
524
+ if (await fs_extra_1.default.pathExists(middlewarePath)) {
525
+ await this.copyAndProcessFiles(middlewarePath, outputPath);
526
+ logger_1.logger.debug('Copied middleware template');
527
+ }
528
+ }
529
+ // ═══════════════════════════════════════════════════════════════
530
+ // HEALTH CHECK — container readiness (all tiers)
531
+ // ═══════════════════════════════════════════════════════════════
532
+ if (isWeb) {
533
+ const healthPath = path_1.default.join(sharedPath, 'health', 'web');
534
+ if (await fs_extra_1.default.pathExists(healthPath)) {
535
+ await this.copyAndProcessFiles(healthPath, outputPath);
536
+ logger_1.logger.debug('Copied health check endpoint template');
537
+ }
538
+ }
539
+ // ═══════════════════════════════════════════════════════════════
540
+ // STRIPE WEBHOOKS — payment lifecycle (starter+ tiers)
541
+ // ═══════════════════════════════════════════════════════════════
542
+ if (isWeb && features.payments) {
543
+ const paymentsPath = path_1.default.join(sharedPath, 'payments', 'web');
544
+ if (await fs_extra_1.default.pathExists(paymentsPath)) {
545
+ await this.copyAndProcessFiles(paymentsPath, outputPath);
546
+ logger_1.logger.debug('Copied Stripe webhook handler template');
547
+ }
548
+ }
549
+ // ═══════════════════════════════════════════════════════════════
550
+ // AUDIT LOGGING — admin visibility (all authenticated apps)
551
+ // ═══════════════════════════════════════════════════════════════
552
+ if (isWeb && features.auth) {
553
+ const auditPath = path_1.default.join(sharedPath, 'audit', 'web');
554
+ if (await fs_extra_1.default.pathExists(auditPath)) {
555
+ await this.copyAndProcessFiles(auditPath, outputPath);
556
+ logger_1.logger.debug('Copied audit logging template');
557
+ }
558
+ }
559
+ // ═══════════════════════════════════════════════════════════════
560
+ // EMAIL BRANDING — transactional emails (all authenticated apps)
561
+ // ═══════════════════════════════════════════════════════════════
562
+ if (isWeb && features.auth) {
563
+ const emailPath = path_1.default.join(sharedPath, 'email', 'web');
564
+ if (await fs_extra_1.default.pathExists(emailPath)) {
565
+ await this.copyAndProcessFiles(emailPath, outputPath);
566
+ logger_1.logger.debug('Copied email branding template');
567
+ }
568
+ }
569
+ // ═══════════════════════════════════════════════════════════════
570
+ // PLATFORM-CORE INIT — singleton adapter wiring (all tiers)
571
+ // ═══════════════════════════════════════════════════════════════
572
+ if (isWeb) {
573
+ const platformPath = path_1.default.join(sharedPath, 'platform', 'web');
574
+ if (await fs_extra_1.default.pathExists(platformPath)) {
575
+ await this.copyAndProcessFiles(platformPath, outputPath);
576
+ logger_1.logger.debug('Copied platform-core initialization template');
577
+ }
578
+ }
579
+ // ═══════════════════════════════════════════════════════════════
580
+ // LEGAL PAGES — Terms of Service + Privacy Policy (all tiers)
581
+ // ═══════════════════════════════════════════════════════════════
582
+ if (isWeb) {
583
+ const legalPath = path_1.default.join(sharedPath, 'legal', 'web');
584
+ if (await fs_extra_1.default.pathExists(legalPath)) {
585
+ await this.copyAndProcessFiles(legalPath, outputPath);
586
+ logger_1.logger.debug('Copied legal page templates (terms, privacy)');
587
+ }
588
+ }
589
+ // ═══════════════════════════════════════════════════════════════
590
+ // ERROR PAGES — 404, error boundary, global error (all tiers)
591
+ // ═══════════════════════════════════════════════════════════════
592
+ if (isWeb) {
593
+ const errorPagesPath = path_1.default.join(sharedPath, 'error-pages', 'web');
594
+ if (await fs_extra_1.default.pathExists(errorPagesPath)) {
595
+ await this.copyAndProcessFiles(errorPagesPath, outputPath);
596
+ logger_1.logger.debug('Copied error page templates (not-found, error, global-error)');
597
+ }
598
+ }
599
+ // ═══════════════════════════════════════════════════════════════
600
+ // SEO — sitemap.ts + robots.ts (all tiers)
601
+ // ═══════════════════════════════════════════════════════════════
602
+ if (isWeb) {
603
+ const seoPath = path_1.default.join(sharedPath, 'seo', 'web');
604
+ if (await fs_extra_1.default.pathExists(seoPath)) {
605
+ await this.copyAndProcessFiles(seoPath, outputPath);
606
+ logger_1.logger.debug('Copied SEO templates (sitemap, robots)');
607
+ }
608
+ }
609
+ // ═══════════════════════════════════════════════════════════════
610
+ // UTILS — common utility functions + API response helpers (all tiers)
611
+ // ═══════════════════════════════════════════════════════════════
612
+ if (isWeb) {
613
+ const utilsPath = path_1.default.join(sharedPath, 'utils', 'web');
614
+ if (await fs_extra_1.default.pathExists(utilsPath)) {
615
+ await this.copyAndProcessFiles(utilsPath, outputPath);
616
+ logger_1.logger.debug('Copied utility templates (utils, api-response)');
617
+ }
618
+ }
619
+ // ═══════════════════════════════════════════════════════════════
620
+ // COOKIE CONSENT — GDPR compliance banner (all tiers)
621
+ // ═══════════════════════════════════════════════════════════════
622
+ if (isWeb) {
623
+ const cookiePath = path_1.default.join(sharedPath, 'cookie-consent', 'web');
624
+ if (await fs_extra_1.default.pathExists(cookiePath)) {
625
+ await this.copyAndProcessFiles(cookiePath, outputPath);
626
+ logger_1.logger.debug('Copied cookie consent component template');
627
+ }
628
+ }
629
+ // ═══════════════════════════════════════════════════════════════
630
+ // OBSERVABILITY — audit + error reporting helpers (all tiers)
631
+ // ═══════════════════════════════════════════════════════════════
632
+ if (isWeb) {
633
+ const obsPath = path_1.default.join(sharedPath, 'observability', 'web');
634
+ if (await fs_extra_1.default.pathExists(obsPath)) {
635
+ await this.copyAndProcessFiles(obsPath, outputPath);
636
+ logger_1.logger.debug('Copied observability template');
637
+ }
638
+ }
639
+ // ═══════════════════════════════════════════════════════════════
640
+ // CACHE — TTL presets + HTTP cache headers (all tiers)
641
+ // ═══════════════════════════════════════════════════════════════
642
+ if (isWeb) {
643
+ const cachePath = path_1.default.join(sharedPath, 'cache', 'web');
644
+ if (await fs_extra_1.default.pathExists(cachePath)) {
645
+ await this.copyAndProcessFiles(cachePath, outputPath);
646
+ logger_1.logger.debug('Copied cache utility template');
647
+ }
648
+ }
649
+ // ═══════════════════════════════════════════════════════════════
650
+ // LOADING — skeleton components + default loading.tsx (all tiers)
651
+ // ═══════════════════════════════════════════════════════════════
652
+ if (isWeb) {
653
+ const loadingPath = path_1.default.join(sharedPath, 'loading', 'web');
654
+ if (await fs_extra_1.default.pathExists(loadingPath)) {
655
+ await this.copyAndProcessFiles(loadingPath, outputPath);
656
+ logger_1.logger.debug('Copied loading skeleton templates');
657
+ }
658
+ }
659
+ // ═══════════════════════════════════════════════════════════════
660
+ // ADMIN — layout + nav component (keycloak auth only)
661
+ // ═══════════════════════════════════════════════════════════════
662
+ if (isWeb && this.config.auth === 'keycloak') {
663
+ const adminPath = path_1.default.join(sharedPath, 'admin', 'web');
664
+ if (await fs_extra_1.default.pathExists(adminPath)) {
665
+ await this.copyAndProcessFiles(adminPath, outputPath);
666
+ logger_1.logger.debug('Copied admin layout + nav templates');
667
+ }
668
+ }
669
+ // ═══════════════════════════════════════════════════════════════
670
+ // CONTACT FORM — page + API route with Zod validation & email (all authenticated apps)
671
+ // ═══════════════════════════════════════════════════════════════
672
+ if (isWeb && features.auth) {
673
+ const contactPath = path_1.default.join(sharedPath, 'contact', 'web');
674
+ if (await fs_extra_1.default.pathExists(contactPath)) {
675
+ await this.copyAndProcessFiles(contactPath, outputPath);
676
+ logger_1.logger.debug('Copied contact form templates (page + API route)');
677
+ }
678
+ }
679
+ // ═══════════════════════════════════════════════════════════════
680
+ // .env.example — dynamic env var reference
681
+ // ═══════════════════════════════════════════════════════════════
682
+ if (isWeb) {
683
+ const envExample = this.generateEnvExample(features);
684
+ await fs_extra_1.default.writeFile(path_1.default.join(outputPath, '.env.example'), envExample);
685
+ logger_1.logger.debug('Generated .env.example');
686
+ }
687
+ }
688
+ /**
689
+ * Patch the generated package.json to merge aligned dependency versions.
690
+ * Base templates may have stale versions — this ensures the output
691
+ * always matches production-aligned versions from getDependencies().
692
+ */
693
+ async patchPackageJson(outputPath) {
694
+ const pkgPath = path_1.default.join(outputPath, 'package.json');
695
+ if (!(await fs_extra_1.default.pathExists(pkgPath)))
696
+ return;
697
+ const pkg = await fs_extra_1.default.readJson(pkgPath);
698
+ const deps = this.context.dependencies;
699
+ const devDeps = this.context.devDependencies;
700
+ // Merge dependencies — our versions take precedence over template defaults
701
+ pkg.dependencies = { ...(pkg.dependencies || {}), ...deps };
702
+ pkg.devDependencies = { ...(pkg.devDependencies || {}), ...devDeps };
703
+ // Clean up any obsolete/duplicate deps that moved between deps and devDeps
704
+ // (e.g., typescript might be in both)
705
+ for (const key of Object.keys(pkg.devDependencies)) {
706
+ if (key === 'typescript')
707
+ continue; // typescript can be in both
708
+ if (pkg.dependencies[key]) {
709
+ delete pkg.devDependencies[key];
710
+ }
711
+ }
712
+ await fs_extra_1.default.writeJson(pkgPath, pkg, { spaces: 2 });
713
+ logger_1.logger.debug('Patched package.json with aligned dependency versions');
714
+ }
715
+ /**
716
+ * Generate .env.example dynamically based on auth, database, and tier selections.
717
+ */
718
+ generateEnvExample(features) {
719
+ const lines = [
720
+ '# ═══════════════════════════════════════════════════════════════',
721
+ `# ${this.config.name} — Environment Variables`,
722
+ '# Copy this file to .env.local and fill in the values.',
723
+ '# ═══════════════════════════════════════════════════════════════',
724
+ '',
725
+ '# ── App ──────────────────────────────────────────────────────',
726
+ 'NODE_ENV=development',
727
+ 'NEXT_PUBLIC_APP_URL=http://localhost:3000',
728
+ '',
729
+ ];
730
+ // Auth
731
+ if (this.config.auth === 'keycloak') {
732
+ lines.push('# ── Auth (Keycloak + Auth.js) ─────────────────────────────────', 'AUTH_SECRET= # openssl rand -base64 32', 'KEYCLOAK_ISSUER=https://auth.example.com/realms/my-realm', 'KEYCLOAK_CLIENT_ID=my-app', 'KEYCLOAK_CLIENT_SECRET=', '');
733
+ }
734
+ else if (this.config.auth === 'supabase') {
735
+ lines.push('# ── Auth (Supabase) ───────────────────────────────────────────', 'NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co', 'NEXT_PUBLIC_SUPABASE_ANON_KEY=', 'SUPABASE_SERVICE_ROLE_KEY=', '');
736
+ }
737
+ else if (this.config.auth === 'firebase') {
738
+ lines.push('# ── Auth (Firebase) ───────────────────────────────────────────', 'NEXT_PUBLIC_FIREBASE_API_KEY=', 'NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=', 'NEXT_PUBLIC_FIREBASE_PROJECT_ID=', '');
739
+ }
740
+ // Database
741
+ if (this.config.database === 'postgresql') {
742
+ lines.push('# ── Database (PostgreSQL) ─────────────────────────────────────', 'DATABASE_URL=postgres://user:password@localhost:5432/myapp', '');
743
+ }
744
+ else if (this.config.database === 'supabase') {
745
+ lines.push('# ── Database (Supabase) ───────────────────────────────────────', 'NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co', 'NEXT_PUBLIC_SUPABASE_ANON_KEY=', 'SUPABASE_SERVICE_ROLE_KEY=', '');
746
+ }
747
+ // Redis (starter+)
748
+ if (features.payments || features.ai || features.observability) {
749
+ lines.push('# ── Cache (Redis) ─────────────────────────────────────────────', 'REDIS_URL=redis://localhost:6379', 'REDIS_KEY_PREFIX=myapp: # Isolate keys per app', '');
750
+ }
751
+ // Payments (starter+)
752
+ if (features.payments) {
753
+ lines.push('# ── Payments (Stripe) ─────────────────────────────────────────', 'STRIPE_PUBLISHABLE_KEY=pk_test_...', 'STRIPE_SECRET_KEY=sk_test_...', 'STRIPE_WEBHOOK_SECRET=whsec_...', '');
754
+ }
755
+ // Email (all authenticated apps)
756
+ if (features.auth) {
757
+ lines.push('# ── Email (Resend) ────────────────────────────────────────────', 'RESEND_API_KEY=re_...', 'EMAIL_FROM=noreply@example.com', 'ADMIN_EMAIL=admin@example.com # Contact form submissions', '');
758
+ }
759
+ // AI (pro+)
760
+ if (features.ai) {
761
+ lines.push('# ── AI ────────────────────────────────────────────────────────', 'OPENAI_API_KEY=sk-...', '# ANTHROPIC_API_KEY=sk-ant-...', '');
762
+ }
763
+ // Admin / Cron secrets
764
+ lines.push('# ── Security ──────────────────────────────────────────────────', 'ADMIN_SECRET= # openssl rand -base64 32', 'CRON_SECRET= # openssl rand -base64 32', '');
765
+ // Beta (if enabled)
766
+ if (features.beta) {
767
+ lines.push('# ── Beta Access ───────────────────────────────────────────────', 'BETA_ENABLED=true', 'BETA_CODES=CODE1,CODE2 # Comma-separated invite codes', '');
768
+ }
769
+ return lines.join('\n');
405
770
  }
406
771
  protectJSXObjectLiterals(content, jsxObjectLiterals) {
407
772
  let result = '';
@@ -488,12 +853,18 @@ class TemplateGenerator {
488
853
  '.scss',
489
854
  '.sass',
490
855
  '.less',
856
+ '.mjs',
857
+ '.cjs',
491
858
  '.env',
492
859
  '.gitignore',
493
860
  '.eslintrc',
494
861
  '.prettierrc',
495
862
  '.editorconfig',
496
863
  '.nvmrc',
864
+ // Infrastructure files (Terraform, Kubernetes)
865
+ '.tf',
866
+ '.tfvars',
867
+ '.hcl',
497
868
  ];
498
869
  const ext = path_1.default.extname(filename).toLowerCase();
499
870
  return textExtensions.includes(ext) || !ext;