@digilogiclabs/create-saas-app 1.0.1
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/CHANGELOG.md +42 -0
- package/README.md +891 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/cli/commands/add.d.ts +6 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +39 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/create.d.ts +35 -0
- package/dist/cli/commands/create.d.ts.map +1 -0
- package/dist/cli/commands/create.js +165 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/index.d.ts +4 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +20 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/update.d.ts +6 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +68 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +61 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/prompts/index.d.ts +2 -0
- package/dist/cli/prompts/index.d.ts.map +1 -0
- package/dist/cli/prompts/index.js +18 -0
- package/dist/cli/prompts/index.js.map +1 -0
- package/dist/cli/prompts/project-setup.d.ts +5 -0
- package/dist/cli/prompts/project-setup.d.ts.map +1 -0
- package/dist/cli/prompts/project-setup.js +288 -0
- package/dist/cli/prompts/project-setup.js.map +1 -0
- package/dist/cli/utils/git.d.ts +9 -0
- package/dist/cli/utils/git.d.ts.map +1 -0
- package/dist/cli/utils/git.js +77 -0
- package/dist/cli/utils/git.js.map +1 -0
- package/dist/cli/utils/index.d.ts +5 -0
- package/dist/cli/utils/index.d.ts.map +1 -0
- package/dist/cli/utils/index.js +21 -0
- package/dist/cli/utils/index.js.map +1 -0
- package/dist/cli/utils/logger.d.ts +16 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +55 -0
- package/dist/cli/utils/logger.js.map +1 -0
- package/dist/cli/utils/package-manager.d.ts +8 -0
- package/dist/cli/utils/package-manager.d.ts.map +1 -0
- package/dist/cli/utils/package-manager.js +92 -0
- package/dist/cli/utils/package-manager.js.map +1 -0
- package/dist/cli/utils/spinner.d.ts +7 -0
- package/dist/cli/utils/spinner.d.ts.map +1 -0
- package/dist/cli/utils/spinner.js +48 -0
- package/dist/cli/utils/spinner.js.map +1 -0
- package/dist/cli/validators/dependencies.d.ts +15 -0
- package/dist/cli/validators/dependencies.d.ts.map +1 -0
- package/dist/cli/validators/dependencies.js +108 -0
- package/dist/cli/validators/dependencies.js.map +1 -0
- package/dist/cli/validators/index.d.ts +3 -0
- package/dist/cli/validators/index.d.ts.map +1 -0
- package/dist/cli/validators/index.js +19 -0
- package/dist/cli/validators/index.js.map +1 -0
- package/dist/cli/validators/project-name.d.ts +5 -0
- package/dist/cli/validators/project-name.d.ts.map +1 -0
- package/dist/cli/validators/project-name.js +151 -0
- package/dist/cli/validators/project-name.js.map +1 -0
- package/dist/generators/file-processor.d.ts +28 -0
- package/dist/generators/file-processor.d.ts.map +1 -0
- package/dist/generators/file-processor.js +224 -0
- package/dist/generators/file-processor.js.map +1 -0
- package/dist/generators/index.d.ts +4 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +20 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/package-installer.d.ts +29 -0
- package/dist/generators/package-installer.d.ts.map +1 -0
- package/dist/generators/package-installer.js +177 -0
- package/dist/generators/package-installer.js.map +1 -0
- package/dist/generators/template-generator.d.ts +61 -0
- package/dist/generators/template-generator.d.ts.map +1 -0
- package/dist/generators/template-generator.js +457 -0
- package/dist/generators/template-generator.js.map +1 -0
- package/dist/templates/mobile/base/template/.env.example +15 -0
- package/dist/templates/mobile/base/template/App.tsx +186 -0
- package/dist/templates/mobile/base/template/app/(auth)/login.tsx +44 -0
- package/dist/templates/mobile/base/template/app/(auth)/signup.tsx +43 -0
- package/dist/templates/mobile/base/template/app/checkout.tsx +20 -0
- package/dist/templates/mobile/base/template/app.json +44 -0
- package/dist/templates/mobile/base/template/babel.config.js +6 -0
- package/dist/templates/mobile/base/template/eas.json +19 -0
- package/dist/templates/mobile/base/template/package.json +54 -0
- package/dist/templates/mobile/ui-auth-payments/template/.env.example +20 -0
- package/dist/templates/mobile/ui-auth-payments/template/README.md +218 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +153 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/analytics.tsx +668 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +743 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +757 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/orders.tsx +402 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +580 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/_layout.tsx +134 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +246 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +362 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/onboarding/index.tsx +193 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/tour/index.tsx +272 -0
- package/dist/templates/mobile/ui-auth-payments/template/app.json +94 -0
- package/dist/templates/mobile/ui-auth-payments/template/babel.config.js +23 -0
- package/dist/templates/mobile/ui-auth-payments/template/eas.json +45 -0
- package/dist/templates/mobile/ui-auth-payments/template/expo-env.d.ts +3 -0
- package/dist/templates/mobile/ui-auth-payments/template/jest-setup.ts +74 -0
- package/dist/templates/mobile/ui-auth-payments/template/metro.config.js +11 -0
- package/dist/templates/mobile/ui-auth-payments/template/package.json +117 -0
- package/dist/templates/mobile/ui-auth-payments/template/tsconfig.json +31 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/.env.example +23 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/README.md +254 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +169 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/ai.tsx +522 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/analytics.tsx +668 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +743 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +676 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/orders.tsx +402 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +580 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +134 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +246 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +362 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/onboarding/index.tsx +193 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/tour/index.tsx +272 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app.json +94 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/babel.config.js +23 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/eas.json +45 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/expo-env.d.ts +3 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/jest-setup.ts +74 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/metro.config.js +11 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/package.json +119 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/tsconfig.json +31 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/README.md +655 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +683 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/_layout.tsx +134 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app.json +74 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/babel.config.js +25 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +787 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/eas.json +25 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/expo-env.d.ts +3 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +346 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/jest-setup.ts +37 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +180 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/metro.config.js +11 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/package.json +124 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +599 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/tsconfig.json +32 -0
- package/dist/templates/shared/auth/firebase/web/config.ts +23 -0
- package/dist/templates/shared/auth/supabase/web/config.ts +8 -0
- package/dist/templates/web/base/template/.env.example +15 -0
- package/dist/templates/web/base/template/.eslintrc.js +8 -0
- package/dist/templates/web/base/template/README.md +68 -0
- package/dist/templates/web/base/template/next.config.js +15 -0
- package/dist/templates/web/base/template/package.json +59 -0
- package/dist/templates/web/base/template/postcss.config.js +7 -0
- package/dist/templates/web/base/template/src/app/auth/callback/route.ts +18 -0
- package/dist/templates/web/base/template/src/app/checkout/page.tsx +119 -0
- package/dist/templates/web/base/template/src/app/dashboard/page.tsx +366 -0
- package/dist/templates/web/base/template/src/app/error.tsx +97 -0
- package/dist/templates/web/base/template/src/app/globals.css +157 -0
- package/dist/templates/web/base/template/src/app/layout.tsx +35 -0
- package/dist/templates/web/base/template/src/app/loading.tsx +52 -0
- package/dist/templates/web/base/template/src/app/login/page.tsx +67 -0
- package/dist/templates/web/base/template/src/app/page.tsx +193 -0
- package/dist/templates/web/base/template/src/app/signup/page.tsx +67 -0
- package/dist/templates/web/base/template/src/components/__tests__/example.test.tsx +49 -0
- package/dist/templates/web/base/template/src/components/providers/app-providers.tsx +35 -0
- package/dist/templates/web/base/template/src/components/providers/theme-provider.tsx +94 -0
- package/dist/templates/web/base/template/src/components/shared/footer.tsx +36 -0
- package/dist/templates/web/base/template/src/components/shared/header.tsx +63 -0
- package/dist/templates/web/base/template/src/components/ui/badge.tsx +36 -0
- package/dist/templates/web/base/template/src/components/ui/button.tsx +56 -0
- package/dist/templates/web/base/template/src/components/ui/card.tsx +71 -0
- package/dist/templates/web/base/template/src/components/ui/theme-toggle.tsx +34 -0
- package/dist/templates/web/base/template/src/lib/auth-server.ts +177 -0
- package/dist/templates/web/base/template/src/lib/env.ts +46 -0
- package/dist/templates/web/base/template/src/lib/platform.ts +146 -0
- package/dist/templates/web/base/template/src/lib/utils.ts +140 -0
- package/dist/templates/web/base/template/src/test/setup.ts +79 -0
- package/dist/templates/web/base/template/tailwind.config.js +77 -0
- package/dist/templates/web/base/template/tsconfig.json +33 -0
- package/dist/templates/web/base/template/vitest.config.ts +17 -0
- package/dist/templates/web/base/template.backup/.env.example +15 -0
- package/dist/templates/web/base/template.backup.20250817/.env.example +15 -0
- package/dist/templates/web/ui-auth/template/.claude +21 -0
- package/dist/templates/web/ui-auth/template/.env.example +15 -0
- package/dist/templates/web/ui-auth/template/.eslintrc.js +8 -0
- package/dist/templates/web/ui-auth/template/README.md +68 -0
- package/dist/templates/web/ui-auth/template/context.md +105 -0
- package/dist/templates/web/ui-auth/template/next.config.js +12 -0
- package/dist/templates/web/ui-auth/template/package.json +51 -0
- package/dist/templates/web/ui-auth/template/postcss.config.js +7 -0
- package/dist/templates/web/ui-auth/template/src/app/auth/callback/route.ts +12 -0
- package/dist/templates/web/ui-auth/template/src/app/checkout/page.tsx +25 -0
- package/dist/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +801 -0
- package/dist/templates/web/ui-auth/template/src/app/error.tsx +67 -0
- package/dist/templates/web/ui-auth/template/src/app/globals.css +95 -0
- package/dist/templates/web/ui-auth/template/src/app/layout.tsx +33 -0
- package/dist/templates/web/ui-auth/template/src/app/loading.tsx +38 -0
- package/dist/templates/web/ui-auth/template/src/app/login/page.tsx +109 -0
- package/dist/templates/web/ui-auth/template/src/app/page.tsx +305 -0
- package/dist/templates/web/ui-auth/template/src/app/setup/page.tsx +403 -0
- package/dist/templates/web/ui-auth/template/src/app/signup/page.tsx +128 -0
- package/dist/templates/web/ui-auth/template/src/components/__tests__/example.test.tsx +49 -0
- package/dist/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +31 -0
- package/dist/templates/web/ui-auth/template/src/components/providers/theme-provider.tsx +94 -0
- package/dist/templates/web/ui-auth/template/src/components/shared/footer.tsx +36 -0
- package/dist/templates/web/ui-auth/template/src/components/shared/header.tsx +94 -0
- package/dist/templates/web/ui-auth/template/src/components/ui/badge.tsx +36 -0
- package/dist/templates/web/ui-auth/template/src/components/ui/theme-toggle.tsx +34 -0
- package/dist/templates/web/ui-auth/template/src/lib/env.ts +49 -0
- package/dist/templates/web/ui-auth/template/src/lib/platform.ts +137 -0
- package/dist/templates/web/ui-auth/template/src/lib/utils.ts +140 -0
- package/dist/templates/web/ui-auth/template/src/test/setup.ts +79 -0
- package/dist/templates/web/ui-auth/template/tailwind.config.js +77 -0
- package/dist/templates/web/ui-auth/template/tsconfig.json +33 -0
- package/dist/templates/web/ui-auth/template/vitest.config.ts +17 -0
- package/dist/templates/web/ui-auth/template.backup/.env.example +15 -0
- package/dist/templates/web/ui-auth/template.backup.20250817/.env.example +15 -0
- package/dist/templates/web/ui-auth-ai/template/.env.example +18 -0
- package/dist/templates/web/ui-auth-ai/template/README.md +170 -0
- package/dist/templates/web/ui-auth-ai/template/next.config.js +13 -0
- package/dist/templates/web/ui-auth-ai/template/package.json +39 -0
- package/dist/templates/web/ui-auth-ai/template/postcss.config.js +6 -0
- package/dist/templates/web/ui-auth-ai/template/src/app/globals.css +40 -0
- package/dist/templates/web/ui-auth-ai/template/src/app/layout.tsx +41 -0
- package/dist/templates/web/ui-auth-ai/template/src/app/page.tsx +193 -0
- package/dist/templates/web/ui-auth-ai/template/src/components/ai/audio-generator.tsx +141 -0
- package/dist/templates/web/ui-auth-ai/template/src/components/ai/video-generator.tsx +158 -0
- package/dist/templates/web/ui-auth-ai/template/src/components/auth/login-form.tsx +106 -0
- package/dist/templates/web/ui-auth-ai/template/src/components/ui/button.tsx +44 -0
- package/dist/templates/web/ui-auth-ai/template/src/components/ui/input.tsx +24 -0
- package/dist/templates/web/ui-auth-ai/template/src/components/ui/label.tsx +21 -0
- package/dist/templates/web/ui-auth-ai/template/src/components/ui/select.tsx +37 -0
- package/dist/templates/web/ui-auth-ai/template/src/components/ui/textarea.tsx +23 -0
- package/dist/templates/web/ui-auth-ai/template/src/hooks/useAuth.ts +1 -0
- package/dist/templates/web/ui-auth-ai/template/src/lib/supabase.ts +8 -0
- package/dist/templates/web/ui-auth-ai/template/src/lib/utils.ts +5 -0
- package/dist/templates/web/ui-auth-ai/template/src/providers/auth-provider.tsx +55 -0
- package/dist/templates/web/ui-auth-ai/template/tailwind.config.js +22 -0
- package/dist/templates/web/ui-auth-ai/template/tsconfig.json +28 -0
- package/dist/templates/web/ui-auth-payments/template/.env.example +51 -0
- package/dist/templates/web/ui-auth-payments/template/README.md +165 -0
- package/dist/templates/web/ui-auth-payments/template/middleware.ts +68 -0
- package/dist/templates/web/ui-auth-payments/template/next.config.js +12 -0
- package/dist/templates/web/ui-auth-payments/template/package-lock.json +12240 -0
- package/dist/templates/web/ui-auth-payments/template/package.json +55 -0
- package/dist/templates/web/ui-auth-payments/template/postcss.config.js +7 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/auth/callback/route.ts +12 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +211 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +318 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/layout.tsx +22 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +235 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +801 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/error.tsx +67 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/globals.css +211 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/layout.tsx +33 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/loading.tsx +20 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/login/loading.tsx +38 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/login/page.tsx +109 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/page.tsx +350 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +507 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/signup/loading.tsx +50 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +128 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/__tests__/example.test.tsx +49 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +52 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +144 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/client/newsletter-signup.tsx +68 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +185 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +34 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/providers/theme-provider.tsx +94 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/shared/footer.tsx +36 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +230 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/ui/badge.tsx +36 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/ui/theme-toggle.tsx +34 -0
- package/dist/templates/web/ui-auth-payments/template/src/lib/actions/auth.ts +246 -0
- package/dist/templates/web/ui-auth-payments/template/src/lib/actions/index.ts +340 -0
- package/dist/templates/web/ui-auth-payments/template/src/lib/auth-server.ts +177 -0
- package/dist/templates/web/ui-auth-payments/template/src/lib/env.ts +49 -0
- package/dist/templates/web/ui-auth-payments/template/src/lib/platform.ts +146 -0
- package/dist/templates/web/ui-auth-payments/template/src/lib/utils.ts +140 -0
- package/dist/templates/web/ui-auth-payments/template/src/test/setup.ts +79 -0
- package/dist/templates/web/ui-auth-payments/template/tailwind.config.js +77 -0
- package/dist/templates/web/ui-auth-payments/template/tsconfig.json +33 -0
- package/dist/templates/web/ui-auth-payments/template/tsconfig.tsbuildinfo +1 -0
- package/dist/templates/web/ui-auth-payments/template/vitest.config.ts +17 -0
- package/dist/templates/web/ui-auth-payments-ai/template/.claude +21 -0
- package/dist/templates/web/ui-auth-payments-ai/template/.env.example +60 -0
- package/dist/templates/web/ui-auth-payments-ai/template/README.md +207 -0
- package/dist/templates/web/ui-auth-payments-ai/template/context.md +169 -0
- package/dist/templates/web/ui-auth-payments-ai/template/middleware.ts +68 -0
- package/dist/templates/web/ui-auth-payments-ai/template/next.config.js +12 -0
- package/dist/templates/web/ui-auth-payments-ai/template/package-lock.json +12241 -0
- package/dist/templates/web/ui-auth-payments-ai/template/package.json +58 -0
- package/dist/templates/web/ui-auth-payments-ai/template/postcss.config.js +7 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +310 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/api/ai/audio/route.ts +56 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/api/ai/chat/route.ts +49 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/api/ai/text/route.ts +64 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/api/ai/video/route.ts +73 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/auth/callback/route.ts +12 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +422 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +142 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/layout.tsx +22 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +236 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +801 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/error.tsx +67 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/globals.css +96 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/layout.tsx +35 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/loading.tsx +20 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/login/page.tsx +6 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +364 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +394 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.backup +391 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.bak +391 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +532 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +645 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/signup/page.tsx +6 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/__tests__/example.test.tsx +49 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +52 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +163 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +201 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +38 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/theme-provider.tsx +96 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/shared/footer.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +252 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/ui/badge.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/ui/theme-toggle.tsx +34 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/actions/auth.ts +246 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/actions/index.ts +14 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/auth-server.ts +177 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/env.ts +49 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/platform.ts +155 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/supabase/server.ts +72 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/utils.ts +140 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +79 -0
- package/dist/templates/web/ui-auth-payments-ai/template/tailwind.config.js +77 -0
- package/dist/templates/web/ui-auth-payments-ai/template/tsconfig.json +33 -0
- package/dist/templates/web/ui-auth-payments-ai/template/tsconfig.tsbuildinfo +1 -0
- package/dist/templates/web/ui-auth-payments-ai/template/vitest.config.ts +17 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/README.md +434 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +642 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +466 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +393 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +457 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +478 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +250 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/package.json +76 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +622 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +396 -0
- package/dist/templates/web/ui-auth-payments-audio/template/.env.example +15 -0
- package/dist/templates/web/ui-auth-payments-audio/template/README.md +207 -0
- package/dist/templates/web/ui-auth-payments-audio/template/middleware.ts +68 -0
- package/dist/templates/web/ui-auth-payments-audio/template/next.config.js +12 -0
- package/dist/templates/web/ui-auth-payments-audio/template/package-lock.json +12241 -0
- package/dist/templates/web/ui-auth-payments-audio/template/package.json +55 -0
- package/dist/templates/web/ui-auth-payments-audio/template/postcss.config.js +7 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/auth/callback/route.ts +12 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +211 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +142 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/layout.tsx +22 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +237 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/error.tsx +67 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/globals.css +96 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/layout.tsx +35 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/loading.tsx +20 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/login/page.tsx +6 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +403 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.backup +391 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.bak +391 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/setup/page.tsx +345 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/signup/page.tsx +6 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/__tests__/example.test.tsx +49 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +52 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +144 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +185 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +38 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/theme-provider.tsx +96 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/shared/footer.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +252 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/ui/badge.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/ui/theme-toggle.tsx +34 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/lib/actions/auth.ts +246 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/lib/actions/index.ts +14 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/lib/auth-server.ts +177 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/lib/env.ts +49 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/lib/utils.ts +140 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +79 -0
- package/dist/templates/web/ui-auth-payments-audio/template/tailwind.config.js +77 -0
- package/dist/templates/web/ui-auth-payments-audio/template/tsconfig.json +33 -0
- package/dist/templates/web/ui-auth-payments-audio/template/tsconfig.tsbuildinfo +1 -0
- package/dist/templates/web/ui-auth-payments-audio/template/vitest.config.ts +17 -0
- package/dist/templates/web/ui-auth-payments-video/template/.env.example +15 -0
- package/dist/templates/web/ui-auth-payments-video/template/README.md +190 -0
- package/dist/templates/web/ui-auth-payments-video/template/next.config.js +12 -0
- package/dist/templates/web/ui-auth-payments-video/template/package.json +55 -0
- package/dist/templates/web/ui-auth-payments-video/template/postcss.config.js +7 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/auth/callback/route.ts +12 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +211 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +142 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/error.tsx +67 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/globals.css +228 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/layout.tsx +33 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/loading.tsx +20 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +109 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/page.tsx +395 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/setup/page.tsx +351 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +128 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/components/__tests__/example.test.tsx +49 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +34 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/theme-provider.tsx +94 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/components/shared/footer.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +246 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/components/ui/badge.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/components/ui/theme-toggle.tsx +34 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/lib/env.ts +49 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/lib/utils.ts +140 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/test/setup.ts +79 -0
- package/dist/templates/web/ui-auth-payments-video/template/tailwind.config.js +77 -0
- package/dist/templates/web/ui-auth-payments-video/template/tsconfig.json +33 -0
- package/dist/templates/web/ui-auth-payments-video/template/vitest.config.ts +17 -0
- package/dist/templates/web/ui-only/template/.env.example +15 -0
- package/dist/templates/web/ui-only/template/.eslintrc.js +8 -0
- package/dist/templates/web/ui-only/template/README.md +68 -0
- package/dist/templates/web/ui-only/template/next.config.js +12 -0
- package/dist/templates/web/ui-only/template/package.json +49 -0
- package/dist/templates/web/ui-only/template/postcss.config.js +7 -0
- package/dist/templates/web/ui-only/template/src/app/auth/callback/route.ts +12 -0
- package/dist/templates/web/ui-only/template/src/app/checkout/page.tsx +25 -0
- package/dist/templates/web/ui-only/template/src/app/error.tsx +67 -0
- package/dist/templates/web/ui-only/template/src/app/globals.css +42 -0
- package/dist/templates/web/ui-only/template/src/app/layout.tsx +33 -0
- package/dist/templates/web/ui-only/template/src/app/loading.tsx +20 -0
- package/dist/templates/web/ui-only/template/src/app/login/page.tsx +63 -0
- package/dist/templates/web/ui-only/template/src/app/page.tsx +91 -0
- package/dist/templates/web/ui-only/template/src/app/signup/page.tsx +79 -0
- package/dist/templates/web/ui-only/template/src/components/__tests__/example.test.tsx +49 -0
- package/dist/templates/web/ui-only/template/src/components/providers/app-providers.tsx +26 -0
- package/dist/templates/web/ui-only/template/src/components/providers/theme-provider.tsx +94 -0
- package/dist/templates/web/ui-only/template/src/components/shared/footer.tsx +36 -0
- package/dist/templates/web/ui-only/template/src/components/shared/header.tsx +53 -0
- package/dist/templates/web/ui-only/template/src/components/ui/badge.tsx +36 -0
- package/dist/templates/web/ui-only/template/src/components/ui/theme-toggle.tsx +34 -0
- package/dist/templates/web/ui-only/template/src/lib/env.ts +49 -0
- package/dist/templates/web/ui-only/template/src/lib/utils.ts +140 -0
- package/dist/templates/web/ui-only/template/src/test/setup.ts +79 -0
- package/dist/templates/web/ui-only/template/tailwind.config.js +77 -0
- package/dist/templates/web/ui-only/template/tsconfig.json +33 -0
- package/dist/templates/web/ui-only/template/vitest.config.ts +17 -0
- package/dist/templates/web/ui-only/template.backup/.env.example +15 -0
- package/dist/templates/web/ui-only/template.backup.20250817/.env.example +15 -0
- package/dist/templates/web/ui-package-test/template/next-env.d.ts +5 -0
- package/dist/templates/web/ui-package-test/template/package.json +42 -0
- package/dist/templates/web/ui-package-test/template/src/app/page.tsx +106 -0
- package/dist/templates/web/ui-package-test/template/tsconfig.json +41 -0
- package/package.json +106 -0
- package/src/templates/mobile/base/template/.env.example +15 -0
- package/src/templates/mobile/base/template/App.tsx +186 -0
- package/src/templates/mobile/base/template/app/(auth)/login.tsx +44 -0
- package/src/templates/mobile/base/template/app/(auth)/signup.tsx +43 -0
- package/src/templates/mobile/base/template/app/checkout.tsx +20 -0
- package/src/templates/mobile/base/template/app.json +44 -0
- package/src/templates/mobile/base/template/babel.config.js +6 -0
- package/src/templates/mobile/base/template/eas.json +19 -0
- package/src/templates/mobile/base/template/package.json +54 -0
- package/src/templates/mobile/ui-auth-payments/template/.env.example +20 -0
- package/src/templates/mobile/ui-auth-payments/template/README.md +218 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +153 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/analytics.tsx +668 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +743 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +757 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/orders.tsx +402 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +580 -0
- package/src/templates/mobile/ui-auth-payments/template/app/_layout.tsx +134 -0
- package/src/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +246 -0
- package/src/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +362 -0
- package/src/templates/mobile/ui-auth-payments/template/app/onboarding/index.tsx +193 -0
- package/src/templates/mobile/ui-auth-payments/template/app/tour/index.tsx +272 -0
- package/src/templates/mobile/ui-auth-payments/template/app.json +94 -0
- package/src/templates/mobile/ui-auth-payments/template/babel.config.js +23 -0
- package/src/templates/mobile/ui-auth-payments/template/eas.json +45 -0
- package/src/templates/mobile/ui-auth-payments/template/expo-env.d.ts +3 -0
- package/src/templates/mobile/ui-auth-payments/template/jest-setup.ts +74 -0
- package/src/templates/mobile/ui-auth-payments/template/metro.config.js +11 -0
- package/src/templates/mobile/ui-auth-payments/template/package.json +117 -0
- package/src/templates/mobile/ui-auth-payments/template/tsconfig.json +31 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/.env.example +23 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/README.md +254 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +169 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/ai.tsx +522 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/analytics.tsx +668 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +743 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +676 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/orders.tsx +402 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +580 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +134 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +246 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +362 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/onboarding/index.tsx +193 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/tour/index.tsx +272 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app.json +94 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/babel.config.js +23 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/eas.json +45 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/expo-env.d.ts +3 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/jest-setup.ts +74 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/metro.config.js +11 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/package.json +119 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/tsconfig.json +31 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/README.md +655 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +683 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/_layout.tsx +134 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/app.json +74 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/babel.config.js +25 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +787 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/eas.json +25 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/expo-env.d.ts +3 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +346 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/jest-setup.ts +37 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +180 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/metro.config.js +11 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/package.json +124 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +599 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/tsconfig.json +32 -0
- package/src/templates/shared/auth/firebase/web/config.ts +23 -0
- package/src/templates/shared/auth/supabase/web/config.ts +8 -0
- package/src/templates/web/base/template/.env.example +15 -0
- package/src/templates/web/base/template/.eslintrc.js +8 -0
- package/src/templates/web/base/template/README.md +68 -0
- package/src/templates/web/base/template/next.config.js +15 -0
- package/src/templates/web/base/template/package.json +59 -0
- package/src/templates/web/base/template/postcss.config.js +7 -0
- package/src/templates/web/base/template/src/app/auth/callback/route.ts +18 -0
- package/src/templates/web/base/template/src/app/checkout/page.tsx +119 -0
- package/src/templates/web/base/template/src/app/dashboard/page.tsx +366 -0
- package/src/templates/web/base/template/src/app/error.tsx +97 -0
- package/src/templates/web/base/template/src/app/globals.css +157 -0
- package/src/templates/web/base/template/src/app/layout.tsx +35 -0
- package/src/templates/web/base/template/src/app/loading.tsx +52 -0
- package/src/templates/web/base/template/src/app/login/page.tsx +67 -0
- package/src/templates/web/base/template/src/app/page.tsx +193 -0
- package/src/templates/web/base/template/src/app/signup/page.tsx +67 -0
- package/src/templates/web/base/template/src/components/__tests__/example.test.tsx +49 -0
- package/src/templates/web/base/template/src/components/providers/app-providers.tsx +35 -0
- package/src/templates/web/base/template/src/components/providers/theme-provider.tsx +94 -0
- package/src/templates/web/base/template/src/components/shared/footer.tsx +36 -0
- package/src/templates/web/base/template/src/components/shared/header.tsx +63 -0
- package/src/templates/web/base/template/src/components/ui/badge.tsx +36 -0
- package/src/templates/web/base/template/src/components/ui/button.tsx +56 -0
- package/src/templates/web/base/template/src/components/ui/card.tsx +71 -0
- package/src/templates/web/base/template/src/components/ui/theme-toggle.tsx +34 -0
- package/src/templates/web/base/template/src/lib/auth-server.ts +177 -0
- package/src/templates/web/base/template/src/lib/env.ts +46 -0
- package/src/templates/web/base/template/src/lib/platform.ts +146 -0
- package/src/templates/web/base/template/src/lib/utils.ts +140 -0
- package/src/templates/web/base/template/src/test/setup.ts +79 -0
- package/src/templates/web/base/template/tailwind.config.js +77 -0
- package/src/templates/web/base/template/tsconfig.json +33 -0
- package/src/templates/web/base/template/vitest.config.ts +17 -0
- package/src/templates/web/base/template.backup/.env.example +15 -0
- package/src/templates/web/base/template.backup.20250817/.env.example +15 -0
- package/src/templates/web/ui-auth/template/.claude +21 -0
- package/src/templates/web/ui-auth/template/.env.example +15 -0
- package/src/templates/web/ui-auth/template/.eslintrc.js +8 -0
- package/src/templates/web/ui-auth/template/README.md +68 -0
- package/src/templates/web/ui-auth/template/context.md +105 -0
- package/src/templates/web/ui-auth/template/next.config.js +12 -0
- package/src/templates/web/ui-auth/template/package.json +51 -0
- package/src/templates/web/ui-auth/template/postcss.config.js +7 -0
- package/src/templates/web/ui-auth/template/src/app/auth/callback/route.ts +12 -0
- package/src/templates/web/ui-auth/template/src/app/checkout/page.tsx +25 -0
- package/src/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +801 -0
- package/src/templates/web/ui-auth/template/src/app/error.tsx +67 -0
- package/src/templates/web/ui-auth/template/src/app/globals.css +95 -0
- package/src/templates/web/ui-auth/template/src/app/layout.tsx +33 -0
- package/src/templates/web/ui-auth/template/src/app/loading.tsx +38 -0
- package/src/templates/web/ui-auth/template/src/app/login/page.tsx +109 -0
- package/src/templates/web/ui-auth/template/src/app/page.tsx +305 -0
- package/src/templates/web/ui-auth/template/src/app/setup/page.tsx +403 -0
- package/src/templates/web/ui-auth/template/src/app/signup/page.tsx +128 -0
- package/src/templates/web/ui-auth/template/src/components/__tests__/example.test.tsx +49 -0
- package/src/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +31 -0
- package/src/templates/web/ui-auth/template/src/components/providers/theme-provider.tsx +94 -0
- package/src/templates/web/ui-auth/template/src/components/shared/footer.tsx +36 -0
- package/src/templates/web/ui-auth/template/src/components/shared/header.tsx +94 -0
- package/src/templates/web/ui-auth/template/src/components/ui/badge.tsx +36 -0
- package/src/templates/web/ui-auth/template/src/components/ui/theme-toggle.tsx +34 -0
- package/src/templates/web/ui-auth/template/src/lib/env.ts +49 -0
- package/src/templates/web/ui-auth/template/src/lib/platform.ts +137 -0
- package/src/templates/web/ui-auth/template/src/lib/utils.ts +140 -0
- package/src/templates/web/ui-auth/template/src/test/setup.ts +79 -0
- package/src/templates/web/ui-auth/template/tailwind.config.js +77 -0
- package/src/templates/web/ui-auth/template/tsconfig.json +33 -0
- package/src/templates/web/ui-auth/template/vitest.config.ts +17 -0
- package/src/templates/web/ui-auth/template.backup/.env.example +15 -0
- package/src/templates/web/ui-auth/template.backup.20250817/.env.example +15 -0
- package/src/templates/web/ui-auth-ai/template/.env.example +18 -0
- package/src/templates/web/ui-auth-ai/template/README.md +170 -0
- package/src/templates/web/ui-auth-ai/template/next.config.js +13 -0
- package/src/templates/web/ui-auth-ai/template/package.json +39 -0
- package/src/templates/web/ui-auth-ai/template/postcss.config.js +6 -0
- package/src/templates/web/ui-auth-ai/template/src/app/globals.css +40 -0
- package/src/templates/web/ui-auth-ai/template/src/app/layout.tsx +41 -0
- package/src/templates/web/ui-auth-ai/template/src/app/page.tsx +193 -0
- package/src/templates/web/ui-auth-ai/template/src/components/ai/audio-generator.tsx +141 -0
- package/src/templates/web/ui-auth-ai/template/src/components/ai/video-generator.tsx +158 -0
- package/src/templates/web/ui-auth-ai/template/src/components/auth/login-form.tsx +106 -0
- package/src/templates/web/ui-auth-ai/template/src/components/ui/button.tsx +44 -0
- package/src/templates/web/ui-auth-ai/template/src/components/ui/input.tsx +24 -0
- package/src/templates/web/ui-auth-ai/template/src/components/ui/label.tsx +21 -0
- package/src/templates/web/ui-auth-ai/template/src/components/ui/select.tsx +37 -0
- package/src/templates/web/ui-auth-ai/template/src/components/ui/textarea.tsx +23 -0
- package/src/templates/web/ui-auth-ai/template/src/hooks/useAuth.ts +1 -0
- package/src/templates/web/ui-auth-ai/template/src/lib/supabase.ts +8 -0
- package/src/templates/web/ui-auth-ai/template/src/lib/utils.ts +5 -0
- package/src/templates/web/ui-auth-ai/template/src/providers/auth-provider.tsx +55 -0
- package/src/templates/web/ui-auth-ai/template/tailwind.config.js +22 -0
- package/src/templates/web/ui-auth-ai/template/tsconfig.json +28 -0
- package/src/templates/web/ui-auth-payments/template/.env.example +51 -0
- package/src/templates/web/ui-auth-payments/template/README.md +165 -0
- package/src/templates/web/ui-auth-payments/template/middleware.ts +68 -0
- package/src/templates/web/ui-auth-payments/template/next.config.js +12 -0
- package/src/templates/web/ui-auth-payments/template/package-lock.json +12240 -0
- package/src/templates/web/ui-auth-payments/template/package.json +55 -0
- package/src/templates/web/ui-auth-payments/template/postcss.config.js +7 -0
- package/src/templates/web/ui-auth-payments/template/src/app/auth/callback/route.ts +12 -0
- package/src/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +211 -0
- package/src/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +318 -0
- package/src/templates/web/ui-auth-payments/template/src/app/dashboard/layout.tsx +22 -0
- package/src/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +235 -0
- package/src/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +801 -0
- package/src/templates/web/ui-auth-payments/template/src/app/error.tsx +67 -0
- package/src/templates/web/ui-auth-payments/template/src/app/globals.css +211 -0
- package/src/templates/web/ui-auth-payments/template/src/app/layout.tsx +33 -0
- package/src/templates/web/ui-auth-payments/template/src/app/loading.tsx +20 -0
- package/src/templates/web/ui-auth-payments/template/src/app/login/loading.tsx +38 -0
- package/src/templates/web/ui-auth-payments/template/src/app/login/page.tsx +109 -0
- package/src/templates/web/ui-auth-payments/template/src/app/page.tsx +350 -0
- package/src/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +507 -0
- package/src/templates/web/ui-auth-payments/template/src/app/signup/loading.tsx +50 -0
- package/src/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +128 -0
- package/src/templates/web/ui-auth-payments/template/src/components/__tests__/example.test.tsx +49 -0
- package/src/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +52 -0
- package/src/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +144 -0
- package/src/templates/web/ui-auth-payments/template/src/components/client/newsletter-signup.tsx +68 -0
- package/src/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +185 -0
- package/src/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +34 -0
- package/src/templates/web/ui-auth-payments/template/src/components/providers/theme-provider.tsx +94 -0
- package/src/templates/web/ui-auth-payments/template/src/components/shared/footer.tsx +36 -0
- package/src/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +230 -0
- package/src/templates/web/ui-auth-payments/template/src/components/ui/badge.tsx +36 -0
- package/src/templates/web/ui-auth-payments/template/src/components/ui/theme-toggle.tsx +34 -0
- package/src/templates/web/ui-auth-payments/template/src/lib/actions/auth.ts +246 -0
- package/src/templates/web/ui-auth-payments/template/src/lib/actions/index.ts +340 -0
- package/src/templates/web/ui-auth-payments/template/src/lib/auth-server.ts +177 -0
- package/src/templates/web/ui-auth-payments/template/src/lib/env.ts +49 -0
- package/src/templates/web/ui-auth-payments/template/src/lib/platform.ts +146 -0
- package/src/templates/web/ui-auth-payments/template/src/lib/utils.ts +140 -0
- package/src/templates/web/ui-auth-payments/template/src/test/setup.ts +79 -0
- package/src/templates/web/ui-auth-payments/template/tailwind.config.js +77 -0
- package/src/templates/web/ui-auth-payments/template/tsconfig.json +33 -0
- package/src/templates/web/ui-auth-payments/template/tsconfig.tsbuildinfo +1 -0
- package/src/templates/web/ui-auth-payments/template/vitest.config.ts +17 -0
- package/src/templates/web/ui-auth-payments-ai/template/.claude +21 -0
- package/src/templates/web/ui-auth-payments-ai/template/.env.example +60 -0
- package/src/templates/web/ui-auth-payments-ai/template/README.md +207 -0
- package/src/templates/web/ui-auth-payments-ai/template/context.md +169 -0
- package/src/templates/web/ui-auth-payments-ai/template/middleware.ts +68 -0
- package/src/templates/web/ui-auth-payments-ai/template/next.config.js +12 -0
- package/src/templates/web/ui-auth-payments-ai/template/package-lock.json +12241 -0
- package/src/templates/web/ui-auth-payments-ai/template/package.json +58 -0
- package/src/templates/web/ui-auth-payments-ai/template/postcss.config.js +7 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +310 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/api/ai/audio/route.ts +56 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/api/ai/chat/route.ts +49 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/api/ai/text/route.ts +64 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/api/ai/video/route.ts +73 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/auth/callback/route.ts +12 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +422 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +142 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/layout.tsx +22 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +236 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +801 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/error.tsx +67 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/globals.css +96 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/layout.tsx +35 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/loading.tsx +20 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/login/page.tsx +6 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +364 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +394 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.backup +391 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.bak +391 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +532 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +645 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/signup/page.tsx +6 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/__tests__/example.test.tsx +49 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +52 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +163 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +201 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +38 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/theme-provider.tsx +96 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/shared/footer.tsx +36 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +252 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/ui/badge.tsx +36 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/ui/theme-toggle.tsx +34 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/actions/auth.ts +246 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/actions/index.ts +14 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/auth-server.ts +177 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/env.ts +49 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/platform.ts +155 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/supabase/server.ts +72 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/utils.ts +140 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +79 -0
- package/src/templates/web/ui-auth-payments-ai/template/tailwind.config.js +77 -0
- package/src/templates/web/ui-auth-payments-ai/template/tsconfig.json +33 -0
- package/src/templates/web/ui-auth-payments-ai/template/tsconfig.tsbuildinfo +1 -0
- package/src/templates/web/ui-auth-payments-ai/template/vitest.config.ts +17 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/README.md +434 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +642 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +466 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +393 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +457 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +478 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +250 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/package.json +76 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +622 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +396 -0
- package/src/templates/web/ui-auth-payments-audio/template/.env.example +15 -0
- package/src/templates/web/ui-auth-payments-audio/template/README.md +207 -0
- package/src/templates/web/ui-auth-payments-audio/template/middleware.ts +68 -0
- package/src/templates/web/ui-auth-payments-audio/template/next.config.js +12 -0
- package/src/templates/web/ui-auth-payments-audio/template/package-lock.json +12241 -0
- package/src/templates/web/ui-auth-payments-audio/template/package.json +55 -0
- package/src/templates/web/ui-auth-payments-audio/template/postcss.config.js +7 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/auth/callback/route.ts +12 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +211 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +142 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/dashboard/layout.tsx +22 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +237 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/error.tsx +67 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/globals.css +96 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/layout.tsx +35 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/loading.tsx +20 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/login/page.tsx +6 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +403 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.backup +391 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.bak +391 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/setup/page.tsx +345 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/signup/page.tsx +6 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/__tests__/example.test.tsx +49 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +52 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +144 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +185 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +38 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/providers/theme-provider.tsx +96 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/shared/footer.tsx +36 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +252 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/ui/badge.tsx +36 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/ui/theme-toggle.tsx +34 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/lib/actions/auth.ts +246 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/lib/actions/index.ts +14 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/lib/auth-server.ts +177 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/lib/env.ts +49 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/lib/utils.ts +140 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +79 -0
- package/src/templates/web/ui-auth-payments-audio/template/tailwind.config.js +77 -0
- package/src/templates/web/ui-auth-payments-audio/template/tsconfig.json +33 -0
- package/src/templates/web/ui-auth-payments-audio/template/tsconfig.tsbuildinfo +1 -0
- package/src/templates/web/ui-auth-payments-audio/template/vitest.config.ts +17 -0
- package/src/templates/web/ui-auth-payments-video/template/.env.example +15 -0
- package/src/templates/web/ui-auth-payments-video/template/README.md +190 -0
- package/src/templates/web/ui-auth-payments-video/template/next.config.js +12 -0
- package/src/templates/web/ui-auth-payments-video/template/package.json +55 -0
- package/src/templates/web/ui-auth-payments-video/template/postcss.config.js +7 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/auth/callback/route.ts +12 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +211 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +142 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/error.tsx +67 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/globals.css +228 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/layout.tsx +33 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/loading.tsx +20 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +109 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/page.tsx +395 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/setup/page.tsx +351 -0
- package/src/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +128 -0
- package/src/templates/web/ui-auth-payments-video/template/src/components/__tests__/example.test.tsx +49 -0
- package/src/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +34 -0
- package/src/templates/web/ui-auth-payments-video/template/src/components/providers/theme-provider.tsx +94 -0
- package/src/templates/web/ui-auth-payments-video/template/src/components/shared/footer.tsx +36 -0
- package/src/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +246 -0
- package/src/templates/web/ui-auth-payments-video/template/src/components/ui/badge.tsx +36 -0
- package/src/templates/web/ui-auth-payments-video/template/src/components/ui/theme-toggle.tsx +34 -0
- package/src/templates/web/ui-auth-payments-video/template/src/lib/env.ts +49 -0
- package/src/templates/web/ui-auth-payments-video/template/src/lib/utils.ts +140 -0
- package/src/templates/web/ui-auth-payments-video/template/src/test/setup.ts +79 -0
- package/src/templates/web/ui-auth-payments-video/template/tailwind.config.js +77 -0
- package/src/templates/web/ui-auth-payments-video/template/tsconfig.json +33 -0
- package/src/templates/web/ui-auth-payments-video/template/vitest.config.ts +17 -0
- package/src/templates/web/ui-only/template/.env.example +15 -0
- package/src/templates/web/ui-only/template/.eslintrc.js +8 -0
- package/src/templates/web/ui-only/template/README.md +68 -0
- package/src/templates/web/ui-only/template/next.config.js +12 -0
- package/src/templates/web/ui-only/template/package.json +49 -0
- package/src/templates/web/ui-only/template/postcss.config.js +7 -0
- package/src/templates/web/ui-only/template/src/app/auth/callback/route.ts +12 -0
- package/src/templates/web/ui-only/template/src/app/checkout/page.tsx +25 -0
- package/src/templates/web/ui-only/template/src/app/error.tsx +67 -0
- package/src/templates/web/ui-only/template/src/app/globals.css +42 -0
- package/src/templates/web/ui-only/template/src/app/layout.tsx +33 -0
- package/src/templates/web/ui-only/template/src/app/loading.tsx +20 -0
- package/src/templates/web/ui-only/template/src/app/login/page.tsx +63 -0
- package/src/templates/web/ui-only/template/src/app/page.tsx +91 -0
- package/src/templates/web/ui-only/template/src/app/signup/page.tsx +79 -0
- package/src/templates/web/ui-only/template/src/components/__tests__/example.test.tsx +49 -0
- package/src/templates/web/ui-only/template/src/components/providers/app-providers.tsx +26 -0
- package/src/templates/web/ui-only/template/src/components/providers/theme-provider.tsx +94 -0
- package/src/templates/web/ui-only/template/src/components/shared/footer.tsx +36 -0
- package/src/templates/web/ui-only/template/src/components/shared/header.tsx +53 -0
- package/src/templates/web/ui-only/template/src/components/ui/badge.tsx +36 -0
- package/src/templates/web/ui-only/template/src/components/ui/theme-toggle.tsx +34 -0
- package/src/templates/web/ui-only/template/src/lib/env.ts +49 -0
- package/src/templates/web/ui-only/template/src/lib/utils.ts +140 -0
- package/src/templates/web/ui-only/template/src/test/setup.ts +79 -0
- package/src/templates/web/ui-only/template/tailwind.config.js +77 -0
- package/src/templates/web/ui-only/template/tsconfig.json +33 -0
- package/src/templates/web/ui-only/template/vitest.config.ts +17 -0
- package/src/templates/web/ui-only/template.backup/.env.example +15 -0
- package/src/templates/web/ui-only/template.backup.20250817/.env.example +15 -0
- package/src/templates/web/ui-package-test/template/next-env.d.ts +5 -0
- package/src/templates/web/ui-package-test/template/package.json +42 -0
- package/src/templates/web/ui-package-test/template/src/app/page.tsx +106 -0
- package/src/templates/web/ui-package-test/template/tsconfig.json +41 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
|
|
3
|
+
import { after } from 'next/server'
|
|
4
|
+
import { revalidateTag, revalidatePath } from 'next/cache'
|
|
5
|
+
import { getCurrentUser } from '@/lib/auth-server'
|
|
6
|
+
import { z } from 'zod'
|
|
7
|
+
|
|
8
|
+
// Common response type
|
|
9
|
+
export type ActionResponse<T = any> = {
|
|
10
|
+
success: boolean
|
|
11
|
+
data?: T
|
|
12
|
+
error?: string
|
|
13
|
+
fieldErrors?: Record<string, string[]>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Example server action for contact form
|
|
18
|
+
*/
|
|
19
|
+
export async function submitContactForm(prevState: any, formData: FormData): Promise<ActionResponse> {
|
|
20
|
+
try {
|
|
21
|
+
const contactSchema = z.object({
|
|
22
|
+
name: z.string().min(2, 'Name must be at least 2 characters'),
|
|
23
|
+
email: z.string().email('Invalid email address'),
|
|
24
|
+
subject: z.string().min(5, 'Subject must be at least 5 characters'),
|
|
25
|
+
message: z.string().min(10, 'Message must be at least 10 characters'),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const rawData = {
|
|
29
|
+
name: formData.get('name') as string,
|
|
30
|
+
email: formData.get('email') as string,
|
|
31
|
+
subject: formData.get('subject') as string,
|
|
32
|
+
message: formData.get('message') as string,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const validationResult = contactSchema.safeParse(rawData)
|
|
36
|
+
|
|
37
|
+
if (!validationResult.success) {
|
|
38
|
+
return {
|
|
39
|
+
success: false,
|
|
40
|
+
error: 'Please check your input',
|
|
41
|
+
fieldErrors: validationResult.error.formErrors.fieldErrors,
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const { name, email, subject, message } = validationResult.data
|
|
46
|
+
|
|
47
|
+
// Process contact form submission
|
|
48
|
+
// This could involve:
|
|
49
|
+
// - Sending email to admin
|
|
50
|
+
// - Saving to database
|
|
51
|
+
// - Sending auto-reply to user
|
|
52
|
+
|
|
53
|
+
// Use after() for non-blocking operations (Next.js 15.3 feature)
|
|
54
|
+
after(async () => {
|
|
55
|
+
// Send notification email to admin (non-blocking)
|
|
56
|
+
console.log('Sending notification email for contact form submission')
|
|
57
|
+
|
|
58
|
+
// Log analytics event (non-blocking)
|
|
59
|
+
console.log('Logging contact form submission analytics')
|
|
60
|
+
|
|
61
|
+
// Update dashboard statistics (non-blocking)
|
|
62
|
+
console.log('Updating contact form statistics')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
data: { message: 'Thank you for your message. We\'ll get back to you soon!' }
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error('Contact form error:', error)
|
|
71
|
+
return {
|
|
72
|
+
success: false,
|
|
73
|
+
error: 'An unexpected error occurred. Please try again.',
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Example server action for newsletter signup
|
|
80
|
+
*/
|
|
81
|
+
export async function subscribeToNewsletter(prevState: any, formData: FormData): Promise<ActionResponse> {
|
|
82
|
+
try {
|
|
83
|
+
const email = formData.get('email') as string
|
|
84
|
+
|
|
85
|
+
const emailSchema = z.string().email('Invalid email address')
|
|
86
|
+
const validationResult = emailSchema.safeParse(email)
|
|
87
|
+
|
|
88
|
+
if (!validationResult.success) {
|
|
89
|
+
return {
|
|
90
|
+
success: false,
|
|
91
|
+
error: 'Please enter a valid email address',
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Add to newsletter list
|
|
96
|
+
// This could involve:
|
|
97
|
+
// - Adding to email service provider (Mailchimp, ConvertKit, etc.)
|
|
98
|
+
// - Saving to database
|
|
99
|
+
// - Sending welcome email
|
|
100
|
+
|
|
101
|
+
after(async () => {
|
|
102
|
+
// Send welcome email (non-blocking)
|
|
103
|
+
console.log(`Sending welcome email to ${email}`)
|
|
104
|
+
|
|
105
|
+
// Add to email marketing platform (non-blocking)
|
|
106
|
+
console.log(`Adding ${email} to newsletter list`)
|
|
107
|
+
|
|
108
|
+
// Track conversion (non-blocking)
|
|
109
|
+
console.log('Tracking newsletter signup conversion')
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
success: true,
|
|
114
|
+
data: { message: 'Successfully subscribed to newsletter!' }
|
|
115
|
+
}
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error('Newsletter subscription error:', error)
|
|
118
|
+
return {
|
|
119
|
+
success: false,
|
|
120
|
+
error: 'An unexpected error occurred. Please try again.',
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Example authenticated server action
|
|
127
|
+
*/
|
|
128
|
+
export async function createPost(prevState: any, formData: FormData): Promise<ActionResponse> {
|
|
129
|
+
try {
|
|
130
|
+
// Require authentication
|
|
131
|
+
const user = await getCurrentUser()
|
|
132
|
+
if (!user) {
|
|
133
|
+
return {
|
|
134
|
+
success: false,
|
|
135
|
+
error: 'Authentication required',
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const postSchema = z.object({
|
|
140
|
+
title: z.string().min(3, 'Title must be at least 3 characters'),
|
|
141
|
+
content: z.string().min(10, 'Content must be at least 10 characters'),
|
|
142
|
+
published: z.boolean().default(false),
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const rawData = {
|
|
146
|
+
title: formData.get('title') as string,
|
|
147
|
+
content: formData.get('content') as string,
|
|
148
|
+
published: formData.get('published') === 'true',
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const validationResult = postSchema.safeParse(rawData)
|
|
152
|
+
|
|
153
|
+
if (!validationResult.success) {
|
|
154
|
+
return {
|
|
155
|
+
success: false,
|
|
156
|
+
error: 'Please check your input',
|
|
157
|
+
fieldErrors: validationResult.error.formErrors.fieldErrors,
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const { title, content, published } = validationResult.data
|
|
162
|
+
|
|
163
|
+
// Create post in database
|
|
164
|
+
const post = {
|
|
165
|
+
id: Math.random().toString(36).substr(2, 9),
|
|
166
|
+
title,
|
|
167
|
+
content,
|
|
168
|
+
published,
|
|
169
|
+
authorId: user.id,
|
|
170
|
+
createdAt: new Date().toISOString(),
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Revalidate relevant paths and tags
|
|
174
|
+
revalidateTag('posts')
|
|
175
|
+
revalidatePath('/posts')
|
|
176
|
+
if (published) {
|
|
177
|
+
revalidatePath('/')
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Non-blocking operations
|
|
181
|
+
after(async () => {
|
|
182
|
+
// Send notifications to subscribers (non-blocking)
|
|
183
|
+
if (published) {
|
|
184
|
+
console.log('Notifying subscribers of new post')
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Update search index (non-blocking)
|
|
188
|
+
console.log('Updating search index')
|
|
189
|
+
|
|
190
|
+
// Track content creation analytics (non-blocking)
|
|
191
|
+
console.log('Tracking post creation analytics')
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
success: true,
|
|
196
|
+
data: { post, message: published ? 'Post published successfully!' : 'Post saved as draft!' }
|
|
197
|
+
}
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error('Create post error:', error)
|
|
200
|
+
return {
|
|
201
|
+
success: false,
|
|
202
|
+
error: 'An unexpected error occurred. Please try again.',
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Example action for updating user preferences
|
|
209
|
+
*/
|
|
210
|
+
export async function updatePreferences(prevState: any, formData: FormData): Promise<ActionResponse> {
|
|
211
|
+
try {
|
|
212
|
+
const user = await getCurrentUser()
|
|
213
|
+
if (!user) {
|
|
214
|
+
return {
|
|
215
|
+
success: false,
|
|
216
|
+
error: 'Authentication required',
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const preferencesSchema = z.object({
|
|
221
|
+
emailNotifications: z.boolean().default(true),
|
|
222
|
+
pushNotifications: z.boolean().default(false),
|
|
223
|
+
marketingEmails: z.boolean().default(false),
|
|
224
|
+
theme: z.enum(['light', 'dark', 'system']).default('system'),
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
const rawData = {
|
|
228
|
+
emailNotifications: formData.get('emailNotifications') === 'true',
|
|
229
|
+
pushNotifications: formData.get('pushNotifications') === 'true',
|
|
230
|
+
marketingEmails: formData.get('marketingEmails') === 'true',
|
|
231
|
+
theme: formData.get('theme') as 'light' | 'dark' | 'system' | null || 'system',
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const validationResult = preferencesSchema.safeParse(rawData)
|
|
235
|
+
|
|
236
|
+
if (!validationResult.success) {
|
|
237
|
+
return {
|
|
238
|
+
success: false,
|
|
239
|
+
error: 'Please check your input',
|
|
240
|
+
fieldErrors: validationResult.error.formErrors.fieldErrors,
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const preferences = validationResult.data
|
|
245
|
+
|
|
246
|
+
// Update user preferences in database
|
|
247
|
+
// This would typically involve a database update
|
|
248
|
+
|
|
249
|
+
after(async () => {
|
|
250
|
+
// Update notification service settings (non-blocking)
|
|
251
|
+
console.log('Updating notification service settings')
|
|
252
|
+
|
|
253
|
+
// Log preference changes for analytics (non-blocking)
|
|
254
|
+
console.log('Logging preference changes')
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
return {
|
|
258
|
+
success: true,
|
|
259
|
+
data: { preferences, message: 'Preferences updated successfully!' }
|
|
260
|
+
}
|
|
261
|
+
} catch (error) {
|
|
262
|
+
console.error('Update preferences error:', error)
|
|
263
|
+
return {
|
|
264
|
+
success: false,
|
|
265
|
+
error: 'An unexpected error occurred. Please try again.',
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Example action with file upload
|
|
272
|
+
*/
|
|
273
|
+
export async function uploadAvatar(prevState: any, formData: FormData): Promise<ActionResponse> {
|
|
274
|
+
try {
|
|
275
|
+
const user = await getCurrentUser()
|
|
276
|
+
if (!user) {
|
|
277
|
+
return {
|
|
278
|
+
success: false,
|
|
279
|
+
error: 'Authentication required',
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const file = formData.get('avatar') as File
|
|
284
|
+
|
|
285
|
+
if (!file || file.size === 0) {
|
|
286
|
+
return {
|
|
287
|
+
success: false,
|
|
288
|
+
error: 'Please select a file to upload',
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Validate file type and size
|
|
293
|
+
const allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']
|
|
294
|
+
const maxSize = 5 * 1024 * 1024 // 5MB
|
|
295
|
+
|
|
296
|
+
if (!allowedTypes.includes(file.type)) {
|
|
297
|
+
return {
|
|
298
|
+
success: false,
|
|
299
|
+
error: 'Please upload a valid image file (JPEG, PNG, GIF, or WebP)',
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (file.size > maxSize) {
|
|
304
|
+
return {
|
|
305
|
+
success: false,
|
|
306
|
+
error: 'File size must be less than 5MB',
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Process file upload
|
|
311
|
+
// This would typically involve:
|
|
312
|
+
// - Uploading to cloud storage (AWS S3, Cloudinary, etc.)
|
|
313
|
+
// - Resizing/optimizing the image
|
|
314
|
+
// - Updating user record in database
|
|
315
|
+
|
|
316
|
+
const avatarUrl = `https://example.com/avatars/${user.id}-${Date.now()}.${file.type.split('/')[1]}`
|
|
317
|
+
|
|
318
|
+
after(async () => {
|
|
319
|
+
// Generate different image sizes (non-blocking)
|
|
320
|
+
console.log('Generating avatar thumbnails')
|
|
321
|
+
|
|
322
|
+
// Update CDN cache (non-blocking)
|
|
323
|
+
console.log('Updating CDN cache')
|
|
324
|
+
|
|
325
|
+
// Log upload event (non-blocking)
|
|
326
|
+
console.log('Logging avatar upload event')
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
return {
|
|
330
|
+
success: true,
|
|
331
|
+
data: { avatarUrl, message: 'Avatar uploaded successfully!' }
|
|
332
|
+
}
|
|
333
|
+
} catch (error) {
|
|
334
|
+
console.error('Upload avatar error:', error)
|
|
335
|
+
return {
|
|
336
|
+
success: false,
|
|
337
|
+
error: 'An unexpected error occurred. Please try again.',
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { cookies } from 'next/headers'
|
|
2
|
+
import { redirect } from 'next/navigation'
|
|
3
|
+
|
|
4
|
+
// Server-side auth utilities that work with @digilogiclabs/saas-factory-auth
|
|
5
|
+
// These functions provide server-side access to auth state
|
|
6
|
+
|
|
7
|
+
export type User = {
|
|
8
|
+
id: string
|
|
9
|
+
email: string
|
|
10
|
+
name?: string
|
|
11
|
+
avatar?: string
|
|
12
|
+
[key: string]: any
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get the current user from server-side cookies
|
|
17
|
+
* This function should be called in Server Components, Server Actions, or Route Handlers
|
|
18
|
+
*/
|
|
19
|
+
export async function getCurrentUser(): Promise<User | null> {
|
|
20
|
+
try {
|
|
21
|
+
const cookieStore = await cookies()
|
|
22
|
+
|
|
23
|
+
// Check for auth token in cookies set by @digilogiclabs/saas-factory-auth
|
|
24
|
+
const authToken = cookieStore.get('saas-factory-auth-token')?.value
|
|
25
|
+
const userCookie = cookieStore.get('saas-factory-auth-user')?.value
|
|
26
|
+
|
|
27
|
+
if (!authToken || !userCookie) {
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Parse user data from cookie
|
|
32
|
+
try {
|
|
33
|
+
const userData = JSON.parse(userCookie)
|
|
34
|
+
return userData
|
|
35
|
+
} catch {
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('Error getting current user:', error)
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Require authentication - redirects to login if not authenticated
|
|
46
|
+
* Use this in Server Components that require authentication
|
|
47
|
+
*/
|
|
48
|
+
export async function requireAuth(): Promise<User> {
|
|
49
|
+
const user = await getCurrentUser()
|
|
50
|
+
|
|
51
|
+
if (!user) {
|
|
52
|
+
redirect('/login')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return user
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Check if user is authenticated (without redirecting)
|
|
60
|
+
* Returns boolean for conditional rendering
|
|
61
|
+
*/
|
|
62
|
+
export async function isAuthenticated(): Promise<boolean> {
|
|
63
|
+
const user = await getCurrentUser()
|
|
64
|
+
return !!user
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Redirect if already authenticated
|
|
69
|
+
* Use this on login/signup pages
|
|
70
|
+
*/
|
|
71
|
+
export async function redirectIfAuthenticated(redirectTo: string = '/') {
|
|
72
|
+
const user = await getCurrentUser()
|
|
73
|
+
|
|
74
|
+
if (user) {
|
|
75
|
+
redirect(redirectTo)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get user session data for server components
|
|
81
|
+
* Returns both user and loading state info
|
|
82
|
+
*/
|
|
83
|
+
export async function getServerSession() {
|
|
84
|
+
const user = await getCurrentUser()
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
user,
|
|
88
|
+
isAuthenticated: !!user,
|
|
89
|
+
isLoading: false, // Server-side is never loading
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Server-side auth check for API routes
|
|
95
|
+
*/
|
|
96
|
+
export async function getAuthFromRequest(request?: Request): Promise<User | null> {
|
|
97
|
+
try {
|
|
98
|
+
// If request is provided, extract cookies from it
|
|
99
|
+
if (request) {
|
|
100
|
+
const cookie = request.headers.get('cookie')
|
|
101
|
+
if (!cookie) return null
|
|
102
|
+
|
|
103
|
+
// Parse cookies manually from request
|
|
104
|
+
const cookies = cookie.split(';').reduce((acc, cookie) => {
|
|
105
|
+
const [key, value] = cookie.trim().split('=')
|
|
106
|
+
acc[key] = value
|
|
107
|
+
return acc
|
|
108
|
+
}, {} as Record<string, string>)
|
|
109
|
+
|
|
110
|
+
const authToken = cookies['saas-factory-auth-token']
|
|
111
|
+
const userCookie = cookies['saas-factory-auth-user']
|
|
112
|
+
|
|
113
|
+
if (!authToken || !userCookie) {
|
|
114
|
+
return null
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const userData = JSON.parse(decodeURIComponent(userCookie))
|
|
119
|
+
return userData
|
|
120
|
+
} catch {
|
|
121
|
+
return null
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Fallback to cookies() API
|
|
126
|
+
return await getCurrentUser()
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error('Error getting auth from request:', error)
|
|
129
|
+
return null
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Create server action wrapper that requires authentication
|
|
135
|
+
*/
|
|
136
|
+
export function withAuth<T extends any[], R>(
|
|
137
|
+
action: (user: User, ...args: T) => Promise<R>
|
|
138
|
+
) {
|
|
139
|
+
return async (...args: T): Promise<R> => {
|
|
140
|
+
const user = await requireAuth()
|
|
141
|
+
return action(user, ...args)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Server-side utility to check specific roles/permissions
|
|
147
|
+
* Extend this based on your user data structure
|
|
148
|
+
*/
|
|
149
|
+
export async function hasRole(role: string): Promise<boolean> {
|
|
150
|
+
const user = await getCurrentUser()
|
|
151
|
+
|
|
152
|
+
if (!user) return false
|
|
153
|
+
|
|
154
|
+
// Assuming role is stored in user.role or user.roles
|
|
155
|
+
if (Array.isArray(user.roles)) {
|
|
156
|
+
return user.roles.includes(role)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return user.role === role
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Server-side utility to require specific roles
|
|
164
|
+
*/
|
|
165
|
+
export async function requireRole(role: string): Promise<User> {
|
|
166
|
+
const user = await requireAuth()
|
|
167
|
+
|
|
168
|
+
const hasRequiredRole = Array.isArray(user.roles)
|
|
169
|
+
? user.roles.includes(role)
|
|
170
|
+
: user.role === role
|
|
171
|
+
|
|
172
|
+
if (!hasRequiredRole) {
|
|
173
|
+
redirect('/unauthorized')
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return user
|
|
177
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional Environment Configuration with Zod validation
|
|
3
|
+
*
|
|
4
|
+
* This provides type-safe environment variable validation.
|
|
5
|
+
* Usage is optional - existing templates will continue to work without this.
|
|
6
|
+
*
|
|
7
|
+
* To use: import { env } from '@/lib/env' instead of process.env
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { z } from 'zod'
|
|
11
|
+
|
|
12
|
+
const envSchema = z.object({
|
|
13
|
+
// Next.js built-in
|
|
14
|
+
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
|
15
|
+
|
|
16
|
+
// App configuration
|
|
17
|
+
NEXT_PUBLIC_APP_URL: z.string().url().optional(),
|
|
18
|
+
NEXT_PUBLIC_APP_NAME: z.string().default('{{titleCaseName}}'),
|
|
19
|
+
|
|
20
|
+
// Auth configuration (if using server-side auth)
|
|
21
|
+
SUPABASE_URL: z.string().url().optional(),
|
|
22
|
+
SUPABASE_ANON_KEY: z.string().optional(),
|
|
23
|
+
SUPABASE_SERVICE_ROLE_KEY: z.string().optional(),
|
|
24
|
+
|
|
25
|
+
// Payment configuration
|
|
26
|
+
STRIPE_SECRET_KEY: z.string().optional(),
|
|
27
|
+
STRIPE_WEBHOOK_SECRET: z.string().optional(),
|
|
28
|
+
|
|
29
|
+
// Optional analytics
|
|
30
|
+
ANALYTICS_ID: z.string().optional(),
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// Parse with fallback to process.env for backward compatibility
|
|
34
|
+
function parseEnv() {
|
|
35
|
+
try {
|
|
36
|
+
return envSchema.parse(process.env)
|
|
37
|
+
} catch (error) {
|
|
38
|
+
if (process.env.NODE_ENV === 'development') {
|
|
39
|
+
console.warn('Environment validation failed. Using process.env fallback:', error)
|
|
40
|
+
}
|
|
41
|
+
// Fallback to process.env for backward compatibility
|
|
42
|
+
return process.env as any
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const env = parseEnv()
|
|
47
|
+
|
|
48
|
+
// Type helper for environment variables
|
|
49
|
+
export type Env = z.infer<typeof envSchema>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Core Integration
|
|
3
|
+
*
|
|
4
|
+
* This file sets up the @digilogiclabs/platform-core integration for
|
|
5
|
+
* unified infrastructure services across your application.
|
|
6
|
+
*
|
|
7
|
+
* Platform-core provides:
|
|
8
|
+
* - Database abstraction (Supabase, PostgreSQL)
|
|
9
|
+
* - Cache abstraction (Redis, Upstash, Memory)
|
|
10
|
+
* - Storage abstraction (S3, MinIO, R2)
|
|
11
|
+
* - Email abstraction (Resend, SMTP)
|
|
12
|
+
* - Queue abstraction (BullMQ)
|
|
13
|
+
* - Logging and Metrics
|
|
14
|
+
* - Resilience patterns (retry, circuit breaker, timeout)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { createPlatform, createPlatformAsync, type IPlatform } from '@digilogiclabs/platform-core';
|
|
18
|
+
import { setPlatform as setAuthPlatform } from '@digilogiclabs/saas-factory-auth';
|
|
19
|
+
import { setPlatform as setPaymentsPlatform } from '@digilogiclabs/saas-factory-payments';
|
|
20
|
+
|
|
21
|
+
// Singleton platform instance
|
|
22
|
+
let platformInstance: IPlatform | null = null;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get the platform instance (creates a new one if needed)
|
|
26
|
+
*
|
|
27
|
+
* For testing or development without external services,
|
|
28
|
+
* this uses in-memory adapters.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const platform = getPlatform();
|
|
33
|
+
* await platform.cache.set('key', 'value', 3600);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function getPlatform(): IPlatform {
|
|
37
|
+
if (!platformInstance) {
|
|
38
|
+
platformInstance = createPlatform();
|
|
39
|
+
initializePackageIntegrations(platformInstance);
|
|
40
|
+
}
|
|
41
|
+
return platformInstance;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Initialize platform with production adapters (async)
|
|
46
|
+
*
|
|
47
|
+
* Call this once at application startup to configure
|
|
48
|
+
* production services based on environment variables.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* // In app/layout.tsx or a server initialization file
|
|
53
|
+
* await initializePlatform();
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export async function initializePlatform(): Promise<IPlatform> {
|
|
57
|
+
if (platformInstance) {
|
|
58
|
+
return platformInstance;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Use createPlatformAsync for production adapters
|
|
62
|
+
// Falls back to memory adapters if env vars are not set
|
|
63
|
+
platformInstance = await createPlatformAsync();
|
|
64
|
+
initializePackageIntegrations(platformInstance);
|
|
65
|
+
|
|
66
|
+
return platformInstance;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Initialize package integrations with platform services
|
|
71
|
+
*/
|
|
72
|
+
function initializePackageIntegrations(platform: IPlatform): void {
|
|
73
|
+
// Connect saas-factory-auth to platform-core
|
|
74
|
+
// Enables: logging, metrics, and email for auth events
|
|
75
|
+
setAuthPlatform({
|
|
76
|
+
email: platform.email,
|
|
77
|
+
logger: platform.logger,
|
|
78
|
+
metrics: platform.metrics,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Connect saas-factory-payments to platform-core
|
|
82
|
+
// Enables: logging, metrics, and caching for payment events
|
|
83
|
+
setPaymentsPlatform({
|
|
84
|
+
logger: platform.logger,
|
|
85
|
+
metrics: platform.metrics,
|
|
86
|
+
cache: platform.cache,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Reset platform instance (useful for testing)
|
|
92
|
+
*/
|
|
93
|
+
export function resetPlatform(): void {
|
|
94
|
+
platformInstance = null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Example: Using platform services
|
|
99
|
+
*
|
|
100
|
+
* Database:
|
|
101
|
+
* ```ts
|
|
102
|
+
* const users = await platform.db
|
|
103
|
+
* .from('users')
|
|
104
|
+
* .where('active', '=', true)
|
|
105
|
+
* .execute();
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* Cache:
|
|
109
|
+
* ```ts
|
|
110
|
+
* await platform.cache.set('user:123', userData, 3600);
|
|
111
|
+
* const cached = await platform.cache.get<User>('user:123');
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* Storage:
|
|
115
|
+
* ```ts
|
|
116
|
+
* await platform.storage.upload('avatars/user-123.png', buffer, {
|
|
117
|
+
* contentType: 'image/png',
|
|
118
|
+
* public: true,
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* Email:
|
|
123
|
+
* ```ts
|
|
124
|
+
* await platform.email.send({
|
|
125
|
+
* to: { email: 'user@example.com', name: 'John' },
|
|
126
|
+
* subject: 'Welcome!',
|
|
127
|
+
* html: '<h1>Welcome to {{titleCaseName}}</h1>',
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* Queue:
|
|
132
|
+
* ```ts
|
|
133
|
+
* await platform.queue.add('sendWelcomeEmail', { userId: '123' });
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* Logging:
|
|
137
|
+
* ```ts
|
|
138
|
+
* platform.logger.info('User signed up', { userId: '123' });
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* Metrics:
|
|
142
|
+
* ```ts
|
|
143
|
+
* platform.metrics.increment('user.signup');
|
|
144
|
+
* platform.metrics.timing('api.response_time', 150);
|
|
145
|
+
* ```
|
|
146
|
+
*/
|