@donotdev/cli 0.1.1 → 0.1.44
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 +93 -40
- package/dist/bin/commands/agent-setup.js +695 -420
- package/dist/bin/commands/build.js +1181 -832
- package/dist/bin/commands/bump.js +1065 -771
- package/dist/bin/commands/cacheout.js +253 -355
- package/dist/bin/commands/coach.js +275 -375
- package/dist/bin/commands/create-app.js +1085 -790
- package/dist/bin/commands/create-project.js +1117 -819
- package/dist/bin/commands/db.js +17045 -16542
- package/dist/bin/commands/deploy.js +1999 -1367
- package/dist/bin/commands/dev.js +879 -627
- package/dist/bin/commands/doctor.js +696 -425
- package/dist/bin/commands/emu.js +1001 -712
- package/dist/bin/commands/format.js +253 -355
- package/dist/bin/commands/get-demo.js +979 -706
- package/dist/bin/commands/make-admin.js +6279 -5746
- package/dist/bin/commands/preview.js +883 -628
- package/dist/bin/commands/seed.js +17058 -16555
- package/dist/bin/commands/setup-cicd.js +1024 -749
- package/dist/bin/commands/setup.js +1162 -844
- package/dist/bin/commands/staging.js +2000 -1368
- package/dist/bin/commands/sync-secrets.js +1181 -667
- package/dist/bin/commands/type-check.js +735 -461
- package/dist/bin/commands/wai.js +258 -360
- package/dist/bin/dndev.js +31 -16
- package/dist/bin/donotdev.js +31 -16
- package/dist/index.js +2200 -1513
- package/guidelines/DEPENDENCIES.md +155 -0
- package/guidelines/VERSION_CONTROL.md +0 -0
- package/package.json +1 -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 +6 -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 -0
- 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 +1 -1
- 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 +5 -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/not-found.tsx.example +14 -1
- package/templates/app-next/src/config/app.ts.example +1 -1
- 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 +7 -1
- package/templates/app-vite/.env.example +0 -33
- package/templates/app-vite/csp.example.json +0 -0
- package/templates/app-vite/index.html.example +0 -0
- 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 +1 -1
- 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 +5 -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 +0 -0
- package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +0 -0
- package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +0 -0
- package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +0 -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 +0 -0
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +2 -35
- package/templates/root-consumer/.claude/hooks/session-start.sh.example +1 -1
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +0 -0
- package/templates/root-consumer/.claude/rules/consumer-ux.md.example +1 -1
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +0 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +0 -0
- package/templates/root-consumer/.claude/rules/git.md.example +0 -0
- package/templates/root-consumer/.claude/rules/security.md.example +0 -0
- package/templates/root-consumer/.claude/settings.json.example +1 -27
- package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +0 -0
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +23 -106
- 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 +0 -0
- package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +0 -0
- 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 -33
- 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/root-consumer/.claude/hooks/framework-compliance.sh.example +0 -56
- package/templates/root-consumer/.claude/hooks/guard-files.sh.example +0 -46
- package/templates/root-consumer/.claude/hooks/guard-mcp.sh.example +0 -91
- package/templates/root-consumer/.claude/hooks/guard-secrets.sh.example +0 -67
- package/templates/root-consumer/.claude/hooks/track-mcp-lookup.sh.example +0 -20
- 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/INDEX.md.example +0 -56
- package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +0 -134
- package/templates/root-consumer/guides/dndev/SETUP_BILLING.md.example +0 -114
- package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +0 -231
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +0 -59
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +0 -60
- 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 -262
- 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/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 -148
- 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,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.**
|
|
@@ -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,59 +0,0 @@
|
|
|
1
|
-
# Setup: OAuth (Third-Party Connections)
|
|
2
|
-
|
|
3
|
-
**Most is pre-configured.** Connect to Spotify, LinkedIn, GitHub, etc. for API access. Add env vars. Framework handles OAuth flows, token exchange, refresh.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Standard Use
|
|
8
|
-
|
|
9
|
-
**Environment:**
|
|
10
|
-
```bash
|
|
11
|
-
# .env (client-side, exposed to browser)
|
|
12
|
-
VITE_OAUTH_PARTNERS=github,google,spotify,discord
|
|
13
|
-
VITE_GITHUB_CLIENT_ID=your_github_client_id
|
|
14
|
-
VITE_GOOGLE_CLIENT_ID=your_google_client_id
|
|
15
|
-
|
|
16
|
-
# Server-side secrets (edge functions / cloud functions)
|
|
17
|
-
# Convention: {PROVIDER}_CLIENT_ID, {PROVIDER}_CLIENT_SECRET
|
|
18
|
-
GITHUB_CLIENT_ID=your_github_client_id
|
|
19
|
-
GITHUB_CLIENT_SECRET=your_github_client_secret
|
|
20
|
-
GOOGLE_CLIENT_ID=your_google_client_id
|
|
21
|
-
GOOGLE_CLIENT_SECRET=your_google_client_secret
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Available:** `github`, `google`, `spotify`, `discord`, `twitch`, `reddit`, `linkedin`, `slack`, `notion`, `medium`, `twitter`, `mastodon`, `youtube`
|
|
25
|
-
|
|
26
|
-
**OAuth Provider Dashboard:** Create OAuth apps, copy Client IDs, configure redirect URIs.
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Advanced: Components & Hooks
|
|
31
|
-
|
|
32
|
-
```tsx
|
|
33
|
-
import { useOAuth } from '@donotdev/oauth';
|
|
34
|
-
import { MultipleOAuthProviders, OAuthPartnerButton } from '@donotdev/oauth';
|
|
35
|
-
import { OAuthConnectionModal } from '@donotdev/oauth';
|
|
36
|
-
|
|
37
|
-
// Hook
|
|
38
|
-
const connect = useOAuth('connect');
|
|
39
|
-
const disconnect = useOAuth('disconnect');
|
|
40
|
-
const isConnected = useOAuth('isConnected');
|
|
41
|
-
const loading = useOAuth('loading');
|
|
42
|
-
const error = useOAuth('error');
|
|
43
|
-
|
|
44
|
-
await connect('github', { purpose: 'api-access' }); // Purpose: 'authentication' | 'api-access'
|
|
45
|
-
await connect('github', { purpose: 'api-access', scopes: ['repo', 'user:email'] }); // Custom scopes
|
|
46
|
-
await disconnect('github');
|
|
47
|
-
const connected = isConnected('github');
|
|
48
|
-
|
|
49
|
-
// Components
|
|
50
|
-
<MultipleOAuthProviders purpose="api-access" layout="vertical" />
|
|
51
|
-
<OAuthPartnerButton partnerId="github" purpose="api-access" />
|
|
52
|
-
<OAuthConnectionModal />
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**Pre-configured:** Auto-discovers enabled providers, handles PKCE flow, token refresh, callbacks.
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
**Add env vars, get OAuth. Framework handles the rest.**
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# OAuth Provider Setup Guide
|
|
2
|
-
|
|
3
|
-
Each OAuth provider requires manual registration in their developer console.
|
|
4
|
-
`dndev coach` shows the correct redirect URI and setup steps for each provider.
|
|
5
|
-
|
|
6
|
-
## Redirect URIs
|
|
7
|
-
|
|
8
|
-
### Firebase
|
|
9
|
-
```
|
|
10
|
-
https://{{PROJECT_ID}}.firebaseapp.com/__/auth/handler
|
|
11
|
-
```
|
|
12
|
-
> If you use a custom auth domain, replace `{{PROJECT_ID}}.firebaseapp.com` with your custom domain.
|
|
13
|
-
|
|
14
|
-
### Supabase
|
|
15
|
-
```
|
|
16
|
-
https://{{PROJECT_ID}}.supabase.co/auth/v1/callback
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Google OAuth
|
|
22
|
-
|
|
23
|
-
1. Go to https://console.cloud.google.com/apis/credentials
|
|
24
|
-
2. Create **OAuth 2.0 Client ID** (type: Web application)
|
|
25
|
-
3. Add **Authorized redirect URI** (see above)
|
|
26
|
-
4. Copy **Client ID** and **Client Secret**
|
|
27
|
-
5. Enable in your backend:
|
|
28
|
-
- Firebase: Console > Authentication > Sign-in method > Google
|
|
29
|
-
- Supabase: Dashboard > Authentication > Providers > Google
|
|
30
|
-
|
|
31
|
-
## GitHub OAuth
|
|
32
|
-
|
|
33
|
-
1. Go to https://github.com/settings/developers
|
|
34
|
-
2. Click **New OAuth App**
|
|
35
|
-
3. Set **Authorization callback URL** (see redirect URI above)
|
|
36
|
-
4. Copy **Client ID** and **Client Secret**
|
|
37
|
-
5. Enable in your backend:
|
|
38
|
-
- Firebase: Console > Authentication > Sign-in method > GitHub
|
|
39
|
-
- Supabase: Dashboard > Authentication > Providers > GitHub
|
|
40
|
-
|
|
41
|
-
## Apple Sign In
|
|
42
|
-
|
|
43
|
-
1. Go to https://developer.apple.com/account/resources/identifiers/list/serviceId
|
|
44
|
-
2. Create a **Services ID**
|
|
45
|
-
3. Enable **Sign In with Apple**
|
|
46
|
-
4. Add **Redirect URL** (see above)
|
|
47
|
-
5. Create a **Key** for Sign In with Apple
|
|
48
|
-
6. Enable in your backend:
|
|
49
|
-
- Firebase: Console > Authentication > Sign-in method > Apple
|
|
50
|
-
- Supabase: Dashboard > Authentication > Providers > Apple
|
|
51
|
-
|
|
52
|
-
> **Note:** Apple requires an Apple Developer Program membership ($99/year).
|
|
53
|
-
|
|
54
|
-
## Verify
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
dndev doctor
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Check that auth providers are detected and backend configuration is referenced.
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
# Setup: SOC2 Readiness
|
|
2
|
-
|
|
3
|
-
**DoNotDev auto-enforces SOC2 baseline controls.** Zero config needed for the MVP. This guide covers advanced controls and audit verification.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Zero-Config Baseline (Always On)
|
|
8
|
-
|
|
9
|
-
When you wire `DndevSecurity` into your app, these controls activate automatically:
|
|
10
|
-
|
|
11
|
-
| Control | Default | SOC2 Criteria |
|
|
12
|
-
|---------|---------|---------------|
|
|
13
|
-
| Structured audit logging (all CRUD + auth) | ✅ Automatic | CC7.1 |
|
|
14
|
-
| Rate limiting (100 writes/min, 500 reads/min) | ✅ Automatic | CC6.6 |
|
|
15
|
-
| Brute-force lockout (5 attempts → 15 min) | ✅ Automatic | CC6.1 |
|
|
16
|
-
| Session timeout (8h idle) | ✅ Automatic | CC6.1 |
|
|
17
|
-
| Field-level RBAC + visibility | ✅ Always on (entity config) | CC6.3 |
|
|
18
|
-
| Supabase RLS / Firestore default-deny | ✅ By convention | CC6.3 |
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 1. Wire `DndevSecurity` (Required Once)
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
// src/security.ts
|
|
26
|
-
import { DndevSecurity } from '@donotdev/security/server';
|
|
27
|
-
|
|
28
|
-
export const security = new DndevSecurity({
|
|
29
|
-
// Optional: override defaults
|
|
30
|
-
// rateLimit: { writesPerMin: 50, readsPerMin: 200 },
|
|
31
|
-
// lockout: { maxAttempts: 3, lockoutMs: 30 * 60 * 1000 },
|
|
32
|
-
// sessionTimeoutMs: 4 * 60 * 60 * 1000,
|
|
33
|
-
|
|
34
|
-
// Required for PII encryption (see § PII Encryption below)
|
|
35
|
-
// piiSecret: process.env.PII_SECRET,
|
|
36
|
-
|
|
37
|
-
// Optional: send anomaly alerts to your SIEM/Slack
|
|
38
|
-
// anomalyHandler: async (alert) => { await fetch(process.env.SIEM_WEBHOOK!, { method: 'POST', body: JSON.stringify(alert) }); },
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
// src/main.ts (or app entry point)
|
|
44
|
-
import { security } from './security';
|
|
45
|
-
import { crudService } from './crud'; // your CrudService instance
|
|
46
|
-
import { auth } from './auth'; // your SupabaseAuth or FirebaseSDK instance
|
|
47
|
-
|
|
48
|
-
crudService.setSecurity(security);
|
|
49
|
-
auth.setSecurity(security);
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## 2. PII Encryption (Opt-In — C1 Confidentiality)
|
|
55
|
-
|
|
56
|
-
Required only for entities storing personal data (email, phone, SSN, health data, etc.).
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
// entities/user.ts
|
|
60
|
-
export const userEntity = defineEntity({
|
|
61
|
-
name: 'User',
|
|
62
|
-
collection: 'users',
|
|
63
|
-
security: {
|
|
64
|
-
piiFields: ['email', 'phone', 'dateOfBirth'], // Encrypted at rest with AES-256-GCM
|
|
65
|
-
},
|
|
66
|
-
fields: { /* ... */ },
|
|
67
|
-
});
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# Add to .env (min 32 chars, generate with: openssl rand -hex 32)
|
|
72
|
-
PII_SECRET=your-secret-key-min-32-chars-here
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Pass to security:
|
|
76
|
-
```typescript
|
|
77
|
-
export const security = new DndevSecurity({
|
|
78
|
-
piiSecret: process.env.PII_SECRET,
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## 3. MFA Enforcement (Opt-In — CC6.1)
|
|
85
|
-
|
|
86
|
-
Enforce MFA for specific roles on sensitive entities:
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
export const paymentEntity = defineEntity({
|
|
90
|
-
name: 'Payment',
|
|
91
|
-
collection: 'payments',
|
|
92
|
-
security: {
|
|
93
|
-
requireMfa: 'admin', // 'admin' | 'manager' | 'user'
|
|
94
|
-
},
|
|
95
|
-
fields: { /* ... */ },
|
|
96
|
-
});
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Enable MFA in your provider:
|
|
100
|
-
- **Supabase:** Dashboard → Auth → Multi Factor Authentication → Enable TOTP
|
|
101
|
-
- **Firebase:** Firebase Console → Authentication → Multi-factor Auth → Enable
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
## 4. Data Retention (Opt-In — P6 Privacy)
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
export const auditLogEntity = defineEntity({
|
|
109
|
-
name: 'AuditLog',
|
|
110
|
-
collection: 'audit_logs',
|
|
111
|
-
security: {
|
|
112
|
-
retention: { days: 365 }, // Auto-flag records for purge after 1 year
|
|
113
|
-
},
|
|
114
|
-
fields: { /* ... */ },
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Run retention purge (e.g., in a scheduled Cloud Function):
|
|
119
|
-
```typescript
|
|
120
|
-
import { privacyManager } from '@donotdev/security/server';
|
|
121
|
-
// privacyManager.shouldPurge(record.createdAt, retentionDays) → boolean
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## 5. Right to Erasure (GDPR Art. 17 / P8)
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
import { DndevSecurity } from '@donotdev/security/server';
|
|
130
|
-
|
|
131
|
-
// In your account deletion handler:
|
|
132
|
-
await security.privacyManager.eraseUser(userId, async (uid) => {
|
|
133
|
-
// Your custom erasure logic per collection
|
|
134
|
-
await db.from('orders').update({ userId: null }).eq('userId', uid);
|
|
135
|
-
await db.from('profiles').delete().eq('id', uid);
|
|
136
|
-
});
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## 6. Health Monitoring (Opt-In — A1 Availability)
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
// src/client/health.ts
|
|
145
|
-
import { HealthMonitor } from '@donotdev/security';
|
|
146
|
-
|
|
147
|
-
const dbMonitor = new HealthMonitor({ failureThreshold: 3, successThreshold: 2, timeoutMs: 5000 });
|
|
148
|
-
|
|
149
|
-
// Wrap all downstream DB calls through the circuit breaker
|
|
150
|
-
export const safeQuery = (fn: () => Promise<unknown>) => dbMonitor.protect(fn);
|
|
151
|
-
|
|
152
|
-
// Expose a health endpoint (Next.js example)
|
|
153
|
-
// app/api/health/route.ts
|
|
154
|
-
export async function GET() {
|
|
155
|
-
return Response.json({ status: dbMonitor.checkLiveness() });
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## 7. Anomaly Detection (Opt-In — CC7.2)
|
|
162
|
-
|
|
163
|
-
Triggered automatically when brute-force or bulk-delete thresholds are exceeded. Wire a handler to send alerts:
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
export const security = new DndevSecurity({
|
|
167
|
-
anomalyHandler: async (alert) => {
|
|
168
|
-
// Send to Slack, PagerDuty, Datadog, etc.
|
|
169
|
-
await fetch(process.env.SLACK_WEBHOOK!, {
|
|
170
|
-
method: 'POST',
|
|
171
|
-
body: JSON.stringify({ text: `🚨 SOC2 Anomaly: ${alert.type} — ${alert.details}` }),
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## 8. Audit Log Output
|
|
180
|
-
|
|
181
|
-
Audit events write to `process.stdout` as NDJSON — pipe to your SIEM:
|
|
182
|
-
|
|
183
|
-
```json
|
|
184
|
-
{"timestamp":"2025-01-15T10:23:00.000Z","type":"crud.create","userId":"u_123","resource":"products","resourceId":"p_456","ip":"192.168.1.1"}
|
|
185
|
-
{"timestamp":"2025-01-15T10:23:01.000Z","type":"auth.login.failure","userId":"unknown","resource":"auth","ip":"10.0.0.5","details":"brute_force_lockout"}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**Cloud Logging (Firebase / GCP):** Stdout is captured automatically.
|
|
189
|
-
**Datadog:** Set `DD_LOGS_INJECTION=true` and pipe stdout to the Datadog agent.
|
|
190
|
-
**Supabase:** Export `process.stderr` anomaly alerts to Logflare.
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## SOC2 Readiness Check
|
|
195
|
-
|
|
196
|
-
Run before any audit:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
dn soc2 # Scan current app
|
|
200
|
-
dn soc2 --app my-app # Scan specific app
|
|
201
|
-
dn soc2 --json # Machine-readable JSON output (CI/CD)
|
|
202
|
-
dn soc2 --verbose # Show details for passing checks too
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**Exit codes:** `0` = all checks pass, `1` = one or more checks failed (CI-friendly).
|
|
206
|
-
|
|
207
|
-
**Checks run:**
|
|
208
|
-
|
|
209
|
-
| Check | Criteria | What It Looks For |
|
|
210
|
-
|-------|----------|--------------------|
|
|
211
|
-
| SecurityContext wired | CC6.1 | `DndevSecurity` in source |
|
|
212
|
-
| PII encryption secret | C1 | `PII_SECRET` in env when `piiFields` defined |
|
|
213
|
-
| Firestore default-deny | CC6.3 | `allow read, write: if false` in `firestore.rules` |
|
|
214
|
-
| Supabase RLS | CC6.3 | `ENABLE ROW LEVEL SECURITY` in SQL migrations |
|
|
215
|
-
| Audit logging | CC7.1 | `.audit()` / `AuditLogger` usage |
|
|
216
|
-
| Rate limiting | CC6.6 | `rateLimit` / `DndevRateLimiter` usage |
|
|
217
|
-
| Retention policies | P6 | `retention.days` in entity config |
|
|
218
|
-
| Health monitoring | A1 | `HealthMonitor` or `/api/health` endpoint |
|
|
219
|
-
| MFA enforcement | CC6.1 | `requireMfa` in sensitive entities |
|
|
220
|
-
|
|
221
|
-
---
|
|
222
|
-
|
|
223
|
-
## Coverage After Full Setup
|
|
224
|
-
|
|
225
|
-
| SOC2 Criteria | Control | Status |
|
|
226
|
-
|---------------|---------|--------|
|
|
227
|
-
| CC6.1 Auth hardening | Lockout + session timeout + MFA | Framework-enforced |
|
|
228
|
-
| CC6.3 Authorization | RBAC + field visibility + RLS/Firestore rules | Framework-enforced |
|
|
229
|
-
| CC6.6 Rate limiting | Per-user sliding window | Framework-enforced |
|
|
230
|
-
| CC7.1 Audit logging | All CRUD + auth events as NDJSON | Framework-enforced |
|
|
231
|
-
| CC7.2 Anomaly detection | Auth failures + bulk ops threshold alerts | Opt-in handler |
|
|
232
|
-
| A1 Availability | Circuit breaker + liveness probes | Opt-in `HealthMonitor` |
|
|
233
|
-
| C1 Confidentiality | AES-256-GCM field encryption | Opt-in `piiFields` |
|
|
234
|
-
| P1–P8 Privacy | Retention policies + right-to-erasure | Opt-in `retention` |
|