@donotdev/cli 0.1.0 → 0.1.42

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 (390) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +0 -0
  3. package/dependencies-matrix.json +175 -72
  4. package/dist/bin/commands/agent-setup.js +936 -428
  5. package/dist/bin/commands/build.js +4363 -883
  6. package/dist/bin/commands/bump.js +1296 -780
  7. package/dist/bin/commands/cacheout.js +494 -363
  8. package/dist/bin/commands/coach.js +632 -431
  9. package/dist/bin/commands/create-app.js +1316 -799
  10. package/dist/bin/commands/create-project.js +1355 -827
  11. package/dist/bin/commands/db.js +26158 -18868
  12. package/dist/bin/commands/deploy.js +5983 -1971
  13. package/dist/bin/commands/dev.js +1223 -657
  14. package/dist/bin/commands/doctor.js +1100 -528
  15. package/dist/bin/commands/emu.js +1380 -757
  16. package/dist/bin/commands/format.js +494 -363
  17. package/dist/bin/commands/get-demo.js +1210 -715
  18. package/dist/bin/commands/make-admin.js +16073 -8700
  19. package/dist/bin/commands/preview.js +1227 -658
  20. package/dist/bin/commands/seed.js +26171 -18881
  21. package/dist/bin/commands/setup-cicd.js +1475 -880
  22. package/dist/bin/commands/setup.js +1574 -956
  23. package/dist/bin/commands/staging.js +5984 -1972
  24. package/dist/bin/commands/sync-secrets.js +1423 -676
  25. package/dist/bin/commands/type-check.js +976 -469
  26. package/dist/bin/commands/wai.js +499 -368
  27. package/dist/bin/dndev.js +43 -19
  28. package/dist/bin/donotdev.js +43 -19
  29. package/dist/index.js +6166 -2133
  30. package/guidelines/DEPENDENCIES.md +155 -0
  31. package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
  32. package/package.json +2 -1
  33. package/templates/app-demo/.env.example +1 -1
  34. package/templates/app-demo/entities/Contact.ts.example +0 -0
  35. package/templates/app-demo/entities/ExampleEntity.ts.example +0 -0
  36. package/templates/app-demo/entities/demo.ts.example +0 -0
  37. package/templates/app-demo/index.html.example +0 -0
  38. package/templates/app-demo/public/apple-touch-icon.png.example +0 -0
  39. package/templates/app-demo/public/fonts/fonts.css.example +0 -0
  40. package/templates/app-demo/public/icon-192x192.png.example +0 -0
  41. package/templates/app-demo/public/icon-512x512.png.example +0 -0
  42. package/templates/app-demo/src/App.tsx.example +0 -0
  43. package/templates/app-demo/src/config/app.ts.example +0 -0
  44. package/templates/app-demo/src/entities/booking.ts.example +0 -0
  45. package/templates/app-demo/src/entities/onboarding.ts.example +0 -0
  46. package/templates/app-demo/src/entities/product.ts.example +0 -0
  47. package/templates/app-demo/src/entities/quote.ts.example +0 -0
  48. package/templates/app-demo/src/globals.css.example +0 -0
  49. package/templates/app-demo/src/main.tsx.example +0 -0
  50. package/templates/app-demo/src/pages/ChangelogPage.tsx.example +0 -0
  51. package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +0 -0
  52. package/templates/app-demo/src/pages/DashboardPage.tsx.example +0 -0
  53. package/templates/app-demo/src/pages/HomePage.tsx.example +0 -0
  54. package/templates/app-demo/src/pages/OnboardingPage.tsx.example +0 -0
  55. package/templates/app-demo/src/pages/PricingPage.tsx.example +0 -0
  56. package/templates/app-demo/src/pages/ProductsPage.tsx.example +0 -0
  57. package/templates/app-demo/src/pages/ProfilePage.tsx.example +0 -0
  58. package/templates/app-demo/src/pages/SettingsPage.tsx.example +0 -0
  59. package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +0 -0
  60. package/templates/app-demo/src/pages/ShowcasePage.tsx.example +0 -0
  61. package/templates/app-demo/src/pages/components/ComponentRenderer.tsx.example +0 -0
  62. package/templates/app-demo/src/pages/components/ComponentsData.tsx.example +0 -0
  63. package/templates/app-demo/src/pages/components/componentConfig.ts.example +0 -0
  64. package/templates/app-demo/src/pages/legal/LegalPage.tsx.example +0 -0
  65. package/templates/app-demo/src/pages/legal/PrivacyPage.tsx.example +0 -0
  66. package/templates/app-demo/src/pages/legal/TermsPage.tsx.example +0 -0
  67. package/templates/app-demo/src/themes.css.example +27 -0
  68. package/templates/app-demo/tsconfig.json.example +0 -0
  69. package/templates/app-demo/vite.config.ts.example +0 -0
  70. package/templates/app-dndev/index.html.example +0 -3
  71. package/templates/app-dndev/src/App.tsx.example +0 -0
  72. package/templates/app-dndev/src/components/CockpitLayout.css.example +0 -0
  73. package/templates/app-dndev/src/components/CockpitLayout.tsx.example +0 -0
  74. package/templates/app-dndev/src/components/Kanban.css.example +0 -0
  75. package/templates/app-dndev/src/components/ModeToggle.tsx.example +0 -0
  76. package/templates/app-dndev/src/components/OverlaySlot.tsx.example +0 -0
  77. package/templates/app-dndev/src/components/TerminalPanel.css.example +0 -0
  78. package/templates/app-dndev/src/components/TerminalPanel.tsx.example +0 -0
  79. package/templates/app-dndev/src/components/markdown-prose.css.example +0 -0
  80. package/templates/app-dndev/src/components/phases/CaptainLog.tsx.example +0 -0
  81. package/templates/app-dndev/src/components/phases/ContextTabs.tsx.example +0 -0
  82. package/templates/app-dndev/src/components/phases/PhaseCard.tsx.example +0 -0
  83. package/templates/app-dndev/src/components/phases/PhaseDetail.tsx.example +0 -0
  84. package/templates/app-dndev/src/components/phases/ReviewPanel.tsx.example +0 -0
  85. package/templates/app-dndev/src/components/phases/phaseData.ts.example +0 -0
  86. package/templates/app-dndev/src/config/app.ts.example +0 -0
  87. package/templates/app-dndev/src/config/commands.ts.example +0 -0
  88. package/templates/app-dndev/src/config/legal.ts.example +0 -0
  89. package/templates/app-dndev/src/config/providers.ts.example +1 -1
  90. package/templates/app-dndev/src/globals.css.example +0 -0
  91. package/templates/app-dndev/src/hooks/useDndevFile.ts.example +0 -0
  92. package/templates/app-dndev/src/main.tsx.example +0 -0
  93. package/templates/app-dndev/src/pages/BoardPage.tsx.example +0 -0
  94. package/templates/app-dndev/src/pages/GrillPage.tsx.example +0 -0
  95. package/templates/app-dndev/src/pages/HomePage.tsx.example +0 -0
  96. package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +0 -0
  97. package/templates/app-dndev/src/pages/PhasesPage.tsx.example +0 -0
  98. package/templates/app-dndev/src/pages/SettingsPage.tsx.example +0 -0
  99. package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +0 -0
  100. package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +0 -0
  101. package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +0 -0
  102. package/templates/app-dndev/src/stores/dndevStore.ts.example +0 -0
  103. package/templates/app-dndev/src/themes.css.example +26 -0
  104. package/templates/app-dndev/terminal-sidecar.cjs.example +0 -0
  105. package/templates/app-dndev/vite.config.ts.example +0 -0
  106. package/templates/app-expo/.env.example +0 -32
  107. package/templates/app-expo/.expo/README.md.example +0 -0
  108. package/templates/app-expo/.gitignore.example +0 -0
  109. package/templates/app-expo/README.md.example +1 -1
  110. package/templates/app-expo/app/.gitkeep +0 -0
  111. package/templates/app-expo/app/_layout.tsx.example +0 -0
  112. package/templates/app-expo/app/form.tsx.example +0 -0
  113. package/templates/app-expo/app/index.tsx.example +0 -0
  114. package/templates/app-expo/app/list.tsx.example +0 -0
  115. package/templates/app-expo/app/profile.tsx.example +0 -0
  116. package/templates/app-expo/app/signin.tsx.example +0 -0
  117. package/templates/app-expo/app.json.example +0 -0
  118. package/templates/app-expo/assets/adaptive-icon.png +0 -0
  119. package/templates/app-expo/assets/favicon.png +0 -0
  120. package/templates/app-expo/assets/icon.png +0 -0
  121. package/templates/app-expo/assets/splash.png +0 -0
  122. package/templates/app-expo/babel.config.js.example +0 -0
  123. package/templates/app-expo/eas.json.example +0 -0
  124. package/templates/app-expo/expo-env.d.ts.example +0 -0
  125. package/templates/app-expo/metro.config.js.example +0 -0
  126. package/templates/app-expo/service-account-key.json.example +1 -1
  127. package/templates/app-expo/src/config/app.ts.example +0 -0
  128. package/templates/app-expo/src/config/providers.ts.example +1 -1
  129. package/templates/app-expo/tsconfig.json.example +0 -0
  130. package/templates/app-next/.env.example +0 -33
  131. package/templates/app-next/next.config.ts.example +0 -2
  132. package/templates/app-next/postcss.config.js.example +0 -0
  133. package/templates/app-next/service-account-key.json.example +0 -0
  134. package/templates/app-next/src/app/ClientLayout.tsx.example +0 -0
  135. package/templates/app-next/src/app/layout.tsx.example +13 -4
  136. package/templates/app-next/src/app/not-found.tsx.example +0 -0
  137. package/templates/app-next/src/config/app.ts.example +0 -0
  138. package/templates/app-next/src/config/legal.ts.example +0 -0
  139. package/templates/app-next/src/config/providers.ts.example +1 -1
  140. package/templates/app-next/src/globals.css.example +0 -0
  141. package/templates/app-next/src/locales/dndev_en.json.example +0 -0
  142. package/templates/app-next/src/locales/home_en.json.example +6 -6
  143. package/templates/app-next/src/pages/HomePage.tsx.example +0 -0
  144. package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +0 -0
  145. package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +0 -0
  146. package/templates/app-next/src/pages/legal/TermsPage.tsx.example +0 -0
  147. package/templates/app-next/src/pages/locales/example_en.json.example +0 -0
  148. package/templates/app-next/src/themes.css.example +28 -1
  149. package/templates/app-vite/.env.example +0 -33
  150. package/templates/app-vite/csp.example.json +44 -0
  151. package/templates/app-vite/index.html.example +0 -3
  152. package/templates/app-vite/service-account-key.json.example +0 -0
  153. package/templates/app-vite/src/App.tsx.example +0 -0
  154. package/templates/app-vite/src/config/app.ts.example +0 -0
  155. package/templates/app-vite/src/config/legal.ts.example +0 -0
  156. package/templates/app-vite/src/config/providers.ts.example +1 -1
  157. package/templates/app-vite/src/globals.css.example +0 -0
  158. package/templates/app-vite/src/locales/dndev_en.json.example +0 -0
  159. package/templates/app-vite/src/locales/home_en.json.example +6 -6
  160. package/templates/app-vite/src/main.tsx.example +0 -0
  161. package/templates/app-vite/src/pages/FormPageExample.tsx.example +0 -0
  162. package/templates/app-vite/src/pages/HomePage.tsx.example +1 -1
  163. package/templates/app-vite/src/pages/ListPageExample.tsx.example +0 -0
  164. package/templates/app-vite/src/pages/NotFoundPage.tsx.example +0 -0
  165. package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +0 -0
  166. package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +0 -0
  167. package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +0 -0
  168. package/templates/app-vite/src/pages/locales/example_en.json.example +0 -0
  169. package/templates/app-vite/src/themes.css.example +26 -0
  170. package/templates/deploy-config/.firebaserc.example +0 -0
  171. package/templates/deploy-config/firestore.indexes.json.example +0 -0
  172. package/templates/deploy-config/firestore.rules.example +0 -0
  173. package/templates/deploy-config/storage.rules.example +0 -0
  174. package/templates/deploy-config/tsconfig.functions.json.example +0 -0
  175. package/templates/deploy-config/vercel.json.example +2 -2
  176. package/templates/functions-firebase/.env.example +2 -2
  177. package/templates/functions-firebase/README.md.example +3 -3
  178. package/templates/functions-firebase/build.mjs.example +0 -0
  179. package/templates/functions-firebase/functions.config.js.example +0 -0
  180. package/templates/functions-firebase/functions.yaml.example +0 -0
  181. package/templates/functions-firebase/src/auth/getCustomClaims.ts.example +0 -0
  182. package/templates/functions-firebase/src/auth/getUserAuthStatus.ts.example +0 -0
  183. package/templates/functions-firebase/src/auth/index.ts.example +0 -0
  184. package/templates/functions-firebase/src/auth/removeCustomClaims.ts.example +0 -0
  185. package/templates/functions-firebase/src/auth/setCustomClaims.ts.example +0 -0
  186. package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +0 -0
  187. package/templates/functions-firebase/src/billing/index.ts.example +0 -0
  188. package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -0
  189. package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +0 -0
  190. package/templates/functions-firebase/src/crud/createEntity.ts.example +0 -0
  191. package/templates/functions-firebase/src/crud/deleteEntity.ts.example +0 -0
  192. package/templates/functions-firebase/src/crud/getEntity.ts.example +0 -0
  193. package/templates/functions-firebase/src/crud/index.ts.example +0 -0
  194. package/templates/functions-firebase/src/crud/listEntities.ts.example +0 -0
  195. package/templates/functions-firebase/src/crud/updateEntity.ts.example +0 -0
  196. package/templates/functions-firebase/src/index.ts.example +0 -0
  197. package/templates/functions-firebase/src/oauth/checkGitHubAccess.ts.example +0 -0
  198. package/templates/functions-firebase/src/oauth/disconnect.ts.example +0 -0
  199. package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +0 -0
  200. package/templates/functions-firebase/src/oauth/getConnections.ts.example +0 -0
  201. package/templates/functions-firebase/src/oauth/grantGitHubAccess.ts.example +0 -0
  202. package/templates/functions-firebase/src/oauth/index.ts.example +0 -0
  203. package/templates/functions-firebase/src/oauth/refreshToken.ts.example +0 -0
  204. package/templates/functions-firebase/src/oauth/revokeGitHubAccess.ts.example +0 -0
  205. package/templates/functions-firebase/tsconfig.json.example +0 -0
  206. package/templates/functions-supabase/supabase/config.toml.example +0 -0
  207. package/templates/functions-supabase/supabase/functions/.env.example +0 -0
  208. package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +0 -0
  209. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +0 -0
  210. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +0 -0
  211. package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +0 -0
  212. package/templates/functions-supabase/supabase/functions/crud/index.ts.example +0 -0
  213. package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +0 -0
  214. package/templates/functions-supabase/supabase/functions/deno.json.example +0 -0
  215. package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +0 -0
  216. package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +0 -0
  217. package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +0 -0
  218. package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +0 -0
  219. package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +0 -0
  220. package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +0 -0
  221. package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +0 -0
  222. package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +0 -0
  223. package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +0 -0
  224. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
  225. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
  226. package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +0 -0
  227. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
  228. package/templates/functions-supabase/supabase/migrations/20250101000004_crud_bulk.sql +192 -0
  229. package/templates/functions-vercel/.env.example +3 -3
  230. package/templates/functions-vercel/README.md.example +2 -2
  231. package/templates/functions-vercel/build.mjs.example +0 -0
  232. package/templates/functions-vercel/src/api/auth/getCustomClaims.ts.example +0 -0
  233. package/templates/functions-vercel/src/api/auth/getUserAuthStatus.ts.example +0 -0
  234. package/templates/functions-vercel/src/api/auth/removeCustomClaims.ts.example +0 -0
  235. package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +0 -0
  236. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +0 -0
  237. package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -0
  238. package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +0 -0
  239. package/templates/functions-vercel/src/api/crud/createEntity.ts.example +0 -0
  240. package/templates/functions-vercel/src/api/crud/deleteEntity.ts.example +0 -0
  241. package/templates/functions-vercel/src/api/crud/getEntity.ts.example +0 -0
  242. package/templates/functions-vercel/src/api/crud/listEntities.ts.example +0 -0
  243. package/templates/functions-vercel/src/api/crud/updateEntity.ts.example +0 -0
  244. package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +0 -0
  245. package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -0
  246. package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +0 -0
  247. package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -0
  248. package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +0 -0
  249. package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -0
  250. package/templates/functions-vercel/src/api/oauth/revokeGitHubAccess.ts.example +0 -0
  251. package/templates/functions-vercel/tsconfig.json.example +0 -0
  252. package/templates/functions-vercel/vercel.json.example +0 -0
  253. package/templates/github-consumer/.github/workflows/ci.yml.example +0 -0
  254. package/templates/overlay-firebase/env.fragment.example +0 -0
  255. package/templates/overlay-firebase/env.fragment.expo.example +0 -0
  256. package/templates/overlay-firebase/env.fragment.nextjs.example +0 -0
  257. package/templates/overlay-firebase/src/config/providers.expo.ts.example +0 -0
  258. package/templates/overlay-firebase/src/config/providers.ts.example +0 -0
  259. package/templates/overlay-supabase/env.fragment.example +0 -0
  260. package/templates/overlay-supabase/env.fragment.expo.example +0 -0
  261. package/templates/overlay-supabase/env.fragment.nextjs.example +0 -0
  262. package/templates/overlay-supabase/src/config/providers.expo.ts.example +1 -1
  263. package/templates/overlay-supabase/src/config/providers.ts.example +1 -1
  264. package/templates/overlay-vercel/env.fragment.example +0 -0
  265. package/templates/overlay-vercel/env.fragment.nextjs.example +0 -0
  266. package/templates/overlay-vercel/src/config/providers.ts.example +0 -0
  267. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +0 -0
  268. package/templates/preset-admin/src/pages/EntityPage.tsx.example +0 -0
  269. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +0 -0
  270. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +0 -0
  271. package/templates/preset-admin/src/pages/UsersPage.tsx.example +0 -0
  272. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +0 -0
  273. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +0 -0
  274. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +0 -0
  275. package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +0 -0
  276. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +0 -0
  277. package/templates/preset-landing/src/pages/AboutPage.tsx.example +0 -0
  278. package/templates/preset-landing/src/pages/ContactPage.tsx.example +0 -0
  279. package/templates/preset-landing/src/pages/HomePage.tsx.example +0 -0
  280. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +0 -0
  281. package/templates/preset-saas/src/pages/HomePage.tsx.example +0 -0
  282. package/templates/preset-saas/src/pages/PricingPage.tsx.example +0 -0
  283. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +0 -0
  284. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +0 -0
  285. package/templates/root-consumer/.claude/agents/architect.md.example +0 -0
  286. package/templates/root-consumer/.claude/agents/builder.md.example +0 -0
  287. package/templates/root-consumer/.claude/agents/coder.md.example +0 -0
  288. package/templates/root-consumer/.claude/agents/extractor.md.example +0 -0
  289. package/templates/root-consumer/.claude/agents/polisher.md.example +0 -0
  290. package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +0 -0
  291. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
  292. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +56 -0
  293. package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
  294. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
  295. package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
  296. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
  297. package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
  298. package/templates/root-consumer/.claude/rules/git.md.example +14 -0
  299. package/templates/root-consumer/.claude/rules/security.md.example +13 -0
  300. package/templates/root-consumer/.claude/settings.json.example +100 -4
  301. package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +0 -0
  302. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +22 -27
  303. package/templates/root-consumer/.claude/skills/design/SKILL.md.example +0 -0
  304. package/templates/root-consumer/.claude/skills/design/output-template.md +0 -0
  305. package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +26 -15
  306. package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
  307. package/templates/root-consumer/.claude/skills/techdebt/SKILL.md.example +0 -0
  308. package/templates/root-consumer/.cursor/mcp.json.example +0 -0
  309. package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +5 -1
  310. package/templates/root-consumer/.dndev/args.json.example +0 -0
  311. package/templates/root-consumer/.dndev.secrets.example +0 -0
  312. package/templates/root-consumer/.env.example +0 -1
  313. package/templates/root-consumer/.gemini/settings.json.example +0 -0
  314. package/templates/root-consumer/.gitignore.example +1 -0
  315. package/templates/root-consumer/.mcp.json.example +0 -0
  316. package/templates/root-consumer/.prettierrc.cjs.example +0 -0
  317. package/templates/root-consumer/AGENTS.md.example +63 -0
  318. package/templates/root-consumer/CLAUDE.md.example +1 -1
  319. package/templates/root-consumer/README.md.example +11 -33
  320. package/templates/root-consumer/entities/index.ts.example +0 -0
  321. package/templates/root-consumer/eslint.config.js.example +0 -0
  322. package/templates/root-consumer/tsconfig.json.example +0 -0
  323. package/templates/app-demo/public/manifest.json.example +0 -10
  324. package/templates/app-dndev/public/manifest.json.example +0 -10
  325. package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -175
  326. package/templates/root-consumer/.claude/commands/build.md.example +0 -131
  327. package/templates/root-consumer/.claude/commands/design.md.example +0 -184
  328. package/templates/root-consumer/.claude/commands/grill.md.example +0 -135
  329. package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
  330. package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
  331. package/templates/root-consumer/.claude/statusline.py.example +0 -79
  332. package/templates/root-consumer/.clinerules.example +0 -1
  333. package/templates/root-consumer/.cursorrules.example +0 -1
  334. package/templates/root-consumer/.github/copilot-instructions.md.example +0 -1
  335. package/templates/root-consumer/.windsurfrules.example +0 -1
  336. package/templates/root-consumer/AI.md.example +0 -108
  337. package/templates/root-consumer/CONVENTIONS.md.example +0 -1
  338. package/templates/root-consumer/GEMINI.md.example +0 -1
  339. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +0 -135
  340. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -276
  341. package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
  342. package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
  343. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
  344. package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
  345. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
  346. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
  347. package/templates/root-consumer/guides/dndev/INDEX.md.example +0 -60
  348. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
  349. package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +0 -133
  350. package/templates/root-consumer/guides/dndev/SETUP_BILLING.md.example +0 -114
  351. package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
  352. package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
  353. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
  354. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +0 -231
  355. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
  356. package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
  357. package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
  358. package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +0 -54
  359. package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +0 -60
  360. package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
  361. package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
  362. package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +0 -234
  363. package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +0 -62
  364. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +0 -215
  365. package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
  366. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
  367. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
  368. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
  369. package/templates/root-consumer/guides/dndev/advanced/APP_CHECK.md.example +0 -111
  370. package/templates/root-consumer/guides/dndev/advanced/COOKIE_REFERENCE.md.example +0 -252
  371. package/templates/root-consumer/guides/dndev/advanced/EMULATORS.md.example +0 -48
  372. package/templates/root-consumer/guides/dndev/essences_reference.css.example +0 -288
  373. package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +0 -402
  374. package/templates/root-consumer/guides/wai-way/agents/architect.md.example +0 -78
  375. package/templates/root-consumer/guides/wai-way/agents/builder.md.example +0 -97
  376. package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +0 -363
  377. package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +0 -133
  378. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +0 -315
  379. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +0 -133
  380. package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +0 -111
  381. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +0 -150
  382. package/templates/root-consumer/guides/wai-way/blueprints/4_configure.md.example +0 -238
  383. package/templates/root-consumer/guides/wai-way/context_map.json.example +0 -127
  384. package/templates/root-consumer/guides/wai-way/entity_patterns.md.example +0 -839
  385. package/templates/root-consumer/guides/wai-way/hld_template.md.example +0 -138
  386. package/templates/root-consumer/guides/wai-way/lld_template.md.example +0 -103
  387. package/templates/root-consumer/guides/wai-way/page_patterns.md.example +0 -722
  388. package/templates/root-consumer/guides/wai-way/prd_template.md.example +0 -140
  389. package/templates/root-consumer/guides/wai-way/presets_guide.md.example +0 -217
  390. package/templates/root-consumer/guides/wai-way/spec_template.md.example +0 -313
@@ -1,197 +0,0 @@
1
- # Framework Gotchas
2
-
3
- **Common mistakes. Read before coding. Phase tags show when each matters most.**
4
-
5
- ---
6
-
7
- ## Imports [Phase 1, 2, 3]
8
-
9
- **Server code MUST use `/server` imports — client imports crash on deploy.**
10
-
11
- ```typescript
12
- // ✅ CORRECT
13
- import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
14
- import { handleError } from '@donotdev/core/server';
15
-
16
- // ❌ WRONG - crashes on deploy
17
- import { getFirestore } from '@donotdev/firebase';
18
- import { handleError } from '@donotdev/core';
19
- ```
20
-
21
- **Rule:** Always use `/server` suffix for `@donotdev/core/server`, `@donotdev/firebase/server`, `@donotdev/security/server`.
22
-
23
- **ESM only — never use `require()`.**
24
-
25
- ```typescript
26
- // ❌ WRONG
27
- const { something } = require('@donotdev/package');
28
-
29
- // ✅ CORRECT
30
- import { something } from '@donotdev/package';
31
- ```
32
-
33
- **Import ordering is mandatory:**
34
- 1. React (values, then types)
35
- 2. Other vendors (values, then types)
36
- 3. `@donotdev/*` packages (values, then types)
37
- 4. Relative imports (values, then types)
38
-
39
- One line for values, one line for types. Blank line between categories.
40
-
41
- ---
42
-
43
- ## Routing [Phase 1, 3]
44
-
45
- **Never import from `react-router-dom` — use framework routing.**
46
-
47
- ```tsx
48
- // ❌ WRONG - breaks framework features
49
- import { Link, useNavigate, useParams } from 'react-router-dom';
50
-
51
- // ✅ CORRECT
52
- import { Link, useNavigate, useParams } from '@donotdev/ui';
53
- ```
54
-
55
- **Routes are auto-discovered** from `src/pages/*Page.tsx` with `pageMeta`. Don't use `<Routes>`, `<Route>`, or manual `<Outlet />`.
56
-
57
- **Use `useRouteParam('id')` for typed route params** — not `useParams()` from react-router-dom.
58
-
59
- **Navigation is auto-built.** Use `<DnDevNavigationMenu>` or `useNavigationItems()`. Don't build nav manually — you lose auth filtering and route discovery.
60
-
61
- ---
62
-
63
- ## Styling [Phase 3, 4]
64
-
65
- **No inline `fontSize` or `font-size` — use `Text` level prop.**
66
-
67
- ```tsx
68
- // ❌ WRONG
69
- <Text style={{ fontSize: '18px' }}>Title</Text>
70
-
71
- // ✅ CORRECT
72
- <Text level="h2">Title</Text>
73
- ```
74
-
75
- Levels: `h1`, `h2`, `h3`, `h4`, `body`, `small`, `caption`. Limit to 2–3 levels per page.
76
-
77
- **RTL: Always use `start`/`end` — never `left`/`right`.**
78
-
79
- ```css
80
- /* ❌ WRONG - breaks RTL */
81
- text-align: left;
82
-
83
- /* ✅ CORRECT - works in both LTR and RTL */
84
- text-align: start;
85
- ```
86
-
87
- Same for inline styles: `textAlign: 'start'` not `textAlign: 'left'`. Same for data attributes: `data-text-align="start|center|end"`.
88
-
89
- ---
90
-
91
- ## Components [Phase 3]
92
-
93
- **Always `lookup_symbol` before using any `@donotdev` component.** Never guess props.
94
-
95
- Common wrong props:
96
- - `Button`: no `size`, `tone`, `gap` — use `variant`, `display`
97
- - `Text`: no `size`, `tone`, `color` — use `level`, `variant`
98
- - `Stack`: no `spacing`, `size` — use `gap`
99
- - `Card`: no `padding`, `margin`, `size` — use `title`, `subtitle`, `content`, `footer`
100
- - `Grid`: no `columns` — use `cols`
101
-
102
- **If you can't do it with framework components:** Stop. Tell the user what's missing. Don't invent custom workarounds.
103
-
104
- ---
105
-
106
- ## CRUD [Phase 2, 3]
107
-
108
- **Hidden fields are auto-added by `defineEntity()` — don't define them manually:**
109
- - `id`, `createdAt`, `updatedAt`, `createdById`, `updatedById`
110
-
111
- **Status field — extend, don't redefine.**
112
- The `status` field is auto-added with locked `visibility: 'admin'`, `editable: 'admin'`, `type: 'select'`. Only `validation.options` can be extended.
113
-
114
- ```typescript
115
- // ❌ WRONG - these properties are silently ignored
116
- status: { type: 'select', visibility: 'owner', editable: 'admin', validation: { options: [...] } }
117
-
118
- // ✅ CORRECT - only extend options (merged after defaults: draft, available, deleted)
119
- status: { validation: { options: [{ value: 'shipped', label: 'Shipped' }] } }
120
- ```
121
-
122
- **Scope field is auto-added** when `scope` is configured. Don't manually define the scope field (e.g., `companyId`).
123
-
124
- **Custom form fields MUST use framework's `useController`:**
125
-
126
- ```typescript
127
- // ❌ WRONG
128
- import { useController } from 'react-hook-form';
129
-
130
- // ✅ CORRECT
131
- import { useController } from '@donotdev/crud';
132
- ```
133
-
134
- **Form components receive `control` prop, not `field` prop.**
135
-
136
- **Price field is structured:** `{ amount, currency, vatIncluded, discountPercent }`. Don't store computed discount amounts.
137
-
138
- **File uploads are deferred** — files upload on form submit, not on selection. Images show optimistic blob URLs.
139
-
140
- **Entity namespace defaults to `entity-{name}`** (lowercase). Translation files must match: `locales/entity-product_en.json`.
141
-
142
- ---
143
-
144
- ## Functions [Phase 3, 4]
145
-
146
- **Use `createFunction` for custom functions — 3 params, everything included:**
147
-
148
- ```typescript
149
- import { createFunction } from '@donotdev/functions/firebase';
150
-
151
- export const myFunction = createFunction(schema, 'operation_name', async (data, { uid }) => {
152
- // Your logic
153
- });
154
- ```
155
-
156
- **Use `createBaseFunction` only when you need custom config** (memory, timeout, region override).
157
-
158
- **Deploy with `dndev deploy`** — not `firebase deploy`. Manual deploy causes CORS 403 on preflight because Cloud Run blocks unauthenticated OPTIONS by default.
159
-
160
- **Naming:** Export in camelCase (`getDashboardMetrics`), operation ID in snake_case (`get_dashboard_metrics`).
161
-
162
- **CRUD functions are one-liner:** `export const crud = createCrudFunctions(entities);` — generates all CRUD endpoints per entity. Access controlled via `entity.access`.
163
-
164
- ---
165
-
166
- ## i18n [Phase 3, 4]
167
-
168
- **Phase 3: hardcode strings. Phase 4: add translations.** Don't i18n too early.
169
-
170
- **Two loading strategies:**
171
- - **Eager** (always loaded): `src/locales/common_en.json` — navigation, buttons, common UI
172
- - **Lazy** (loaded per page): `src/pages/locales/home_en.json` — page-specific content
173
-
174
- **Status field translations** fall back: `entity-{name}` namespace → `crud` namespace.
175
-
176
- **Rich text uses `<Trans>` component** with supported tags only: `<accent>`, `<primary>`, `<muted>`, `<success>`, `<warning>`, `<error>`, `<bold>`, `<code>`.
177
-
178
- **Array translations use `tList`:**
179
- ```tsx
180
- import { tList } from '@donotdev/ui';
181
- <Card content={tList(t, 'features.items', 4)} />
182
- ```
183
-
184
- ---
185
-
186
- ## Dependencies [Phase 1]
187
-
188
- **Apps don't declare bundled deps.** Framework packages (`@donotdev/*`) provide everything. Don't add `react-router-dom`, `react-hook-form`, `valibot`, etc. to app's `package.json` — they come through framework deps.
189
-
190
- **Environment variables:**
191
- - Client: `apps/my-app/.env` (prefix with `VITE_*`)
192
- - Server: `functions/.env` (secrets: `STRIPE_*`, OAuth tokens)
193
- - Local overrides: `.env.local` (gitignored)
194
-
195
- ---
196
-
197
- **When in doubt: search the codebase first, ask the user second, never guess.**
@@ -1,60 +0,0 @@
1
- # DoNotDev Framework Guides
2
-
3
- **For AI Agents:** See [AGENT_START_HERE.md](./AGENT_START_HERE.md) ← **START HERE**
4
-
5
- **AI System:** Commands in `.claude/commands/`, agents in `.claude/agents/` (synced via `dndev bump`)
6
-
7
- ---
8
-
9
- ## Getting Started
10
-
11
- - **Human flow:** P0 (Bun/Node + AI IDE) → Install CLI & `dndev init` → Run **AI.md** → Enjoy. See [AGENT_START_HERE.md](./AGENT_START_HERE.md) § Getting started (for humans).
12
- - [ENV_SETUP.md](./ENV_SETUP.md) — After `dndev init`: env, Firebase/Supabase, deploy
13
- - [GOTCHAS.md](./GOTCHAS.md) - **Common mistakes & pitfalls** (phase-tagged, read before coding)
14
- - [SETUP_FIREBASE.md](./SETUP_FIREBASE.md) - Firebase project setup (`dndev coach` → `dndev setup`)
15
- - [SETUP_SUPABASE.md](./SETUP_SUPABASE.md) - Supabase project setup (`dndev coach` → `dndev setup`)
16
- - [SETUP_TESTING.md](./SETUP_TESTING.md) - Test generation (Phase 4)
17
- - [SETUP_CICD.md](./SETUP_CICD.md) - CI/CD setup (`dndev setup-cicd` → GitHub Actions)
18
-
19
- ---
20
-
21
- ## Core Setup
22
-
23
- - [SETUP_PAGES.md](./SETUP_PAGES.md) - Pages & routing (pre-configured)
24
- - [USE_ROUTING.md](./USE_ROUTING.md) - **Routing components & hooks (CRITICAL)**
25
- - [SETUP_APP_CONFIG.md](./SETUP_APP_CONFIG.md) - App + Vite configuration
26
- - [SETUP_I18N.md](./SETUP_I18N.md) - Translations (pre-configured)
27
- - [SETUP_THEMES.md](./SETUP_THEMES.md) - Themes & CSS variables (pre-configured)
28
- - [SETUP_LAYOUTS.md](./SETUP_LAYOUTS.md) - Layout presets (pre-configured)
29
-
30
- ---
31
-
32
- ## Feature Setup
33
-
34
- - [SETUP_CRUD.md](./SETUP_CRUD.md) - CRUD operations & data access (critical)
35
- - [SETUP_AUTH.md](./SETUP_AUTH.md) - Authentication (pre-configured)
36
- - [SETUP_OAUTH.md](./SETUP_OAUTH.md) - OAuth connections (pre-configured)
37
- - [SETUP_BILLING.md](./SETUP_BILLING.md) - Stripe subscriptions (pre-configured)
38
- - [SETUP_BLOG.md](./SETUP_BLOG.md) - Convention-based markdown blog with i18n
39
- - [SETUP_PWA.md](./SETUP_PWA.md) - Progressive Web App setup
40
- - [SETUP_FUNCTIONS.md](./SETUP_FUNCTIONS.md) - Functions overview (redirects to provider guides)
41
-
42
- ---
43
-
44
- ## Component Reference
45
-
46
- - [COMPONENTS_ATOMIC.md](./COMPONENTS_ATOMIC.md) - Atomic components (@donotdev/components)
47
- - [COMPONENTS_UI.md](./COMPONENTS_UI.md) - Layout/composition components (@donotdev/ui)
48
- - [COMPONENTS_CRUD.md](./COMPONENTS_CRUD.md) - CRUD components (@donotdev/crud)
49
-
50
- ---
51
-
52
- ## Advanced
53
-
54
- - [advanced/APP_CHECK.md](./advanced/APP_CHECK.md) - Abuse protection
55
- - [advanced/EMULATORS.md](./advanced/EMULATORS.md) - Local emulator setup
56
- - [advanced/VERSION_CONTROL.md](./advanced/VERSION_CONTROL.md) - Package upgrades
57
-
58
- ---
59
-
60
- **Convention over configuration. AI-first design.**
@@ -1,132 +0,0 @@
1
- # Configuration Setup
2
-
3
- **For AI Agents:** Configure `src/config/app.ts` and `vite.config.ts`. Framework handles the rest.
4
-
5
- ---
6
-
7
- ## 1. App Configuration
8
-
9
- ```typescript
10
- // src/config/app.ts
11
- import type { AppConfig } from '@donotdev/core';
12
-
13
- export const appConfig: AppConfig = {
14
- app: {
15
- name: 'My App',
16
- shortName: 'App', // Required for PWA
17
- description: 'My app description', // Required for PWA
18
- url: 'https://myapp.com',
19
- },
20
-
21
- preset: 'landing', // landing | admin | moolti | docs | blog | game | plain
22
-
23
- features: {
24
- debug: false, // Enable debug tools
25
- requiredCookies: ['necessary'], // Cookie consent categories
26
- },
27
-
28
- auth: {
29
- authRoute: '/login',
30
- roleRoute: '/404',
31
- tierRoute: '/404',
32
- loginPath: '/login',
33
- profilePath: '/profile',
34
- },
35
-
36
- i18n: {
37
- defaultLanguage: 'en',
38
- fallbackLanguage: 'en',
39
- },
40
-
41
- theme: {
42
- defaultTheme: 'light',
43
- },
44
- };
45
- ```
46
-
47
- ---
48
-
49
- ## 2. Vite Configuration
50
-
51
- ```typescript
52
- // vite.config.ts
53
- import { defineViteConfig } from '@donotdev/core/vite';
54
- import { appConfig } from './src/config/app';
55
-
56
- export default defineViteConfig({
57
- appConfig, // Required
58
- });
59
- ```
60
-
61
- **Done.** Routes, themes, and translations are automatically detected from your `src/` directory.
62
-
63
- ---
64
-
65
- ## 3. Optional Vite Options
66
-
67
- ```typescript
68
- export default defineViteConfig({
69
- appConfig,
70
-
71
- // Debug
72
- debug: true,
73
- verbose: true,
74
-
75
- // Debug options
76
- routes: { debug: true },
77
- themes: { debug: true },
78
- i18n: { debug: true },
79
-
80
- // Server
81
- server: {
82
- port: 3000,
83
- https: true,
84
- },
85
-
86
- // Build
87
- build: {
88
- sourcemap: false,
89
- },
90
-
91
- // SEO
92
- seo: {
93
- disabled: false,
94
- generateRobotsTxt: true,
95
- generateSitemap: true,
96
- },
97
-
98
- // PWA (see SETUP_PWA.md for full guide)
99
- pwa: {
100
- enabled: false, // Enable PWA in production
101
- devEnabled: false, // Enable PWA in development (optional)
102
- },
103
- });
104
- ```
105
-
106
- ---
107
-
108
- ## 4. Environment Variables
109
-
110
- **Vite loads `.env` from the app directory only.** Not the repo root.
111
-
112
- Run `dndev coach` to see what to configure, then `dndev setup` to validate and automate. See [SETUP_FIREBASE.md](./SETUP_FIREBASE.md).
113
-
114
- ```bash
115
- # apps/<your-app>/.env — client-side variables (exposed to browser)
116
- VITE_APP_URL=http://localhost:5173
117
- VITE_DONOTDEV_LICENSE_KEY=dndev_your_key_here
118
- VITE_FIREBASE_API_KEY=... # Written by dndev setup
119
- VITE_FIREBASE_PROJECT_ID=... # Written by dndev setup
120
- VITE_AUTH_PARTNERS=github,google
121
- VITE_STRIPE_PUBLISHABLE_KEY=pk_test_...
122
-
123
- # functions/.env — server-side secrets (never exposed to browser)
124
- STRIPE_SECRET_KEY=sk_test_...
125
- STRIPE_WEBHOOK_SECRET=whsec_...
126
- ```
127
-
128
- Push server secrets to Firebase: `dndev sync-secrets`
129
-
130
- ---
131
-
132
- **Zero config. Override when needed.**
@@ -1,133 +0,0 @@
1
- # Setup: Authentication
2
-
3
- **Most is pre-configured.** Works with Firebase Auth or Supabase Auth. Add env vars and config. Framework handles providers, callbacks, sessions.
4
-
5
- ---
6
-
7
- ## Standard Use
8
-
9
- **Environment:**
10
- ```bash
11
- # .env
12
- VITE_AUTH_PARTNERS=password,emailLink,google,github,facebook
13
- ```
14
-
15
- **Config:**
16
- ```typescript
17
- // src/config/app.ts
18
- export const appConfig: AppConfig = {
19
- auth: {
20
- authRoute: '/login',
21
- loginPath: '/login', // Optional: undefined = header providers
22
- profilePath: '/profile',
23
- },
24
- };
25
- ```
26
-
27
- **Firebase:** Enable providers in Firebase Console → Authentication → Sign-in method
28
- **Supabase:** Enable providers in Supabase Dashboard → Authentication → Providers
29
-
30
- ### Redirect URLs (Supabase only)
31
-
32
- After OAuth (Google, GitHub, etc.), Supabase redirects the user back to your app. You must tell Supabase which URLs are allowed.
33
-
34
- **Supabase Dashboard → Authentication → URL Configuration:**
35
-
36
- | Setting | Value |
37
- |---------|-------|
38
- | **Site URL** | Your **production** URL (e.g., `https://myapp.vercel.app`) |
39
- | **Redirect URLs** | All URLs where auth should work (see below) |
40
-
41
- **Add to Redirect URLs:**
42
- - `http://localhost:5173` — local Vite dev
43
- - `http://localhost:3000` — local Next.js dev
44
- - `https://myapp.vercel.app` — production
45
- - `https://*-yourteam.vercel.app` — Vercel preview deploys
46
-
47
- > **Site URL must be production.** It's the fallback when no redirect URL matches. If it's `localhost:3000`, your deployed app redirects to localhost after OAuth.
48
-
49
- ---
50
-
51
- ## Advanced: Protected Routes
52
-
53
- ```tsx
54
- // Basic protection
55
- export const meta: PageMeta = {
56
- namespace: NAMESPACE,
57
- auth: { required: true },
58
- };
59
-
60
- // Role-based access
61
- export const meta: PageMeta = {
62
- namespace: NAMESPACE,
63
- auth: { required: true, role: 'admin' },
64
- };
65
-
66
- // Tier-based access
67
- export const meta: PageMeta = {
68
- namespace: NAMESPACE,
69
- auth: { required: true, tier: 'pro' },
70
- };
71
- ```
72
-
73
- ---
74
-
75
- ## Advanced: Components & Hooks
76
-
77
- ```tsx
78
- import { useAuth } from '@donotdev/auth';
79
- import { MultipleAuthProviders, AuthPartnerButton } from '@donotdev/auth';
80
- import { AuthHeader, AuthMenu } from '@donotdev/ui';
81
- import { LoginTemplate } from '@donotdev/templates';
82
-
83
- // Hook
84
- const user = useAuth('user');
85
- const signIn = useAuth('signInWithEmail');
86
- const signOut = useAuth('signOut');
87
-
88
- // Components
89
- <MultipleAuthProviders layout="vertical" emailMode="signin" />
90
- <AuthPartnerButton partnerId="google" method="popup" />
91
- ```
92
-
93
- **Pre-configured:** `AuthHeader` in layout (null if auth disabled), OAuth callbacks, session management, account linking.
94
-
95
- ---
96
-
97
- ## User Roles
98
-
99
- **Role hierarchy:** `guest (0) < user (1) < admin (2) < super (3)`
100
-
101
- **Default:** All authenticated users are `'user'` role.
102
-
103
- **Setting admin/super roles:**
104
-
105
- **Firebase** — Set customClaims:
106
- ```typescript
107
- import { getFirebaseAdminAuth } from '@donotdev/firebase/server';
108
-
109
- const auth = getFirebaseAdminAuth();
110
- await auth.setCustomUserClaims(userId, {
111
- role: 'admin', // or 'super'
112
- isAdmin: true // legacy support
113
- });
114
- ```
115
-
116
- **Supabase** — Set user metadata:
117
- ```sql
118
- -- In Supabase Dashboard → SQL Editor
119
- UPDATE auth.users SET raw_app_meta_data = raw_app_meta_data || '{"role": "admin"}' WHERE id = '<user-id>';
120
- ```
121
-
122
- **Using CLI:**
123
- ```bash
124
- dndev make-admin <userId>
125
- ```
126
-
127
- **Note:** User must sign out and sign in again for role changes to take effect.
128
-
129
- **Used by:** CRUD access control, protected routes, field visibility filtering.
130
-
131
- ---
132
-
133
- **Add env vars, get auth. Framework handles the rest.**
@@ -1,114 +0,0 @@
1
- # Setup: Billing
2
-
3
- **Most is pre-configured.** Create Stripe config files. Framework handles checkout, webhooks, subscriptions, and loading UX.
4
-
5
- ---
6
-
7
- ## Standard Use
8
-
9
- **Environment:**
10
- ```bash
11
- # apps/<app>/.env (frontend, public)
12
- VITE_STRIPE_PUBLISHABLE_KEY=pk_test_xxx
13
-
14
- # .dndev.secrets (project root, gitignored)
15
- STRIPE_SECRET_KEY=sk_test_xxx
16
- STRIPE_WEBHOOK_SECRET=whsec_xxx # From 'stripe listen' or Stripe Dashboard → Webhooks
17
- ```
18
-
19
- **Stripe Dashboard:** Create products, copy Price IDs (`price_...`)
20
-
21
- ---
22
-
23
- ## Automatic UX (Zero Config)
24
-
25
- **The hook handles loading overlays automatically for redirect operations:**
26
-
27
- ```tsx
28
- // Just call the method - framework handles the rest
29
- const checkout = useStripeBilling('checkout', authState);
30
- const openCustomerPortal = useStripeBilling('openCustomerPortal', authState);
31
-
32
- // Checkout → Shows "Redirecting to Stripe" / "Initializing secure payment..."
33
- await checkout({ priceId: 'price_123', mode: 'payment' });
34
-
35
- // Portal → Shows "Redirecting to Stripe" / "Opening billing portal..."
36
- await openCustomerPortal();
37
- ```
38
-
39
- **What happens automatically:**
40
- - Blocking fullscreen overlay during Firebase Functions cold start
41
- - Operation-specific messaging (checkout vs portal)
42
- - Translated in all 8 supported languages
43
- - Clean removal on redirect or error
44
-
45
- **Optional:** Use `loading` state if you want to disable your own buttons:
46
- ```tsx
47
- const loading = useStripeBilling('loading', authState);
48
- <Button disabled={loading}>Purchase</Button>
49
- ```
50
-
51
- ---
52
-
53
- ## Advanced: Frontend Config
54
-
55
- ```typescript
56
- // src/config/stripeFrontConfig.ts
57
- export const stripeFrontConfig: StripeFrontConfig = {
58
- pro_plan: {
59
- name: 'Pro Plan',
60
- price: 29,
61
- currency: 'USD',
62
- priceId: 'price_1234567890',
63
- allowPromotionCodes: true,
64
- },
65
- };
66
- ```
67
-
68
- ---
69
-
70
- ## Advanced: Backend Config
71
-
72
- ```typescript
73
- // functions/src/config/stripeBackConfig.ts
74
- export const stripeBackConfig: StripeBackConfig = {
75
- pro_plan: {
76
- type: 'StripeSubscription', // or 'StripePayment'
77
- price: 2900, // In cents
78
- priceId: process.env.STRIPE_PRICE_PRO_PLAN!,
79
- tier: 'pro',
80
- onPurchaseSuccess: async (userId, metadata) => { /* Grant features */ },
81
- },
82
- };
83
-
84
- // functions/src/index.ts
85
- import { createCheckoutSession } from '@donotdev/functions/firebase';
86
- export const createCheckout = createCheckoutSession(stripeBackConfig);
87
- ```
88
-
89
- ---
90
-
91
- ## Advanced: Components & Hooks
92
-
93
- ```tsx
94
- import { useStripeBilling } from '@donotdev/billing';
95
- import { SubscriptionTemplate, PaymentTemplate } from '@donotdev/templates';
96
- import { ProductCard, SubscriptionManager } from '@donotdev/billing';
97
-
98
- // Auth state required
99
- const user = useAuth('user');
100
- const status = useAuth('status');
101
- const authState = { user, status };
102
-
103
- // Methods - framework handles overlay automatically
104
- const checkout = useStripeBilling('checkout', authState);
105
- const openCustomerPortal = useStripeBilling('openCustomerPortal', authState);
106
-
107
- // Optional state access
108
- const loading = useStripeBilling('loading', authState);
109
- const error = useStripeBilling('error', authState);
110
- ```
111
-
112
- ---
113
-
114
- **Create config files, get billing with best-in-class UX. Framework handles the rest.**