@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.
- package/LICENSE.md +1 -1
- package/README.md +0 -0
- package/dependencies-matrix.json +175 -72
- package/dist/bin/commands/agent-setup.js +936 -428
- package/dist/bin/commands/build.js +4363 -883
- package/dist/bin/commands/bump.js +1296 -780
- package/dist/bin/commands/cacheout.js +494 -363
- package/dist/bin/commands/coach.js +632 -431
- package/dist/bin/commands/create-app.js +1316 -799
- package/dist/bin/commands/create-project.js +1355 -827
- package/dist/bin/commands/db.js +26158 -18868
- package/dist/bin/commands/deploy.js +5983 -1971
- package/dist/bin/commands/dev.js +1223 -657
- package/dist/bin/commands/doctor.js +1100 -528
- package/dist/bin/commands/emu.js +1380 -757
- package/dist/bin/commands/format.js +494 -363
- package/dist/bin/commands/get-demo.js +1210 -715
- package/dist/bin/commands/make-admin.js +16073 -8700
- package/dist/bin/commands/preview.js +1227 -658
- package/dist/bin/commands/seed.js +26171 -18881
- package/dist/bin/commands/setup-cicd.js +1475 -880
- package/dist/bin/commands/setup.js +1574 -956
- package/dist/bin/commands/staging.js +5984 -1972
- package/dist/bin/commands/sync-secrets.js +1423 -676
- package/dist/bin/commands/type-check.js +976 -469
- package/dist/bin/commands/wai.js +499 -368
- package/dist/bin/dndev.js +43 -19
- package/dist/bin/donotdev.js +43 -19
- package/dist/index.js +6166 -2133
- package/guidelines/DEPENDENCIES.md +155 -0
- package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
- package/package.json +2 -1
- package/templates/app-demo/.env.example +1 -1
- package/templates/app-demo/entities/Contact.ts.example +0 -0
- package/templates/app-demo/entities/ExampleEntity.ts.example +0 -0
- package/templates/app-demo/entities/demo.ts.example +0 -0
- package/templates/app-demo/index.html.example +0 -0
- package/templates/app-demo/public/apple-touch-icon.png.example +0 -0
- package/templates/app-demo/public/fonts/fonts.css.example +0 -0
- package/templates/app-demo/public/icon-192x192.png.example +0 -0
- package/templates/app-demo/public/icon-512x512.png.example +0 -0
- package/templates/app-demo/src/App.tsx.example +0 -0
- package/templates/app-demo/src/config/app.ts.example +0 -0
- package/templates/app-demo/src/entities/booking.ts.example +0 -0
- package/templates/app-demo/src/entities/onboarding.ts.example +0 -0
- package/templates/app-demo/src/entities/product.ts.example +0 -0
- package/templates/app-demo/src/entities/quote.ts.example +0 -0
- package/templates/app-demo/src/globals.css.example +0 -0
- package/templates/app-demo/src/main.tsx.example +0 -0
- package/templates/app-demo/src/pages/ChangelogPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/DashboardPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/HomePage.tsx.example +0 -0
- package/templates/app-demo/src/pages/OnboardingPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/PricingPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/ProductsPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/ProfilePage.tsx.example +0 -0
- package/templates/app-demo/src/pages/SettingsPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/ShowcasePage.tsx.example +0 -0
- package/templates/app-demo/src/pages/components/ComponentRenderer.tsx.example +0 -0
- package/templates/app-demo/src/pages/components/ComponentsData.tsx.example +0 -0
- package/templates/app-demo/src/pages/components/componentConfig.ts.example +0 -0
- package/templates/app-demo/src/pages/legal/LegalPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/legal/PrivacyPage.tsx.example +0 -0
- package/templates/app-demo/src/pages/legal/TermsPage.tsx.example +0 -0
- package/templates/app-demo/src/themes.css.example +27 -0
- package/templates/app-demo/tsconfig.json.example +0 -0
- package/templates/app-demo/vite.config.ts.example +0 -0
- package/templates/app-dndev/index.html.example +0 -3
- package/templates/app-dndev/src/App.tsx.example +0 -0
- package/templates/app-dndev/src/components/CockpitLayout.css.example +0 -0
- package/templates/app-dndev/src/components/CockpitLayout.tsx.example +0 -0
- package/templates/app-dndev/src/components/Kanban.css.example +0 -0
- package/templates/app-dndev/src/components/ModeToggle.tsx.example +0 -0
- package/templates/app-dndev/src/components/OverlaySlot.tsx.example +0 -0
- package/templates/app-dndev/src/components/TerminalPanel.css.example +0 -0
- package/templates/app-dndev/src/components/TerminalPanel.tsx.example +0 -0
- package/templates/app-dndev/src/components/markdown-prose.css.example +0 -0
- package/templates/app-dndev/src/components/phases/CaptainLog.tsx.example +0 -0
- package/templates/app-dndev/src/components/phases/ContextTabs.tsx.example +0 -0
- package/templates/app-dndev/src/components/phases/PhaseCard.tsx.example +0 -0
- package/templates/app-dndev/src/components/phases/PhaseDetail.tsx.example +0 -0
- package/templates/app-dndev/src/components/phases/ReviewPanel.tsx.example +0 -0
- package/templates/app-dndev/src/components/phases/phaseData.ts.example +0 -0
- package/templates/app-dndev/src/config/app.ts.example +0 -0
- package/templates/app-dndev/src/config/commands.ts.example +0 -0
- package/templates/app-dndev/src/config/legal.ts.example +0 -0
- package/templates/app-dndev/src/config/providers.ts.example +1 -1
- package/templates/app-dndev/src/globals.css.example +0 -0
- package/templates/app-dndev/src/hooks/useDndevFile.ts.example +0 -0
- package/templates/app-dndev/src/main.tsx.example +0 -0
- package/templates/app-dndev/src/pages/BoardPage.tsx.example +0 -0
- package/templates/app-dndev/src/pages/GrillPage.tsx.example +0 -0
- package/templates/app-dndev/src/pages/HomePage.tsx.example +0 -0
- package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +0 -0
- package/templates/app-dndev/src/pages/PhasesPage.tsx.example +0 -0
- package/templates/app-dndev/src/pages/SettingsPage.tsx.example +0 -0
- package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +0 -0
- package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +0 -0
- package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +0 -0
- package/templates/app-dndev/src/stores/dndevStore.ts.example +0 -0
- package/templates/app-dndev/src/themes.css.example +26 -0
- package/templates/app-dndev/terminal-sidecar.cjs.example +0 -0
- package/templates/app-dndev/vite.config.ts.example +0 -0
- package/templates/app-expo/.env.example +0 -32
- package/templates/app-expo/.expo/README.md.example +0 -0
- package/templates/app-expo/.gitignore.example +0 -0
- package/templates/app-expo/README.md.example +1 -1
- package/templates/app-expo/app/.gitkeep +0 -0
- package/templates/app-expo/app/_layout.tsx.example +0 -0
- package/templates/app-expo/app/form.tsx.example +0 -0
- package/templates/app-expo/app/index.tsx.example +0 -0
- package/templates/app-expo/app/list.tsx.example +0 -0
- package/templates/app-expo/app/profile.tsx.example +0 -0
- package/templates/app-expo/app/signin.tsx.example +0 -0
- package/templates/app-expo/app.json.example +0 -0
- package/templates/app-expo/assets/adaptive-icon.png +0 -0
- package/templates/app-expo/assets/favicon.png +0 -0
- package/templates/app-expo/assets/icon.png +0 -0
- package/templates/app-expo/assets/splash.png +0 -0
- package/templates/app-expo/babel.config.js.example +0 -0
- package/templates/app-expo/eas.json.example +0 -0
- package/templates/app-expo/expo-env.d.ts.example +0 -0
- package/templates/app-expo/metro.config.js.example +0 -0
- package/templates/app-expo/service-account-key.json.example +1 -1
- package/templates/app-expo/src/config/app.ts.example +0 -0
- package/templates/app-expo/src/config/providers.ts.example +1 -1
- package/templates/app-expo/tsconfig.json.example +0 -0
- package/templates/app-next/.env.example +0 -33
- package/templates/app-next/next.config.ts.example +0 -2
- package/templates/app-next/postcss.config.js.example +0 -0
- package/templates/app-next/service-account-key.json.example +0 -0
- package/templates/app-next/src/app/ClientLayout.tsx.example +0 -0
- package/templates/app-next/src/app/layout.tsx.example +13 -4
- package/templates/app-next/src/app/not-found.tsx.example +0 -0
- package/templates/app-next/src/config/app.ts.example +0 -0
- package/templates/app-next/src/config/legal.ts.example +0 -0
- package/templates/app-next/src/config/providers.ts.example +1 -1
- package/templates/app-next/src/globals.css.example +0 -0
- package/templates/app-next/src/locales/dndev_en.json.example +0 -0
- package/templates/app-next/src/locales/home_en.json.example +6 -6
- package/templates/app-next/src/pages/HomePage.tsx.example +0 -0
- package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +0 -0
- package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +0 -0
- package/templates/app-next/src/pages/legal/TermsPage.tsx.example +0 -0
- package/templates/app-next/src/pages/locales/example_en.json.example +0 -0
- package/templates/app-next/src/themes.css.example +28 -1
- package/templates/app-vite/.env.example +0 -33
- package/templates/app-vite/csp.example.json +44 -0
- package/templates/app-vite/index.html.example +0 -3
- package/templates/app-vite/service-account-key.json.example +0 -0
- package/templates/app-vite/src/App.tsx.example +0 -0
- package/templates/app-vite/src/config/app.ts.example +0 -0
- package/templates/app-vite/src/config/legal.ts.example +0 -0
- package/templates/app-vite/src/config/providers.ts.example +1 -1
- package/templates/app-vite/src/globals.css.example +0 -0
- package/templates/app-vite/src/locales/dndev_en.json.example +0 -0
- package/templates/app-vite/src/locales/home_en.json.example +6 -6
- package/templates/app-vite/src/main.tsx.example +0 -0
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +0 -0
- package/templates/app-vite/src/pages/HomePage.tsx.example +1 -1
- package/templates/app-vite/src/pages/ListPageExample.tsx.example +0 -0
- package/templates/app-vite/src/pages/NotFoundPage.tsx.example +0 -0
- package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +0 -0
- package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +0 -0
- package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +0 -0
- package/templates/app-vite/src/pages/locales/example_en.json.example +0 -0
- package/templates/app-vite/src/themes.css.example +26 -0
- package/templates/deploy-config/.firebaserc.example +0 -0
- package/templates/deploy-config/firestore.indexes.json.example +0 -0
- package/templates/deploy-config/firestore.rules.example +0 -0
- package/templates/deploy-config/storage.rules.example +0 -0
- package/templates/deploy-config/tsconfig.functions.json.example +0 -0
- package/templates/deploy-config/vercel.json.example +2 -2
- package/templates/functions-firebase/.env.example +2 -2
- package/templates/functions-firebase/README.md.example +3 -3
- package/templates/functions-firebase/build.mjs.example +0 -0
- package/templates/functions-firebase/functions.config.js.example +0 -0
- package/templates/functions-firebase/functions.yaml.example +0 -0
- package/templates/functions-firebase/src/auth/getCustomClaims.ts.example +0 -0
- package/templates/functions-firebase/src/auth/getUserAuthStatus.ts.example +0 -0
- package/templates/functions-firebase/src/auth/index.ts.example +0 -0
- package/templates/functions-firebase/src/auth/removeCustomClaims.ts.example +0 -0
- package/templates/functions-firebase/src/auth/setCustomClaims.ts.example +0 -0
- package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +0 -0
- package/templates/functions-firebase/src/billing/index.ts.example +0 -0
- package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -0
- package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +0 -0
- package/templates/functions-firebase/src/crud/createEntity.ts.example +0 -0
- package/templates/functions-firebase/src/crud/deleteEntity.ts.example +0 -0
- package/templates/functions-firebase/src/crud/getEntity.ts.example +0 -0
- package/templates/functions-firebase/src/crud/index.ts.example +0 -0
- package/templates/functions-firebase/src/crud/listEntities.ts.example +0 -0
- package/templates/functions-firebase/src/crud/updateEntity.ts.example +0 -0
- package/templates/functions-firebase/src/index.ts.example +0 -0
- package/templates/functions-firebase/src/oauth/checkGitHubAccess.ts.example +0 -0
- package/templates/functions-firebase/src/oauth/disconnect.ts.example +0 -0
- package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +0 -0
- package/templates/functions-firebase/src/oauth/getConnections.ts.example +0 -0
- package/templates/functions-firebase/src/oauth/grantGitHubAccess.ts.example +0 -0
- package/templates/functions-firebase/src/oauth/index.ts.example +0 -0
- package/templates/functions-firebase/src/oauth/refreshToken.ts.example +0 -0
- package/templates/functions-firebase/src/oauth/revokeGitHubAccess.ts.example +0 -0
- package/templates/functions-firebase/tsconfig.json.example +0 -0
- package/templates/functions-supabase/supabase/config.toml.example +0 -0
- package/templates/functions-supabase/supabase/functions/.env.example +0 -0
- package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/crud/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/deno.json.example +0 -0
- package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +0 -0
- package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +0 -0
- package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000004_crud_bulk.sql +192 -0
- package/templates/functions-vercel/.env.example +3 -3
- package/templates/functions-vercel/README.md.example +2 -2
- package/templates/functions-vercel/build.mjs.example +0 -0
- package/templates/functions-vercel/src/api/auth/getCustomClaims.ts.example +0 -0
- package/templates/functions-vercel/src/api/auth/getUserAuthStatus.ts.example +0 -0
- package/templates/functions-vercel/src/api/auth/removeCustomClaims.ts.example +0 -0
- package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +0 -0
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +0 -0
- package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -0
- package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +0 -0
- package/templates/functions-vercel/src/api/crud/createEntity.ts.example +0 -0
- package/templates/functions-vercel/src/api/crud/deleteEntity.ts.example +0 -0
- package/templates/functions-vercel/src/api/crud/getEntity.ts.example +0 -0
- package/templates/functions-vercel/src/api/crud/listEntities.ts.example +0 -0
- package/templates/functions-vercel/src/api/crud/updateEntity.ts.example +0 -0
- package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +0 -0
- package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -0
- package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +0 -0
- package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -0
- package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +0 -0
- package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -0
- package/templates/functions-vercel/src/api/oauth/revokeGitHubAccess.ts.example +0 -0
- package/templates/functions-vercel/tsconfig.json.example +0 -0
- package/templates/functions-vercel/vercel.json.example +0 -0
- package/templates/github-consumer/.github/workflows/ci.yml.example +0 -0
- package/templates/overlay-firebase/env.fragment.example +0 -0
- package/templates/overlay-firebase/env.fragment.expo.example +0 -0
- package/templates/overlay-firebase/env.fragment.nextjs.example +0 -0
- package/templates/overlay-firebase/src/config/providers.expo.ts.example +0 -0
- package/templates/overlay-firebase/src/config/providers.ts.example +0 -0
- package/templates/overlay-supabase/env.fragment.example +0 -0
- package/templates/overlay-supabase/env.fragment.expo.example +0 -0
- package/templates/overlay-supabase/env.fragment.nextjs.example +0 -0
- package/templates/overlay-supabase/src/config/providers.expo.ts.example +1 -1
- package/templates/overlay-supabase/src/config/providers.ts.example +1 -1
- package/templates/overlay-vercel/env.fragment.example +0 -0
- package/templates/overlay-vercel/env.fragment.nextjs.example +0 -0
- package/templates/overlay-vercel/src/config/providers.ts.example +0 -0
- package/templates/preset-admin/src/pages/DashboardPage.tsx.example +0 -0
- package/templates/preset-admin/src/pages/EntityPage.tsx.example +0 -0
- package/templates/preset-admin/src/pages/ReportsPage.tsx.example +0 -0
- package/templates/preset-admin/src/pages/SettingsPage.tsx.example +0 -0
- package/templates/preset-admin/src/pages/UsersPage.tsx.example +0 -0
- package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +0 -0
- package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +0 -0
- package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +0 -0
- package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +0 -0
- package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +0 -0
- package/templates/preset-landing/src/pages/AboutPage.tsx.example +0 -0
- package/templates/preset-landing/src/pages/ContactPage.tsx.example +0 -0
- package/templates/preset-landing/src/pages/HomePage.tsx.example +0 -0
- package/templates/preset-saas/src/pages/DashboardPage.tsx.example +0 -0
- package/templates/preset-saas/src/pages/HomePage.tsx.example +0 -0
- package/templates/preset-saas/src/pages/PricingPage.tsx.example +0 -0
- package/templates/preset-saas/src/pages/ProfilePage.tsx.example +0 -0
- package/templates/preset-saas/src/pages/SettingsPage.tsx.example +0 -0
- package/templates/root-consumer/.claude/agents/architect.md.example +0 -0
- package/templates/root-consumer/.claude/agents/builder.md.example +0 -0
- package/templates/root-consumer/.claude/agents/coder.md.example +0 -0
- package/templates/root-consumer/.claude/agents/extractor.md.example +0 -0
- package/templates/root-consumer/.claude/agents/polisher.md.example +0 -0
- package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +0 -0
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +56 -0
- package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
- package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
- package/templates/root-consumer/.claude/rules/git.md.example +14 -0
- package/templates/root-consumer/.claude/rules/security.md.example +13 -0
- package/templates/root-consumer/.claude/settings.json.example +100 -4
- package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +0 -0
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +22 -27
- package/templates/root-consumer/.claude/skills/design/SKILL.md.example +0 -0
- package/templates/root-consumer/.claude/skills/design/output-template.md +0 -0
- package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +26 -15
- package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
- package/templates/root-consumer/.claude/skills/techdebt/SKILL.md.example +0 -0
- package/templates/root-consumer/.cursor/mcp.json.example +0 -0
- package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +5 -1
- package/templates/root-consumer/.dndev/args.json.example +0 -0
- package/templates/root-consumer/.dndev.secrets.example +0 -0
- package/templates/root-consumer/.env.example +0 -1
- package/templates/root-consumer/.gemini/settings.json.example +0 -0
- package/templates/root-consumer/.gitignore.example +1 -0
- package/templates/root-consumer/.mcp.json.example +0 -0
- package/templates/root-consumer/.prettierrc.cjs.example +0 -0
- package/templates/root-consumer/AGENTS.md.example +63 -0
- package/templates/root-consumer/CLAUDE.md.example +1 -1
- package/templates/root-consumer/README.md.example +11 -33
- package/templates/root-consumer/entities/index.ts.example +0 -0
- package/templates/root-consumer/eslint.config.js.example +0 -0
- package/templates/root-consumer/tsconfig.json.example +0 -0
- package/templates/app-demo/public/manifest.json.example +0 -10
- package/templates/app-dndev/public/manifest.json.example +0 -10
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -175
- package/templates/root-consumer/.claude/commands/build.md.example +0 -131
- package/templates/root-consumer/.claude/commands/design.md.example +0 -184
- package/templates/root-consumer/.claude/commands/grill.md.example +0 -135
- package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
- package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
- package/templates/root-consumer/.claude/statusline.py.example +0 -79
- package/templates/root-consumer/.clinerules.example +0 -1
- package/templates/root-consumer/.cursorrules.example +0 -1
- package/templates/root-consumer/.github/copilot-instructions.md.example +0 -1
- package/templates/root-consumer/.windsurfrules.example +0 -1
- package/templates/root-consumer/AI.md.example +0 -108
- package/templates/root-consumer/CONVENTIONS.md.example +0 -1
- package/templates/root-consumer/GEMINI.md.example +0 -1
- package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +0 -135
- package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -276
- package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
- package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
- package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
- package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
- package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
- package/templates/root-consumer/guides/dndev/INDEX.md.example +0 -60
- package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
- package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +0 -133
- package/templates/root-consumer/guides/dndev/SETUP_BILLING.md.example +0 -114
- package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
- package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
- package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +0 -231
- package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
- package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
- package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +0 -54
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +0 -60
- package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
- package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
- package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +0 -234
- package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +0 -62
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +0 -215
- package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
- package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
- package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
- package/templates/root-consumer/guides/dndev/advanced/APP_CHECK.md.example +0 -111
- package/templates/root-consumer/guides/dndev/advanced/COOKIE_REFERENCE.md.example +0 -252
- package/templates/root-consumer/guides/dndev/advanced/EMULATORS.md.example +0 -48
- package/templates/root-consumer/guides/dndev/essences_reference.css.example +0 -288
- package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +0 -402
- package/templates/root-consumer/guides/wai-way/agents/architect.md.example +0 -78
- package/templates/root-consumer/guides/wai-way/agents/builder.md.example +0 -97
- package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +0 -363
- package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +0 -133
- package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +0 -315
- package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +0 -133
- package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +0 -111
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +0 -150
- package/templates/root-consumer/guides/wai-way/blueprints/4_configure.md.example +0 -238
- package/templates/root-consumer/guides/wai-way/context_map.json.example +0 -127
- package/templates/root-consumer/guides/wai-way/entity_patterns.md.example +0 -839
- package/templates/root-consumer/guides/wai-way/hld_template.md.example +0 -138
- package/templates/root-consumer/guides/wai-way/lld_template.md.example +0 -103
- package/templates/root-consumer/guides/wai-way/page_patterns.md.example +0 -722
- package/templates/root-consumer/guides/wai-way/prd_template.md.example +0 -140
- package/templates/root-consumer/guides/wai-way/presets_guide.md.example +0 -217
- package/templates/root-consumer/guides/wai-way/spec_template.md.example +0 -313
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
# Setup: CRUD Operations
|
|
2
|
-
|
|
3
|
-
> **API details:** `lookup_symbol("symbolName")` via MCP for full props, return types, and examples from JSDoc.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Define Entity (SSOT)
|
|
8
|
-
|
|
9
|
-
The entity definition drives everything — forms, lists, validation, access, search, sort, backend.
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
import { defineEntity } from '@donotdev/core';
|
|
13
|
-
|
|
14
|
-
export const productEntity = defineEntity({
|
|
15
|
-
name: 'Product',
|
|
16
|
-
collection: 'products',
|
|
17
|
-
search: { fields: ['name', 'description'] },
|
|
18
|
-
defaultSort: { field: 'createdAt', direction: 'desc' },
|
|
19
|
-
fields: {
|
|
20
|
-
name: { name: 'name', label: 'name', type: 'text', visibility: 'guest', validation: { required: true } },
|
|
21
|
-
price: { name: 'price', label: 'price', type: 'price', visibility: 'guest', validation: { required: true } },
|
|
22
|
-
image: { name: 'image', label: 'image', type: 'image', visibility: 'guest' },
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Auto-added fields:** `id`, `createdAt`, `updatedAt`, `createdById`, `updatedById`, `status`.
|
|
28
|
-
|
|
29
|
-
See `lookup_symbol("defineEntity")` for all options (scope, access, ownership, uniqueKeys, validation).
|
|
30
|
-
|
|
31
|
-
### Status Field (auto-added)
|
|
32
|
-
|
|
33
|
-
The `status` field is auto-added by `defineEntity()` with **locked** properties:
|
|
34
|
-
|
|
35
|
-
| Property | Locked Value | Can Override? |
|
|
36
|
-
|----------|-------------|---------------|
|
|
37
|
-
| `type` | `'select'` | No |
|
|
38
|
-
| `visibility` | `'admin'` | No |
|
|
39
|
-
| `editable` | `'admin'` | No |
|
|
40
|
-
| `required` | `true` | No |
|
|
41
|
-
|
|
42
|
-
**Default options:** `draft`, `available`, `deleted` — always present, cannot be removed.
|
|
43
|
-
**Default value:** `available`.
|
|
44
|
-
|
|
45
|
-
To add custom options, define **only** `validation.options` — they merge after defaults:
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
fields: {
|
|
49
|
-
status: {
|
|
50
|
-
validation: {
|
|
51
|
-
options: [
|
|
52
|
-
{ value: 'shipped', label: 'Shipped' },
|
|
53
|
-
{ value: 'returned', label: 'Returned' },
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
// Result: [draft, available, deleted, shipped, returned]
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**Do NOT** set `type`, `visibility`, or `editable` on `status` — they are silently ignored.
|
|
62
|
-
|
|
63
|
-
> `draft` and `deleted` items are hidden from non-admin users (server-side filtering).
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## 2. Provider Setup (once)
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
// config/providers.ts
|
|
71
|
-
import { configureProviders } from '@donotdev/core';
|
|
72
|
-
import { FirestoreAdapter } from '@donotdev/firebase'; // or SupabaseCrudAdapter
|
|
73
|
-
|
|
74
|
-
configureProviders({ crud: new FirestoreAdapter() });
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Import in `App.tsx`: `import './config/providers';`
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## 3. Backend Functions
|
|
82
|
-
|
|
83
|
-
**Firebase:**
|
|
84
|
-
```typescript
|
|
85
|
-
// functions/src/index.ts
|
|
86
|
-
import { initializeApp } from 'firebase-admin/app';
|
|
87
|
-
import { createCrudFunctions } from '@donotdev/functions/firebase';
|
|
88
|
-
import * as entities from 'entities';
|
|
89
|
-
|
|
90
|
-
initializeApp();
|
|
91
|
-
export const crud = createCrudFunctions(entities);
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
**Supabase:**
|
|
95
|
-
```typescript
|
|
96
|
-
// supabase/functions/crud/index.ts
|
|
97
|
-
import * as entities from '../_shared/entities.ts';
|
|
98
|
-
import { createSupabaseCrudFunctions } from '@donotdev/functions/supabase';
|
|
99
|
-
|
|
100
|
-
const { serve } = createSupabaseCrudFunctions(entities);
|
|
101
|
-
Deno.serve(serve);
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
See [SETUP_FIREBASE.md](./SETUP_FIREBASE.md) or [SETUP_SUPABASE.md](./SETUP_SUPABASE.md) for full function setup.
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## 4. Use Components
|
|
109
|
-
|
|
110
|
-
Drop components on a page. Entity drives the UI — no configuration needed.
|
|
111
|
-
|
|
112
|
-
```tsx
|
|
113
|
-
<EntityList entity={productEntity} userRole={user?.role} />
|
|
114
|
-
<EntityCardList entity={productEntity} basePath="/shop" cols={[1, 2, 3, 4]} />
|
|
115
|
-
<EntityFormRenderer entity={productEntity} operation="create" onSubmit={handleSubmit} cancelPath="/products" />
|
|
116
|
-
<EntityDisplayRenderer entity={productEntity} id={id} />
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Use `lookup_symbol("ComponentName")` for full props.
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## 5. Visibility & Access
|
|
124
|
-
|
|
125
|
-
### Field Visibility (who sees what)
|
|
126
|
-
|
|
127
|
-
| Level | Who |
|
|
128
|
-
|-------|-----|
|
|
129
|
-
| `'guest'` | Everyone |
|
|
130
|
-
| `'user'` | Authenticated |
|
|
131
|
-
| `'admin'` | Admins |
|
|
132
|
-
| `'super'` | Super admins |
|
|
133
|
-
| `'technical'` | Admins only, read-only in forms |
|
|
134
|
-
| `'owner'` | Stakeholders only (see `ownership`) |
|
|
135
|
-
| `'hidden'` | Never |
|
|
136
|
-
|
|
137
|
-
### Entity Access (who can CRUD)
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
access: { create: 'admin', read: 'guest', update: 'admin', delete: 'admin' }
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Ownership
|
|
144
|
-
|
|
145
|
-
For marketplace patterns. See `lookup_symbol("defineEntity")` → `ownership`.
|
|
146
|
-
|
|
147
|
-
**Firebase:** Enforced by generated secure Firebase Functions (server-side).
|
|
148
|
-
**Supabase:** Enforced via RLS policies — generated by `dndev setup`.
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## 6. Multi-Tenancy (Scope)
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
registerScopeProvider('company', () => companyStore.getState().currentCompanyId);
|
|
156
|
-
|
|
157
|
-
export const clientEntity = defineEntity({
|
|
158
|
-
scope: { field: 'companyId', provider: 'company' },
|
|
159
|
-
// ... (companyId auto-added, all CRUD ops auto-scoped)
|
|
160
|
-
});
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
See `lookup_symbol("registerScopeProvider")`.
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## 7. Data Fetching & Pagination
|
|
168
|
-
|
|
169
|
-
### Default: Auto Mode (zero config)
|
|
170
|
-
|
|
171
|
-
```tsx
|
|
172
|
-
<EntityList entity={productEntity} />
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
That's it. The framework handles pagination automatically:
|
|
176
|
-
|
|
177
|
-
1. **First fetch** — loads up to 1000 items client-side (instant search, sort, filter in the browser)
|
|
178
|
-
2. **If total > 1000** — auto-switches to server pagination (fetches one page at a time via cursor)
|
|
179
|
-
|
|
180
|
-
You never need to configure pagination mode. It just works.
|
|
181
|
-
|
|
182
|
-
### Forcing a Mode (rare)
|
|
183
|
-
|
|
184
|
-
| Mode | Behavior | When to force |
|
|
185
|
-
|------|----------|---------------|
|
|
186
|
-
| `pagination='auto'` (default) | Client-side up to 1000, auto-switches to server if more | Never — this is the default |
|
|
187
|
-
| `pagination='client'` | Always client-side, fetches all | You know the dataset is small and want instant filters |
|
|
188
|
-
| `pagination='server'` | Always server-side, cursor pagination | You know the dataset is huge and want minimal fetch |
|
|
189
|
-
|
|
190
|
-
```tsx
|
|
191
|
-
// Force server pagination with custom page size
|
|
192
|
-
<EntityList entity={productEntity} pagination="server" pageSize={50} />
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### What Changes When Auto-Switches to Server
|
|
196
|
-
|
|
197
|
-
| Feature | Client mode (< 1000) | Server mode (> 1000) |
|
|
198
|
-
|---------|----------------------|----------------------|
|
|
199
|
-
| Search | Instant (in-memory) | Re-fetches per query |
|
|
200
|
-
| Sort | Instant | Re-fetches |
|
|
201
|
-
| Filters | Instant | Re-fetches |
|
|
202
|
-
| Page navigation | Instant | Fetches next page |
|
|
203
|
-
|
|
204
|
-
Server mode fetches only `pageSize` items per request — not the whole collection.
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## What's Available
|
|
209
|
-
|
|
210
|
-
### Components (`@donotdev/ui`)
|
|
211
|
-
|
|
212
|
-
| Component | One-liner |
|
|
213
|
-
|-----------|-----------|
|
|
214
|
-
| `EntityList` | Table list with search, filters, pagination, routing |
|
|
215
|
-
| `EntityCardList` | Card grid with search, filters, favorites, routing |
|
|
216
|
-
| `EntityFormRenderer` | Auto-generated form from entity (create/edit) |
|
|
217
|
-
| `EntityDisplayRenderer` | Read-only detail view, auto-fetches by ID |
|
|
218
|
-
| `EntityRecommendations` | "You may also like" related items |
|
|
219
|
-
|
|
220
|
-
### Templates (`@donotdev/templates`)
|
|
221
|
-
|
|
222
|
-
| Template | One-liner |
|
|
223
|
-
|----------|-----------|
|
|
224
|
-
| `ProductCardListTemplate` | Shop card grid with price, image, sale badges |
|
|
225
|
-
| `CarCardListTemplate` | Automotive listing with mileage, year |
|
|
226
|
-
| `CarDetailTemplate` | Car detail with gallery, specs, price |
|
|
227
|
-
| `InquiryFormTemplate` | Contact form (Customer + Inquiry, GDPR) |
|
|
228
|
-
| `InquiryAdminTemplate` | Admin dashboard for inquiries |
|
|
229
|
-
| `HomeTemplate` | Landing page |
|
|
230
|
-
| `LoginTemplate` | Auth login page |
|
|
231
|
-
| `DashboardTemplate` | Admin dashboard |
|
|
232
|
-
| `CheckoutTemplate` | Stripe checkout |
|
|
233
|
-
| `BillingSuccessTemplate` | Post-checkout success |
|
|
234
|
-
| `UserSubscriptionTemplate` | Manage subscription |
|
|
235
|
-
|
|
236
|
-
### Hooks (`@donotdev/crud`)
|
|
237
|
-
|
|
238
|
-
| Hook | One-liner |
|
|
239
|
-
|------|-----------|
|
|
240
|
-
| `useCrud` | CRUD actions: `add`, `update`, `delete`, `get`, `set`, `query` |
|
|
241
|
-
| `useCrudList` | Real-time list with search, filters, sort applied |
|
|
242
|
-
| `useCrudCardList` | Same as `useCrudList`, optimized for public card views |
|
|
243
|
-
| `useCrudFilters` | Filter state per collection, auto-consumed by list hooks |
|
|
244
|
-
| `useEntityForm` | Form state for custom form layouts |
|
|
245
|
-
| `useEntityField` | Single-field control for custom form layouts |
|
|
246
|
-
| `useEntityFavorites` | Local favorites (localStorage) |
|
|
247
|
-
| `useRelatedItems` | Fetch related items by reference field |
|
|
248
|
-
| `useFileUpload` | File upload with progress tracking |
|
|
249
|
-
| `useUnsavedChangesWarning` | Warn before leaving with unsaved changes |
|
|
250
|
-
|
|
251
|
-
### Utilities (`@donotdev/crud`)
|
|
252
|
-
|
|
253
|
-
| Utility | One-liner |
|
|
254
|
-
|---------|-----------|
|
|
255
|
-
| `formatValue` | Format any field value for display |
|
|
256
|
-
| `applyFilters` / `applySearch` / `applySort` | Processing pipeline (what `useCrudList` does internally) |
|
|
257
|
-
| `registerFieldType` | Register custom field type |
|
|
258
|
-
| `validateEntity` | Validate entity data against schemas |
|
|
259
|
-
| `isFieldEditable` / `getFieldsForOperation` | Field visibility helpers |
|
|
260
|
-
|
|
261
|
-
### Routing (`@donotdev/ui`)
|
|
262
|
-
|
|
263
|
-
| Symbol | One-liner |
|
|
264
|
-
|--------|-----------|
|
|
265
|
-
| `useNavigate` | Programmatic navigation (Vite/Next.js auto-detected) |
|
|
266
|
-
| `useParams` | Read route params |
|
|
267
|
-
| `Link` | Declarative navigation |
|
|
268
|
-
| `AuthGuard` | Protect routes by auth + role |
|
|
269
|
-
|
|
270
|
-
**Convention:** `/${collection}` (list) · `/${collection}/new` (create) · `/${collection}/:id` (detail/edit)
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
## Built-in Field Types
|
|
275
|
-
|
|
276
|
-
| Category | Types |
|
|
277
|
-
|----------|-------|
|
|
278
|
-
| **Text** | `text`, `email`, `tel`, `url`, `color`, `password`, `textarea`, `richtext` |
|
|
279
|
-
| **Number** | `number`, `currency`, `price`, `range`, `year` |
|
|
280
|
-
| **Boolean** | `checkbox`, `boolean`, `switch` |
|
|
281
|
-
| **Date/Time** | `date`, `datetime-local`, `time`, `week`, `month`, `timestamp` |
|
|
282
|
-
| **Selection** | `select`, `combobox`, `multiselect`, `radio` |
|
|
283
|
-
| **Files** | `file`, `files`, `document`, `documents`, `image`, `images` |
|
|
284
|
-
| **Complex** | `geopoint`, `address`, `map`, `array` |
|
|
285
|
-
| **Special** | `avatar`, `badge`, `hidden`, `submit`, `reset` |
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
## Custom Field Types (escape hatch)
|
|
290
|
-
|
|
291
|
-
When built-in types don't fit, register your own with `registerFieldType`. One call wires form component + display formatter + filter.
|
|
292
|
-
|
|
293
|
-
```typescript
|
|
294
|
-
import { registerFieldType, useController } from '@donotdev/crud';
|
|
295
|
-
import type { ControlledFieldProps } from '@donotdev/crud';
|
|
296
|
-
|
|
297
|
-
function StatusTierField({ fieldConfig, control, t }: ControlledFieldProps) {
|
|
298
|
-
const { field, fieldState } = useController({ name: fieldConfig.name, control });
|
|
299
|
-
return (
|
|
300
|
-
<select value={field.value ?? ''} onChange={(e) => field.onChange(e.target.value)}>
|
|
301
|
-
<option value="basic">Basic</option>
|
|
302
|
-
<option value="premium">Premium</option>
|
|
303
|
-
</select>
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
registerFieldType({
|
|
308
|
-
type: 'statusTier',
|
|
309
|
-
controlledComponent: StatusTierField,
|
|
310
|
-
displayFormatter: (value) => value ? String(value).charAt(0).toUpperCase() + String(value).slice(1) : '—',
|
|
311
|
-
filterable: true,
|
|
312
|
-
filterType: 'select',
|
|
313
|
-
});
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
Then use in entity: `tier: { name: 'tier', label: 'tier', type: 'statusTier', visibility: 'guest' }`
|
|
317
|
-
|
|
318
|
-
See `lookup_symbol("registerFieldType")`, `lookup_symbol("ControlledFieldProps")`.
|
|
319
|
-
|
|
320
|
-
---
|
|
321
|
-
|
|
322
|
-
## i18n
|
|
323
|
-
|
|
324
|
-
**Namespace:** `entity-${entity.name.toLowerCase()}` (customizable via `namespace`).
|
|
325
|
-
|
|
326
|
-
```json
|
|
327
|
-
{ "fields": { "name": "Product Name", "price": "Price" }, "name": "Product" }
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
Status labels: entity namespace → `crud` namespace fallback.
|
|
331
|
-
|
|
332
|
-
---
|
|
333
|
-
|
|
334
|
-
**Define entity → register provider → register functions → drop components. Entity is the SSOT — everything flows from it.**
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
# Setup: Firebase
|
|
2
|
-
|
|
3
|
-
**From zero to deployed in 5 steps. Covers Auth, Firestore, Storage, Cloud Functions, and Hosting.**
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Step 1: Run Coach + Fill .env
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
dndev coach
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
This prints a numbered checklist of what to configure. For Firebase, you'll need:
|
|
14
|
-
- **SDK config** (API key, project ID, auth domain, etc.) → paste into your app's `.env`
|
|
15
|
-
- **Service account key** → download and save as `service-account-key.json`
|
|
16
|
-
- **Enable services** (Auth, Firestore, Storage) in Firebase Console
|
|
17
|
-
|
|
18
|
-
Then run setup to validate and automate:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
dndev setup
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Setup validates .env values, checks Firebase CLI, selects/creates a web app, updates `.firebaserc` and `firebase.json`.
|
|
25
|
-
|
|
26
|
-
**After running, it will prompt you for 2 manual steps (below).**
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Step 2: Download Service Account Key
|
|
31
|
-
|
|
32
|
-
The CLI gives you a direct link. In short:
|
|
33
|
-
|
|
34
|
-
1. Firebase Console → Project Settings → Service Accounts
|
|
35
|
-
2. Click "Generate new private key"
|
|
36
|
-
3. Save the file as `service-account-key.json` in your app root
|
|
37
|
-
4. This file is `.gitignored` — never commit it
|
|
38
|
-
|
|
39
|
-
**Why?** The service account key authenticates `dndev deploy` and Cloud Functions to your Firebase project. Without it, deployment fails.
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Step 3: Enable Firebase Services
|
|
44
|
-
|
|
45
|
-
Go to the Firebase Console and enable:
|
|
46
|
-
|
|
47
|
-
**Authentication** (required):
|
|
48
|
-
- Get Started → Enable Email/Password
|
|
49
|
-
- Add OAuth providers if needed (Google, GitHub, etc.)
|
|
50
|
-
|
|
51
|
-
**Cloud Firestore** (required):
|
|
52
|
-
- Create Database → Start in test mode → Select region (e.g., europe-west1)
|
|
53
|
-
- Test mode rules expire after 30 days — Phase 4 generates proper rules
|
|
54
|
-
|
|
55
|
-
**Storage** (optional — only if your app uploads files):
|
|
56
|
-
- Get Started → Select region
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Step 4: Test Locally
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
dndev emu start
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Select services: Auth + Firestore + Functions. This starts Firebase emulators so you can develop without touching production.
|
|
67
|
-
|
|
68
|
-
**Verify:** Open the app (`dndev dev`), sign up, create some data. Everything runs locally.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Step 5: Deploy
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
dndev deploy
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
This handles everything:
|
|
79
|
-
- Builds the app
|
|
80
|
-
- Deploys hosting (your frontend)
|
|
81
|
-
- Deploys Cloud Functions (your backend)
|
|
82
|
-
- Configures Cloud Run IAM automatically (fixes CORS preflight on 2nd gen functions)
|
|
83
|
-
- Deploys Firestore rules (if `firestore.rules` exists)
|
|
84
|
-
|
|
85
|
-
**After deploy:** Your app is live at `https://<project-id>.web.app`.
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Cloud Functions
|
|
90
|
-
|
|
91
|
-
Functions are scaffolded in `functions/` and auto-deployed with `dndev deploy`.
|
|
92
|
-
|
|
93
|
-
**Server secrets** (Stripe, OAuth, etc.) go in `functions/.env` — see the [Secrets](#secrets-stripe-oauth-etc) section below.
|
|
94
|
-
|
|
95
|
-
### CRUD Functions (one line)
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
// functions/src/index.ts
|
|
99
|
-
import { initializeApp } from 'firebase-admin/app';
|
|
100
|
-
import { createCrudFunctions } from '@donotdev/functions/firebase';
|
|
101
|
-
import * as entities from 'entities';
|
|
102
|
-
|
|
103
|
-
initializeApp();
|
|
104
|
-
export const crud = createCrudFunctions(entities);
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Result:** Auto-generates CRUD handlers for each entity. The export name (camelCase, e.g. `crud`) is what you use client-side: `httpsCallable(functions, 'crud')`. The operation ID (snake_case, e.g. `create_products`) is used internally for logging and rate limiting.
|
|
108
|
-
|
|
109
|
-
### Custom Functions
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
import * as v from 'valibot';
|
|
113
|
-
import { createFunction } from '@donotdev/functions/firebase';
|
|
114
|
-
import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
|
|
115
|
-
|
|
116
|
-
const schema = v.object({ productId: v.string() });
|
|
117
|
-
|
|
118
|
-
export const getProductDetails = createFunction(schema, 'get_product_details', async (data, { uid }) => {
|
|
119
|
-
const db = getFirebaseAdminFirestore();
|
|
120
|
-
const doc = await db.collection('products').doc(data.productId).get();
|
|
121
|
-
return doc.data();
|
|
122
|
-
});
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Rate limiting, metrics, auth, schema validation — all included by default.
|
|
126
|
-
|
|
127
|
-
### Import Rules
|
|
128
|
-
|
|
129
|
-
**Functions run on Node.js — you MUST use `/server` imports:**
|
|
130
|
-
|
|
131
|
-
```typescript
|
|
132
|
-
// ✅ CORRECT
|
|
133
|
-
import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
|
|
134
|
-
import { handleError } from '@donotdev/core/server';
|
|
135
|
-
|
|
136
|
-
// ❌ WRONG - crashes on deploy
|
|
137
|
-
import { getFirestore } from '@donotdev/firebase';
|
|
138
|
-
import { handleError } from '@donotdev/core';
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Cloud Run IAM (Technical Detail)
|
|
142
|
-
|
|
143
|
-
Firebase 2nd gen Cloud Functions run on Cloud Run. By default, Cloud Run blocks unauthenticated OPTIONS requests (CORS preflight). `dndev deploy` automatically runs `gcloud run services update --no-invoker-iam-check` on all deployed functions.
|
|
144
|
-
|
|
145
|
-
If you deploy manually with `firebase deploy`, you'll see `403 Forbidden` on CORS preflight. Use `dndev deploy` instead.
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## Environment Variables
|
|
150
|
-
|
|
151
|
-
**Vite loads `.env` from the app directory only. NOT from the repo root.**
|
|
152
|
-
|
|
153
|
-
| File | What Goes Here | Loaded By |
|
|
154
|
-
|------|---------------|-----------|
|
|
155
|
-
| `apps/<app>/.env` | Firebase config, license key, Stripe publishable key | Vite (at dev + build) |
|
|
156
|
-
| `apps/<app>/.env.local` | Local overrides (gitignored) | Vite (overrides .env) |
|
|
157
|
-
| `apps/<app>/.env.production` | Production overrides | Vite (at build --mode production) |
|
|
158
|
-
| `apps/<app>/.env.staging` | Staging config | Vite (via `dndev staging`) |
|
|
159
|
-
| `functions/.env` | Server secrets: STRIPE_SECRET_KEY, OAuth secrets | Cloud Functions runtime |
|
|
160
|
-
| Root `.env` | **Not read by Vite.** Reference only. | Nothing |
|
|
161
|
-
|
|
162
|
-
**`dndev setup` writes Firebase vars to the app's `.env` automatically.**
|
|
163
|
-
|
|
164
|
-
**Custom domains:** Framework uses `APP_URL` hostname as `authDomain` in production (not Firebase's `projectId.firebaseapp.com`). Set your `FIREBASE_AUTH_DOMAIN` env var (with the appropriate `VITE_` or `NEXT_PUBLIC_` prefix) in `.env.local` and `.env.production` — framework handles the rest.
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Staging Environment (Optional)
|
|
169
|
-
|
|
170
|
-
1. Create a second Firebase project (e.g., `my-app-staging`)
|
|
171
|
-
2. Run `dndev setup firebase` to configure the staging project
|
|
172
|
-
3. The wizard updates `.firebaserc` — add a `"staging"` alias manually if the wizard only sets `"default"`:
|
|
173
|
-
```json
|
|
174
|
-
{ "projects": { "default": "my-app-prod", "staging": "my-app-staging" } }
|
|
175
|
-
```
|
|
176
|
-
4. Create `service-account-key.staging.json` (same steps as production)
|
|
177
|
-
5. Deploy: `dndev staging`
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Secrets (Stripe, OAuth, etc.)
|
|
182
|
-
|
|
183
|
-
Server-side secrets go in `functions/.env`, not the app `.env`.
|
|
184
|
-
|
|
185
|
-
**We NEVER ask for secret keys.** You place them yourself:
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
# functions/.env
|
|
189
|
-
STRIPE_SECRET_KEY=sk_live_...
|
|
190
|
-
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
191
|
-
GITHUB_CLIENT_SECRET=...
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Then sync to your runtime and CI/CD:
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
dndev sync-secrets # Firebase Secret Manager
|
|
198
|
-
dndev sync-secrets --target github # GitHub Secrets (for CI/CD workflows)
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Secrets are auto-loaded by Cloud Functions at runtime. Never put server secrets in `VITE_*` variables — those are exposed to the browser.
|
|
202
|
-
|
|
203
|
-
See [ENV_SETUP.md → Secrets Philosophy](./ENV_SETUP.md#secrets-philosophy) for the full policy.
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
## Troubleshooting
|
|
208
|
-
|
|
209
|
-
**"Service account key not found"**
|
|
210
|
-
→ Download from Firebase Console → Service Accounts → Generate new private key
|
|
211
|
-
→ Save as `service-account-key.json` in your app root
|
|
212
|
-
|
|
213
|
-
**"Permission denied" / 401 on deploy**
|
|
214
|
-
→ Check service account key is valid JSON with `project_id`, `private_key`, `client_email`
|
|
215
|
-
→ Re-download if corrupted
|
|
216
|
-
|
|
217
|
-
**"CORS error" on function calls**
|
|
218
|
-
→ Use `dndev deploy` instead of `firebase deploy` (handles IAM automatically)
|
|
219
|
-
→ Or run: `gcloud run services update <function-name> --region=<region> --no-invoker-iam-check --project=<project-id>`
|
|
220
|
-
|
|
221
|
-
**".env values not loading"**
|
|
222
|
-
→ Check the `.env` file is in your **app directory** (`apps/<app>/.env`), not the repo root
|
|
223
|
-
→ All Vite vars must start with `VITE_`
|
|
224
|
-
|
|
225
|
-
**"License key not working"**
|
|
226
|
-
→ Must be in `apps/<app>/.env` as `VITE_DONOTDEV_LICENSE_KEY=dndev_...`
|
|
227
|
-
→ Must start with `dndev_` and be at least 20 characters
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
**`dndev coach` → fill .env → `dndev setup` → download service account key → enable Auth + Firestore → `dndev emu start` → `dndev deploy`. That's it.**
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Setup: Functions
|
|
2
|
-
|
|
3
|
-
**This guide has been merged into provider-specific guides.**
|
|
4
|
-
|
|
5
|
-
- **Firebase Cloud Functions** → See [SETUP_FIREBASE.md § Cloud Functions](./SETUP_FIREBASE.md#cloud-functions)
|
|
6
|
-
- **Supabase Edge Functions** → See [SETUP_SUPABASE.md § Edge Functions](./SETUP_SUPABASE.md#edge-functions)
|
|
7
|
-
- **Vercel Functions** → See [SETUP_VERCEL.md § Vercel Functions](./SETUP_VERCEL.md#vercel-functions-optional)
|
|
8
|
-
|
|
9
|
-
Each provider guide covers function setup, CRUD registration, custom functions, import rules, and deployment for that stack.
|