@digilogiclabs/create-saas-app 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +975 -891
- package/dist/.tsbuildinfo +1 -1
- package/dist/generators/template-generator.d.ts +11 -0
- package/dist/generators/template-generator.d.ts.map +1 -1
- package/dist/generators/template-generator.js +389 -18
- package/dist/generators/template-generator.js.map +1 -1
- package/dist/index.js +1837 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/infrastructure/kubernetes/base/template/README.md +253 -0
- package/dist/templates/infrastructure/kubernetes/base/template/configmap.yaml +12 -0
- package/dist/templates/infrastructure/kubernetes/base/template/deployment.yaml +123 -0
- package/dist/templates/infrastructure/kubernetes/base/template/hpa.yaml +45 -0
- package/dist/templates/infrastructure/kubernetes/base/template/ingress.yaml +31 -0
- package/dist/templates/infrastructure/kubernetes/base/template/kustomization.yaml +25 -0
- package/dist/templates/infrastructure/kubernetes/base/template/namespace.yaml +8 -0
- package/dist/templates/infrastructure/kubernetes/base/template/networkpolicy.yaml +48 -0
- package/dist/templates/infrastructure/kubernetes/base/template/pdb.yaml +14 -0
- package/dist/templates/infrastructure/kubernetes/base/template/secret.yaml +17 -0
- package/dist/templates/infrastructure/kubernetes/base/template/service.yaml +19 -0
- package/dist/templates/infrastructure/kubernetes/base/template/serviceaccount.yaml +9 -0
- package/dist/templates/infrastructure/kubernetes/production/template/kustomization.yaml +92 -0
- package/dist/templates/infrastructure/terraform/aws/template/README.md +156 -0
- package/dist/templates/infrastructure/terraform/aws/template/main.tf +343 -0
- package/dist/templates/infrastructure/terraform/aws/template/outputs.tf +66 -0
- package/dist/templates/infrastructure/terraform/aws/template/terraform.tfvars.example +28 -0
- package/dist/templates/infrastructure/terraform/aws/template/variables.tf +110 -0
- package/dist/templates/infrastructure/terraform/gcp/template/README.md +165 -0
- package/dist/templates/infrastructure/terraform/gcp/template/main.tf +397 -0
- package/dist/templates/infrastructure/terraform/gcp/template/outputs.tf +51 -0
- package/dist/templates/infrastructure/terraform/gcp/template/terraform.tfvars.example +29 -0
- package/dist/templates/infrastructure/terraform/gcp/template/variables.tf +115 -0
- package/dist/templates/shared/admin/web/app/admin/layout.tsx +34 -0
- package/dist/templates/shared/admin/web/components/admin-nav.tsx +48 -0
- package/dist/templates/shared/audit/web/lib/audit.ts +24 -0
- package/dist/templates/shared/auth/keycloak/web/app/api/auth/federated-logout/route.ts +173 -0
- package/dist/templates/shared/auth/keycloak/web/auth.config.ts +84 -0
- package/dist/templates/shared/auth/keycloak/web/auth.ts +26 -0
- package/dist/templates/shared/beta/web/app/api/beta-settings/route.ts +25 -0
- package/dist/templates/shared/beta/web/app/api/validate-beta-code/route.ts +67 -0
- package/dist/templates/shared/beta/web/lib/beta/settings.ts +31 -0
- package/dist/templates/shared/cache/web/lib/cache.ts +44 -0
- package/dist/templates/shared/config/web/lib/config.ts +112 -0
- package/dist/templates/shared/config/web/next.config.mjs +62 -0
- package/dist/templates/shared/contact/web/app/api/contact/route.ts +113 -0
- package/dist/templates/shared/contact/web/app/contact/page.tsx +195 -0
- package/dist/templates/shared/cookie-consent/web/components/cookie-consent.tsx +54 -0
- package/dist/templates/shared/database/postgresql/web/drizzle.config.ts +16 -0
- package/dist/templates/shared/database/postgresql/web/lib/db/drizzle.ts +39 -0
- package/dist/templates/shared/database/postgresql/web/lib/db/schema.ts +33 -0
- package/dist/templates/shared/database/supabase/web/lib/supabase/client.ts +12 -0
- package/dist/templates/shared/database/supabase/web/lib/supabase/server.ts +31 -0
- package/dist/templates/shared/database/supabase/web/lib/supabase/service.ts +15 -0
- package/dist/templates/shared/email/web/lib/email/branding.ts +18 -0
- package/dist/templates/shared/email/web/lib/email/client.ts +96 -0
- package/dist/templates/shared/error-pages/web/app/error.tsx +70 -0
- package/dist/templates/shared/error-pages/web/app/global-error.tsx +102 -0
- package/dist/templates/shared/error-pages/web/app/not-found.tsx +39 -0
- package/dist/templates/shared/health/web/app/api/health/route.ts +68 -0
- package/dist/templates/shared/legal/web/app/(legal)/privacy/page.tsx +205 -0
- package/dist/templates/shared/legal/web/app/(legal)/terms/page.tsx +154 -0
- package/dist/templates/shared/legal/web/lib/legal-config.ts +50 -0
- package/dist/templates/shared/loading/web/app/loading.tsx +5 -0
- package/dist/templates/shared/loading/web/components/skeleton.tsx +95 -0
- package/dist/templates/shared/middleware/web/middleware.ts +68 -0
- package/dist/templates/shared/observability/web/lib/observability.ts +135 -0
- package/dist/templates/shared/payments/web/app/api/webhooks/stripe/route.ts +109 -0
- package/dist/templates/shared/platform/web/lib/platform.ts +37 -0
- package/dist/templates/shared/redis/web/lib/rate-limit-store.ts +18 -0
- package/dist/templates/shared/redis/web/lib/redis.ts +48 -0
- package/dist/templates/shared/security/web/lib/api-security.ts +318 -0
- package/dist/templates/shared/seo/web/app/api/og/route.tsx +97 -0
- package/dist/templates/shared/seo/web/app/robots.ts +53 -0
- package/dist/templates/shared/seo/web/app/sitemap.ts +53 -0
- package/dist/templates/shared/utils/web/lib/api-response.ts +71 -0
- package/dist/templates/shared/utils/web/lib/utils.ts +85 -0
- package/dist/templates/web/ai-platform/template/.env.example +16 -0
- package/dist/templates/web/ai-platform/template/README.md +84 -0
- package/dist/templates/web/ai-platform/template/middleware.ts +55 -0
- package/dist/templates/web/ai-platform/template/next.config.js +14 -0
- package/dist/templates/web/ai-platform/template/package.json +55 -0
- package/dist/templates/web/ai-platform/template/src/app/api/chat/route.ts +54 -0
- package/dist/templates/web/ai-platform/template/src/app/chat/page.tsx +235 -0
- package/dist/templates/web/ai-platform/template/src/app/dashboard/page.tsx +142 -0
- package/dist/templates/web/ai-platform/template/src/app/globals.css +34 -0
- package/dist/templates/web/ai-platform/template/src/app/layout.tsx +27 -0
- package/dist/templates/web/ai-platform/template/src/app/page.tsx +203 -0
- package/dist/templates/web/ai-platform/template/src/components/providers/app-providers.tsx +27 -0
- package/dist/templates/web/ai-platform/template/src/lib/auth-server.ts +33 -0
- package/dist/templates/web/ai-platform/template/src/lib/supabase/client.ts +8 -0
- package/dist/templates/web/ai-platform/template/src/lib/supabase/server.ts +27 -0
- package/dist/templates/web/ai-platform/template/src/lib/utils.ts +6 -0
- package/dist/templates/web/ai-platform/template/tsconfig.json +27 -0
- package/dist/templates/web/iot-dashboard/template/.env.example +12 -0
- package/dist/templates/web/iot-dashboard/template/README.md +101 -0
- package/dist/templates/web/iot-dashboard/template/middleware.ts +56 -0
- package/dist/templates/web/iot-dashboard/template/next.config.js +14 -0
- package/dist/templates/web/iot-dashboard/template/package.json +49 -0
- package/dist/templates/web/iot-dashboard/template/src/app/dashboard/page.tsx +229 -0
- package/dist/templates/web/iot-dashboard/template/src/app/globals.css +20 -0
- package/dist/templates/web/iot-dashboard/template/src/app/layout.tsx +27 -0
- package/dist/templates/web/iot-dashboard/template/src/app/page.tsx +191 -0
- package/dist/templates/web/iot-dashboard/template/src/components/providers/app-providers.tsx +24 -0
- package/dist/templates/web/iot-dashboard/template/src/lib/auth-server.ts +33 -0
- package/dist/templates/web/iot-dashboard/template/src/lib/supabase/client.ts +8 -0
- package/dist/templates/web/iot-dashboard/template/src/lib/supabase/server.ts +27 -0
- package/dist/templates/web/iot-dashboard/template/src/lib/utils.ts +25 -0
- package/dist/templates/web/iot-dashboard/template/tsconfig.json +27 -0
- package/dist/templates/web/marketplace/template/.env.example +12 -0
- package/dist/templates/web/marketplace/template/README.md +66 -0
- package/dist/templates/web/marketplace/template/middleware.ts +56 -0
- package/dist/templates/web/marketplace/template/next.config.js +14 -0
- package/dist/templates/web/marketplace/template/package.json +51 -0
- package/dist/templates/web/marketplace/template/src/app/cart/page.tsx +147 -0
- package/dist/templates/web/marketplace/template/src/app/dashboard/page.tsx +149 -0
- package/dist/templates/web/marketplace/template/src/app/globals.css +20 -0
- package/dist/templates/web/marketplace/template/src/app/layout.tsx +27 -0
- package/dist/templates/web/marketplace/template/src/app/page.tsx +167 -0
- package/dist/templates/web/marketplace/template/src/app/products/page.tsx +129 -0
- package/dist/templates/web/marketplace/template/src/components/providers/app-providers.tsx +27 -0
- package/dist/templates/web/marketplace/template/src/lib/auth-server.ts +33 -0
- package/dist/templates/web/marketplace/template/src/lib/supabase/client.ts +8 -0
- package/dist/templates/web/marketplace/template/src/lib/supabase/server.ts +27 -0
- package/dist/templates/web/marketplace/template/src/lib/utils.ts +19 -0
- package/dist/templates/web/marketplace/template/tsconfig.json +27 -0
- package/dist/templates/web/micro-saas/template/.env.example +10 -0
- package/dist/templates/web/micro-saas/template/README.md +63 -0
- package/dist/templates/web/micro-saas/template/middleware.ts +53 -0
- package/dist/templates/web/micro-saas/template/next.config.js +14 -0
- package/dist/templates/web/micro-saas/template/package.json +41 -0
- package/dist/templates/web/micro-saas/template/src/app/dashboard/page.tsx +117 -0
- package/dist/templates/web/micro-saas/template/src/app/globals.css +20 -0
- package/dist/templates/web/micro-saas/template/src/app/layout.tsx +27 -0
- package/dist/templates/web/micro-saas/template/src/app/login/page.tsx +87 -0
- package/dist/templates/web/micro-saas/template/src/app/page.tsx +137 -0
- package/dist/templates/web/micro-saas/template/src/app/signup/page.tsx +108 -0
- package/dist/templates/web/micro-saas/template/src/components/providers/app-providers.tsx +24 -0
- package/dist/templates/web/micro-saas/template/src/lib/auth-server.ts +33 -0
- package/dist/templates/web/micro-saas/template/src/lib/supabase/client.ts +8 -0
- package/dist/templates/web/micro-saas/template/src/lib/supabase/server.ts +29 -0
- package/dist/templates/web/micro-saas/template/src/lib/utils.ts +6 -0
- package/dist/templates/web/micro-saas/template/tsconfig.json +27 -0
- package/package.json +5 -4
- package/src/templates/infrastructure/kubernetes/base/template/README.md +253 -0
- package/src/templates/infrastructure/kubernetes/base/template/configmap.yaml +12 -0
- package/src/templates/infrastructure/kubernetes/base/template/deployment.yaml +123 -0
- package/src/templates/infrastructure/kubernetes/base/template/hpa.yaml +45 -0
- package/src/templates/infrastructure/kubernetes/base/template/ingress.yaml +31 -0
- package/src/templates/infrastructure/kubernetes/base/template/kustomization.yaml +25 -0
- package/src/templates/infrastructure/kubernetes/base/template/namespace.yaml +8 -0
- package/src/templates/infrastructure/kubernetes/base/template/networkpolicy.yaml +48 -0
- package/src/templates/infrastructure/kubernetes/base/template/pdb.yaml +14 -0
- package/src/templates/infrastructure/kubernetes/base/template/secret.yaml +17 -0
- package/src/templates/infrastructure/kubernetes/base/template/service.yaml +19 -0
- package/src/templates/infrastructure/kubernetes/base/template/serviceaccount.yaml +9 -0
- package/src/templates/infrastructure/kubernetes/production/template/kustomization.yaml +92 -0
- package/src/templates/infrastructure/terraform/aws/template/README.md +156 -0
- package/src/templates/infrastructure/terraform/aws/template/main.tf +343 -0
- package/src/templates/infrastructure/terraform/aws/template/outputs.tf +66 -0
- package/src/templates/infrastructure/terraform/aws/template/terraform.tfvars.example +28 -0
- package/src/templates/infrastructure/terraform/aws/template/variables.tf +110 -0
- package/src/templates/infrastructure/terraform/gcp/template/README.md +165 -0
- package/src/templates/infrastructure/terraform/gcp/template/main.tf +397 -0
- package/src/templates/infrastructure/terraform/gcp/template/outputs.tf +51 -0
- package/src/templates/infrastructure/terraform/gcp/template/terraform.tfvars.example +29 -0
- package/src/templates/infrastructure/terraform/gcp/template/variables.tf +115 -0
- package/src/templates/shared/admin/web/app/admin/layout.tsx +34 -0
- package/src/templates/shared/admin/web/components/admin-nav.tsx +48 -0
- package/src/templates/shared/audit/web/lib/audit.ts +24 -0
- package/src/templates/shared/auth/keycloak/web/app/api/auth/federated-logout/route.ts +173 -0
- package/src/templates/shared/auth/keycloak/web/auth.config.ts +84 -0
- package/src/templates/shared/auth/keycloak/web/auth.ts +26 -0
- package/src/templates/shared/beta/web/app/api/beta-settings/route.ts +25 -0
- package/src/templates/shared/beta/web/app/api/validate-beta-code/route.ts +67 -0
- package/src/templates/shared/beta/web/lib/beta/settings.ts +31 -0
- package/src/templates/shared/cache/web/lib/cache.ts +44 -0
- package/src/templates/shared/config/web/lib/config.ts +112 -0
- package/src/templates/shared/config/web/next.config.mjs +62 -0
- package/src/templates/shared/contact/web/app/api/contact/route.ts +113 -0
- package/src/templates/shared/contact/web/app/contact/page.tsx +195 -0
- package/src/templates/shared/cookie-consent/web/components/cookie-consent.tsx +54 -0
- package/src/templates/shared/database/postgresql/web/drizzle.config.ts +16 -0
- package/src/templates/shared/database/postgresql/web/lib/db/drizzle.ts +39 -0
- package/src/templates/shared/database/postgresql/web/lib/db/schema.ts +33 -0
- package/src/templates/shared/database/supabase/web/lib/supabase/client.ts +12 -0
- package/src/templates/shared/database/supabase/web/lib/supabase/server.ts +31 -0
- package/src/templates/shared/database/supabase/web/lib/supabase/service.ts +15 -0
- package/src/templates/shared/email/web/lib/email/branding.ts +18 -0
- package/src/templates/shared/email/web/lib/email/client.ts +96 -0
- package/src/templates/shared/error-pages/web/app/error.tsx +70 -0
- package/src/templates/shared/error-pages/web/app/global-error.tsx +102 -0
- package/src/templates/shared/error-pages/web/app/not-found.tsx +39 -0
- package/src/templates/shared/health/web/app/api/health/route.ts +68 -0
- package/src/templates/shared/legal/web/app/(legal)/privacy/page.tsx +205 -0
- package/src/templates/shared/legal/web/app/(legal)/terms/page.tsx +154 -0
- package/src/templates/shared/legal/web/lib/legal-config.ts +50 -0
- package/src/templates/shared/loading/web/app/loading.tsx +5 -0
- package/src/templates/shared/loading/web/components/skeleton.tsx +95 -0
- package/src/templates/shared/middleware/web/middleware.ts +68 -0
- package/src/templates/shared/observability/web/lib/observability.ts +135 -0
- package/src/templates/shared/payments/web/app/api/webhooks/stripe/route.ts +109 -0
- package/src/templates/shared/platform/web/lib/platform.ts +37 -0
- package/src/templates/shared/redis/web/lib/rate-limit-store.ts +18 -0
- package/src/templates/shared/redis/web/lib/redis.ts +48 -0
- package/src/templates/shared/security/web/lib/api-security.ts +318 -0
- package/src/templates/shared/seo/web/app/api/og/route.tsx +97 -0
- package/src/templates/shared/seo/web/app/robots.ts +53 -0
- package/src/templates/shared/seo/web/app/sitemap.ts +53 -0
- package/src/templates/shared/utils/web/lib/api-response.ts +71 -0
- package/src/templates/shared/utils/web/lib/utils.ts +85 -0
- package/src/templates/web/ai-platform/template/.env.example +16 -0
- package/src/templates/web/ai-platform/template/README.md +84 -0
- package/src/templates/web/ai-platform/template/middleware.ts +55 -0
- package/src/templates/web/ai-platform/template/next.config.js +14 -0
- package/src/templates/web/ai-platform/template/package.json +55 -0
- package/src/templates/web/ai-platform/template/src/app/api/chat/route.ts +54 -0
- package/src/templates/web/ai-platform/template/src/app/chat/page.tsx +235 -0
- package/src/templates/web/ai-platform/template/src/app/dashboard/page.tsx +142 -0
- package/src/templates/web/ai-platform/template/src/app/globals.css +34 -0
- package/src/templates/web/ai-platform/template/src/app/layout.tsx +27 -0
- package/src/templates/web/ai-platform/template/src/app/page.tsx +203 -0
- package/src/templates/web/ai-platform/template/src/components/providers/app-providers.tsx +27 -0
- package/src/templates/web/ai-platform/template/src/lib/auth-server.ts +33 -0
- package/src/templates/web/ai-platform/template/src/lib/supabase/client.ts +8 -0
- package/src/templates/web/ai-platform/template/src/lib/supabase/server.ts +27 -0
- package/src/templates/web/ai-platform/template/src/lib/utils.ts +6 -0
- package/src/templates/web/ai-platform/template/tsconfig.json +27 -0
- package/src/templates/web/iot-dashboard/template/.env.example +12 -0
- package/src/templates/web/iot-dashboard/template/README.md +101 -0
- package/src/templates/web/iot-dashboard/template/middleware.ts +56 -0
- package/src/templates/web/iot-dashboard/template/next.config.js +14 -0
- package/src/templates/web/iot-dashboard/template/package.json +49 -0
- package/src/templates/web/iot-dashboard/template/src/app/dashboard/page.tsx +229 -0
- package/src/templates/web/iot-dashboard/template/src/app/globals.css +20 -0
- package/src/templates/web/iot-dashboard/template/src/app/layout.tsx +27 -0
- package/src/templates/web/iot-dashboard/template/src/app/page.tsx +191 -0
- package/src/templates/web/iot-dashboard/template/src/components/providers/app-providers.tsx +24 -0
- package/src/templates/web/iot-dashboard/template/src/lib/auth-server.ts +33 -0
- package/src/templates/web/iot-dashboard/template/src/lib/supabase/client.ts +8 -0
- package/src/templates/web/iot-dashboard/template/src/lib/supabase/server.ts +27 -0
- package/src/templates/web/iot-dashboard/template/src/lib/utils.ts +25 -0
- package/src/templates/web/iot-dashboard/template/tsconfig.json +27 -0
- package/src/templates/web/marketplace/template/.env.example +12 -0
- package/src/templates/web/marketplace/template/README.md +66 -0
- package/src/templates/web/marketplace/template/middleware.ts +56 -0
- package/src/templates/web/marketplace/template/next.config.js +14 -0
- package/src/templates/web/marketplace/template/package.json +51 -0
- package/src/templates/web/marketplace/template/src/app/cart/page.tsx +147 -0
- package/src/templates/web/marketplace/template/src/app/dashboard/page.tsx +149 -0
- package/src/templates/web/marketplace/template/src/app/globals.css +20 -0
- package/src/templates/web/marketplace/template/src/app/layout.tsx +27 -0
- package/src/templates/web/marketplace/template/src/app/page.tsx +167 -0
- package/src/templates/web/marketplace/template/src/app/products/page.tsx +129 -0
- package/src/templates/web/marketplace/template/src/components/providers/app-providers.tsx +27 -0
- package/src/templates/web/marketplace/template/src/lib/auth-server.ts +33 -0
- package/src/templates/web/marketplace/template/src/lib/supabase/client.ts +8 -0
- package/src/templates/web/marketplace/template/src/lib/supabase/server.ts +27 -0
- package/src/templates/web/marketplace/template/src/lib/utils.ts +19 -0
- package/src/templates/web/marketplace/template/tsconfig.json +27 -0
- package/src/templates/web/micro-saas/template/.env.example +10 -0
- package/src/templates/web/micro-saas/template/README.md +63 -0
- package/src/templates/web/micro-saas/template/middleware.ts +53 -0
- package/src/templates/web/micro-saas/template/next.config.js +14 -0
- package/src/templates/web/micro-saas/template/package.json +41 -0
- package/src/templates/web/micro-saas/template/src/app/dashboard/page.tsx +117 -0
- package/src/templates/web/micro-saas/template/src/app/globals.css +20 -0
- package/src/templates/web/micro-saas/template/src/app/layout.tsx +27 -0
- package/src/templates/web/micro-saas/template/src/app/login/page.tsx +87 -0
- package/src/templates/web/micro-saas/template/src/app/page.tsx +137 -0
- package/src/templates/web/micro-saas/template/src/app/signup/page.tsx +108 -0
- package/src/templates/web/micro-saas/template/src/components/providers/app-providers.tsx +24 -0
- package/src/templates/web/micro-saas/template/src/lib/auth-server.ts +33 -0
- package/src/templates/web/micro-saas/template/src/lib/supabase/client.ts +8 -0
- package/src/templates/web/micro-saas/template/src/lib/supabase/server.ts +29 -0
- package/src/templates/web/micro-saas/template/src/lib/utils.ts +6 -0
- package/src/templates/web/micro-saas/template/tsconfig.json +27 -0
- package/dist/cli/commands/add.d.ts +0 -6
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -39
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/create.d.ts +0 -45
- package/dist/cli/commands/create.d.ts.map +0 -1
- package/dist/cli/commands/create.js +0 -175
- package/dist/cli/commands/create.js.map +0 -1
- package/dist/cli/commands/index.d.ts +0 -4
- package/dist/cli/commands/index.d.ts.map +0 -1
- package/dist/cli/commands/index.js +0 -20
- package/dist/cli/commands/index.js.map +0 -1
- package/dist/cli/commands/update.d.ts +0 -6
- package/dist/cli/commands/update.d.ts.map +0 -1
- package/dist/cli/commands/update.js +0 -68
- package/dist/cli/commands/update.js.map +0 -1
- package/dist/cli/index.d.ts +0 -4
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -61
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/prompts/index.d.ts +0 -2
- package/dist/cli/prompts/index.d.ts.map +0 -1
- package/dist/cli/prompts/index.js +0 -18
- package/dist/cli/prompts/index.js.map +0 -1
- package/dist/cli/prompts/project-setup.d.ts +0 -5
- package/dist/cli/prompts/project-setup.d.ts.map +0 -1
- package/dist/cli/prompts/project-setup.js +0 -316
- package/dist/cli/prompts/project-setup.js.map +0 -1
- package/dist/cli/utils/git.d.ts +0 -9
- package/dist/cli/utils/git.d.ts.map +0 -1
- package/dist/cli/utils/git.js +0 -77
- package/dist/cli/utils/git.js.map +0 -1
- package/dist/cli/utils/index.d.ts +0 -5
- package/dist/cli/utils/index.d.ts.map +0 -1
- package/dist/cli/utils/index.js +0 -21
- package/dist/cli/utils/index.js.map +0 -1
- package/dist/cli/utils/logger.d.ts +0 -16
- package/dist/cli/utils/logger.d.ts.map +0 -1
- package/dist/cli/utils/logger.js +0 -55
- package/dist/cli/utils/logger.js.map +0 -1
- package/dist/cli/utils/package-manager.d.ts +0 -8
- package/dist/cli/utils/package-manager.d.ts.map +0 -1
- package/dist/cli/utils/package-manager.js +0 -92
- package/dist/cli/utils/package-manager.js.map +0 -1
- package/dist/cli/utils/spinner.d.ts +0 -7
- package/dist/cli/utils/spinner.d.ts.map +0 -1
- package/dist/cli/utils/spinner.js +0 -48
- package/dist/cli/utils/spinner.js.map +0 -1
- package/dist/cli/validators/dependencies.d.ts +0 -15
- package/dist/cli/validators/dependencies.d.ts.map +0 -1
- package/dist/cli/validators/dependencies.js +0 -108
- package/dist/cli/validators/dependencies.js.map +0 -1
- package/dist/cli/validators/index.d.ts +0 -3
- package/dist/cli/validators/index.d.ts.map +0 -1
- package/dist/cli/validators/index.js +0 -19
- package/dist/cli/validators/index.js.map +0 -1
- package/dist/cli/validators/project-name.d.ts +0 -5
- package/dist/cli/validators/project-name.d.ts.map +0 -1
- package/dist/cli/validators/project-name.js +0 -151
- package/dist/cli/validators/project-name.js.map +0 -1
- package/dist/generators/file-processor.d.ts +0 -28
- package/dist/generators/file-processor.d.ts.map +0 -1
- package/dist/generators/file-processor.js +0 -224
- package/dist/generators/file-processor.js.map +0 -1
- package/dist/generators/index.d.ts +0 -4
- package/dist/generators/index.d.ts.map +0 -1
- package/dist/generators/index.js +0 -20
- package/dist/generators/index.js.map +0 -1
- package/dist/generators/package-installer.d.ts +0 -29
- package/dist/generators/package-installer.d.ts.map +0 -1
- package/dist/generators/package-installer.js +0 -177
- package/dist/generators/package-installer.js.map +0 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ImageResponse } from 'next/og';
|
|
2
|
+
import { NextRequest } from 'next/server';
|
|
3
|
+
|
|
4
|
+
export const runtime = 'edge';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Dynamic Open Graph image generator.
|
|
8
|
+
*
|
|
9
|
+
* Usage: /api/og?title=My+Page&subtitle=Description+here
|
|
10
|
+
*
|
|
11
|
+
* Customize the colors and branding below to match your app.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// ─── Customize these ────────────────────────────────────────
|
|
15
|
+
const APP_NAME = 'My App';
|
|
16
|
+
const BG_FROM = '#1e3a5f';
|
|
17
|
+
const BG_TO = '#0f172a';
|
|
18
|
+
const ACCENT = '#3b82f6';
|
|
19
|
+
// ─────────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
export async function GET(request: NextRequest) {
|
|
22
|
+
const { searchParams } = request.nextUrl;
|
|
23
|
+
const title = searchParams.get('title') || APP_NAME;
|
|
24
|
+
const subtitle = searchParams.get('subtitle') || '';
|
|
25
|
+
|
|
26
|
+
return new ImageResponse(
|
|
27
|
+
(
|
|
28
|
+
<div
|
|
29
|
+
style={{
|
|
30
|
+
width: '100%',
|
|
31
|
+
height: '100%',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
padding: '60px 80px',
|
|
36
|
+
background: `linear-gradient(135deg, ${BG_FROM} 0%, ${BG_TO} 100%)`,
|
|
37
|
+
color: 'white',
|
|
38
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{/* App branding */}
|
|
42
|
+
<div
|
|
43
|
+
style={{
|
|
44
|
+
display: 'flex',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
marginBottom: 40,
|
|
47
|
+
fontSize: 24,
|
|
48
|
+
opacity: 0.8,
|
|
49
|
+
letterSpacing: '0.05em',
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{APP_NAME}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
{/* Title */}
|
|
56
|
+
<div
|
|
57
|
+
style={{
|
|
58
|
+
fontSize: title.length > 40 ? 48 : 64,
|
|
59
|
+
fontWeight: 700,
|
|
60
|
+
lineHeight: 1.1,
|
|
61
|
+
maxWidth: '90%',
|
|
62
|
+
marginBottom: subtitle ? 24 : 0,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{title.length > 80 ? title.slice(0, 77) + '...' : title}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{/* Subtitle */}
|
|
69
|
+
{subtitle && (
|
|
70
|
+
<div
|
|
71
|
+
style={{
|
|
72
|
+
fontSize: 28,
|
|
73
|
+
opacity: 0.7,
|
|
74
|
+
maxWidth: '80%',
|
|
75
|
+
lineHeight: 1.3,
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
{subtitle.length > 120 ? subtitle.slice(0, 117) + '...' : subtitle}
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
|
|
82
|
+
{/* Accent bar */}
|
|
83
|
+
<div
|
|
84
|
+
style={{
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
bottom: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
right: 0,
|
|
89
|
+
height: 6,
|
|
90
|
+
background: ACCENT,
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
),
|
|
95
|
+
{ width: 1200, height: 630 },
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MetadataRoute } from 'next';
|
|
2
|
+
|
|
3
|
+
const BASE_URL = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Robots.txt configuration.
|
|
7
|
+
*
|
|
8
|
+
* Controls which paths search engines and AI crawlers can access.
|
|
9
|
+
* Adjust the rules to match your app's public and private routes.
|
|
10
|
+
*
|
|
11
|
+
* @see https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots
|
|
12
|
+
*/
|
|
13
|
+
export default function robots(): MetadataRoute.Robots {
|
|
14
|
+
return {
|
|
15
|
+
rules: [
|
|
16
|
+
// ─── Main search engines (Google, Bing, etc.) ──────────────
|
|
17
|
+
{
|
|
18
|
+
userAgent: ['Googlebot', 'Bingbot', 'Slurp', 'DuckDuckBot', 'Baiduspider', 'YandexBot'],
|
|
19
|
+
allow: '/',
|
|
20
|
+
disallow: ['/api/', '/dashboard/', '/admin/', '/auth/'],
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
// ─── AI crawlers (allow indexing, block private routes) ────
|
|
24
|
+
{
|
|
25
|
+
userAgent: [
|
|
26
|
+
'GPTBot',
|
|
27
|
+
'Google-Extended',
|
|
28
|
+
'ChatGPT-User',
|
|
29
|
+
'ClaudeBot',
|
|
30
|
+
'PerplexityBot',
|
|
31
|
+
'Amazonbot',
|
|
32
|
+
'YouBot',
|
|
33
|
+
],
|
|
34
|
+
allow: '/',
|
|
35
|
+
disallow: ['/api/', '/dashboard/', '/admin/', '/auth/'],
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// ─── Training-only crawlers (block entirely) ───────────────
|
|
39
|
+
{
|
|
40
|
+
userAgent: ['CCBot', 'anthropic-ai'],
|
|
41
|
+
disallow: '/',
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// ─── Default (allow public content) ────────────────────────
|
|
45
|
+
{
|
|
46
|
+
userAgent: '*',
|
|
47
|
+
allow: '/',
|
|
48
|
+
disallow: ['/api/', '/dashboard/', '/admin/', '/auth/'],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
sitemap: `${BASE_URL}/sitemap.xml`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MetadataRoute } from 'next';
|
|
2
|
+
|
|
3
|
+
const BASE_URL = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Dynamic sitemap generator.
|
|
7
|
+
*
|
|
8
|
+
* Generates a sitemap for search engine crawlers.
|
|
9
|
+
* Add your app's dynamic routes (e.g., user profiles, blog posts)
|
|
10
|
+
* alongside the static pages.
|
|
11
|
+
*
|
|
12
|
+
* @see https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap
|
|
13
|
+
*/
|
|
14
|
+
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
15
|
+
const now = new Date();
|
|
16
|
+
|
|
17
|
+
// ─── Static Pages ────────────────────────────────────────────
|
|
18
|
+
const staticPages: MetadataRoute.Sitemap = [
|
|
19
|
+
{
|
|
20
|
+
url: BASE_URL,
|
|
21
|
+
lastModified: now,
|
|
22
|
+
changeFrequency: 'daily',
|
|
23
|
+
priority: 1.0,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
url: `${BASE_URL}/terms`,
|
|
27
|
+
lastModified: now,
|
|
28
|
+
changeFrequency: 'monthly',
|
|
29
|
+
priority: 0.3,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
url: `${BASE_URL}/privacy`,
|
|
33
|
+
lastModified: now,
|
|
34
|
+
changeFrequency: 'monthly',
|
|
35
|
+
priority: 0.3,
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
// ─── Dynamic Pages ───────────────────────────────────────────
|
|
40
|
+
// TODO: Add your dynamic routes here. Example:
|
|
41
|
+
//
|
|
42
|
+
// const { data: posts } = await db.from('posts').select('slug, updated_at');
|
|
43
|
+
// const postPages = (posts || []).map((post) => ({
|
|
44
|
+
// url: `${BASE_URL}/blog/${post.slug}`,
|
|
45
|
+
// lastModified: new Date(post.updated_at),
|
|
46
|
+
// changeFrequency: 'weekly' as const,
|
|
47
|
+
// priority: 0.7,
|
|
48
|
+
// }));
|
|
49
|
+
//
|
|
50
|
+
// return [...staticPages, ...postPages];
|
|
51
|
+
|
|
52
|
+
return staticPages;
|
|
53
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
import { classifyError, buildPagination } from '@digilogiclabs/platform-core/auth';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Standardized API response helpers.
|
|
6
|
+
*
|
|
7
|
+
* Provides consistent response shapes across all API routes.
|
|
8
|
+
* Uses classifyError from platform-core for structured error handling.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Success response with optional status code */
|
|
12
|
+
export function successResponse<T>(data: T, status = 200) {
|
|
13
|
+
return NextResponse.json({ success: true, data }, { status });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Success response with a message */
|
|
17
|
+
export function successWithMessage<T>(data: T, message: string, status = 200) {
|
|
18
|
+
return NextResponse.json({ success: true, message, data }, { status });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** 201 Created response */
|
|
22
|
+
export function createdResponse<T>(data: T, message = 'Created successfully') {
|
|
23
|
+
return NextResponse.json({ success: true, message, data }, { status: 201 });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 204 No Content response */
|
|
27
|
+
export function noContentResponse() {
|
|
28
|
+
return new NextResponse(null, { status: 204 });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 202 Accepted response (for async operations) */
|
|
32
|
+
export function acceptedResponse<T>(data: T, message = 'Request accepted') {
|
|
33
|
+
return NextResponse.json({ success: true, message, data }, { status: 202 });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Error response with status code */
|
|
37
|
+
export function errorResponse(message: string, status = 500, code?: string) {
|
|
38
|
+
return NextResponse.json(
|
|
39
|
+
{ success: false, error: { message, ...(code && { code }) } },
|
|
40
|
+
{ status }
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Paginated response with metadata */
|
|
45
|
+
export function paginatedResponse<T>(data: T[], page: number, limit: number, total: number) {
|
|
46
|
+
return NextResponse.json({
|
|
47
|
+
success: true,
|
|
48
|
+
data,
|
|
49
|
+
pagination: buildPagination(page, limit, total),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Handle any error and return a structured response */
|
|
54
|
+
export function handleApiError(error: unknown) {
|
|
55
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
56
|
+
const { status, body } = classifyError(error, isDev);
|
|
57
|
+
return NextResponse.json({ success: false, error: body }, { status });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Wrap a handler with automatic error handling */
|
|
61
|
+
export function withErrorHandler(
|
|
62
|
+
handler: (request: Request) => Promise<NextResponse>
|
|
63
|
+
): (request: Request) => Promise<NextResponse> {
|
|
64
|
+
return async (request: Request) => {
|
|
65
|
+
try {
|
|
66
|
+
return await handler(request);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return handleApiError(error);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type ClassValue, clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
/** Merge Tailwind classes with conflict resolution */
|
|
5
|
+
export function cn(...inputs: ClassValue[]) {
|
|
6
|
+
return twMerge(clsx(inputs));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Format currency with locale support */
|
|
10
|
+
export function formatCurrency(amount: number, currency = 'USD', locale = 'en-US'): string {
|
|
11
|
+
return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(amount);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Format date with locale support */
|
|
15
|
+
export function formatDate(date: Date | string, options?: Intl.DateTimeFormatOptions): string {
|
|
16
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
17
|
+
return d.toLocaleDateString(
|
|
18
|
+
'en-US',
|
|
19
|
+
options || { year: 'numeric', month: 'long', day: 'numeric' }
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Get relative time string (e.g., "2 hours ago", "in 3 days") */
|
|
24
|
+
export function getRelativeTime(date: Date | string): string {
|
|
25
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
26
|
+
const now = new Date();
|
|
27
|
+
const diffMs = now.getTime() - d.getTime();
|
|
28
|
+
const diffSec = Math.floor(diffMs / 1000);
|
|
29
|
+
const diffMin = Math.floor(diffSec / 60);
|
|
30
|
+
const diffHour = Math.floor(diffMin / 60);
|
|
31
|
+
const diffDay = Math.floor(diffHour / 24);
|
|
32
|
+
|
|
33
|
+
if (diffSec < 60) return 'just now';
|
|
34
|
+
if (diffMin < 60) return `${diffMin}m ago`;
|
|
35
|
+
if (diffHour < 24) return `${diffHour}h ago`;
|
|
36
|
+
if (diffDay < 7) return `${diffDay}d ago`;
|
|
37
|
+
if (diffDay < 30) return `${Math.floor(diffDay / 7)}w ago`;
|
|
38
|
+
return formatDate(d, {
|
|
39
|
+
month: 'short',
|
|
40
|
+
day: 'numeric',
|
|
41
|
+
year: diffDay > 365 ? 'numeric' : undefined,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Truncate text with ellipsis */
|
|
46
|
+
export function truncate(text: string, maxLength: number): string {
|
|
47
|
+
if (text.length <= maxLength) return text;
|
|
48
|
+
return text.slice(0, maxLength).trimEnd() + '...';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Get initials from a name (e.g., "John Doe" → "JD") */
|
|
52
|
+
export function getInitials(name: string, maxChars = 2): string {
|
|
53
|
+
return name
|
|
54
|
+
.split(' ')
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
.map((part) => part[0]?.toUpperCase() || '')
|
|
57
|
+
.slice(0, maxChars)
|
|
58
|
+
.join('');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Debounce a function */
|
|
62
|
+
export function debounce<T extends (...args: unknown[]) => unknown>(
|
|
63
|
+
fn: T,
|
|
64
|
+
delayMs: number
|
|
65
|
+
): (...args: Parameters<T>) => void {
|
|
66
|
+
let timer: ReturnType<typeof setTimeout>;
|
|
67
|
+
return (...args: Parameters<T>) => {
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
timer = setTimeout(() => fn(...args), delayMs);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Sleep for a given number of milliseconds */
|
|
74
|
+
export function sleep(ms: number): Promise<void> {
|
|
75
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Safely parse JSON, returning null on failure */
|
|
79
|
+
export function safeJsonParse<T = unknown>(json: string): T | null {
|
|
80
|
+
try {
|
|
81
|
+
return JSON.parse(json) as T;
|
|
82
|
+
} catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Supabase Configuration
|
|
2
|
+
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
|
|
3
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
|
|
4
|
+
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
|
|
5
|
+
|
|
6
|
+
# AI Provider API Keys
|
|
7
|
+
OPENAI_API_KEY=sk-xxx
|
|
8
|
+
ANTHROPIC_API_KEY=sk-ant-xxx
|
|
9
|
+
|
|
10
|
+
# Stripe Configuration
|
|
11
|
+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxx
|
|
12
|
+
STRIPE_SECRET_KEY=sk_test_xxx
|
|
13
|
+
STRIPE_WEBHOOK_SECRET=whsec_xxx
|
|
14
|
+
|
|
15
|
+
# Application
|
|
16
|
+
NEXT_PUBLIC_APP_URL=http://localhost:3000
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# {{titleCaseName}}
|
|
2
|
+
|
|
3
|
+
{{description}} - An AI-powered platform for building intelligent applications.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **AI Chat** - Conversational AI with multiple model support
|
|
8
|
+
- **Model Selection** - Choose from GPT-4o, Claude, and more
|
|
9
|
+
- **API Access** - Programmatic access to AI models
|
|
10
|
+
- **Usage Dashboard** - Track API calls and token usage
|
|
11
|
+
- **Subscription Billing** - Stripe-powered payments
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
1. **Install dependencies:**
|
|
16
|
+
```bash
|
|
17
|
+
npm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. **Set up environment variables:**
|
|
21
|
+
```bash
|
|
22
|
+
cp .env.example .env.local
|
|
23
|
+
```
|
|
24
|
+
Update with your API keys:
|
|
25
|
+
- Supabase credentials
|
|
26
|
+
- OpenAI and/or Anthropic API keys
|
|
27
|
+
- Stripe keys (optional)
|
|
28
|
+
|
|
29
|
+
3. **Run the development server:**
|
|
30
|
+
```bash
|
|
31
|
+
npm run dev
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
4. **Open [http://localhost:3000](http://localhost:3000)**
|
|
35
|
+
|
|
36
|
+
## Tech Stack
|
|
37
|
+
|
|
38
|
+
- **Framework:** Next.js 15
|
|
39
|
+
- **Language:** TypeScript
|
|
40
|
+
- **Styling:** Tailwind CSS
|
|
41
|
+
- **Auth:** Supabase
|
|
42
|
+
- **AI:** Vercel AI SDK
|
|
43
|
+
- **Payments:** Stripe
|
|
44
|
+
- **UI Components:** @digilogiclabs/saas-factory-ui
|
|
45
|
+
|
|
46
|
+
## Project Structure
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
src/
|
|
50
|
+
├── app/ # Next.js App Router pages
|
|
51
|
+
│ ├── api/chat/ # Chat API route
|
|
52
|
+
│ ├── chat/ # AI chat interface
|
|
53
|
+
│ ├── dashboard/ # User dashboard
|
|
54
|
+
│ └── playground/ # AI playground
|
|
55
|
+
├── components/ # React components
|
|
56
|
+
│ ├── ai/ # AI-specific components
|
|
57
|
+
│ └── providers/ # Context providers
|
|
58
|
+
└── lib/ # Utilities and helpers
|
|
59
|
+
└── ai/ # AI utilities
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Adding AI Providers
|
|
63
|
+
|
|
64
|
+
To enable AI functionality, add your API keys to `.env.local`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# OpenAI
|
|
68
|
+
OPENAI_API_KEY=sk-xxx
|
|
69
|
+
|
|
70
|
+
# Anthropic
|
|
71
|
+
ANTHROPIC_API_KEY=sk-ant-xxx
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then update `src/app/api/chat/route.ts` to use the AI SDK.
|
|
75
|
+
|
|
76
|
+
## Deployment
|
|
77
|
+
|
|
78
|
+
Deploy to Vercel with one click:
|
|
79
|
+
|
|
80
|
+
[](https://vercel.com/new)
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT - Built with DLL Platform
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createServerClient } from '@supabase/ssr'
|
|
2
|
+
import { NextResponse, type NextRequest } from 'next/server'
|
|
3
|
+
|
|
4
|
+
export async function middleware(request: NextRequest) {
|
|
5
|
+
let supabaseResponse = NextResponse.next({
|
|
6
|
+
request,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const supabase = createServerClient(
|
|
10
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
11
|
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
12
|
+
{
|
|
13
|
+
cookies: {
|
|
14
|
+
getAll() {
|
|
15
|
+
return request.cookies.getAll()
|
|
16
|
+
},
|
|
17
|
+
setAll(cookiesToSet) {
|
|
18
|
+
cookiesToSet.forEach(({ name, value }) =>
|
|
19
|
+
request.cookies.set(name, value)
|
|
20
|
+
)
|
|
21
|
+
supabaseResponse = NextResponse.next({
|
|
22
|
+
request,
|
|
23
|
+
})
|
|
24
|
+
cookiesToSet.forEach(({ name, value, options }) =>
|
|
25
|
+
supabaseResponse.cookies.set(name, value, options)
|
|
26
|
+
)
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
data: { user },
|
|
34
|
+
} = await supabase.auth.getUser()
|
|
35
|
+
|
|
36
|
+
// Redirect to login if accessing protected route without auth
|
|
37
|
+
if (
|
|
38
|
+
!user &&
|
|
39
|
+
(request.nextUrl.pathname.startsWith('/dashboard') ||
|
|
40
|
+
request.nextUrl.pathname.startsWith('/chat') ||
|
|
41
|
+
request.nextUrl.pathname.startsWith('/playground'))
|
|
42
|
+
) {
|
|
43
|
+
const url = request.nextUrl.clone()
|
|
44
|
+
url.pathname = '/login'
|
|
45
|
+
return NextResponse.redirect(url)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return supabaseResponse
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const config = {
|
|
52
|
+
matcher: [
|
|
53
|
+
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
|
|
54
|
+
],
|
|
55
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "{{description}} - AI Platform",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "next dev",
|
|
8
|
+
"build": "next build",
|
|
9
|
+
"start": "next start",
|
|
10
|
+
"lint": "next lint",
|
|
11
|
+
"type-check": "tsc --noEmit",
|
|
12
|
+
"test": "vitest",
|
|
13
|
+
"test:run": "vitest run"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"next": "^15.0.0",
|
|
17
|
+
"react": "^19.0.0",
|
|
18
|
+
"react-dom": "^19.0.0",
|
|
19
|
+
"@digilogiclabs/platform-core": "^1.1.0",
|
|
20
|
+
"@digilogiclabs/app-sdk": "^1.0.0",
|
|
21
|
+
"@digilogiclabs/saas-factory-auth": "^1.0.7",
|
|
22
|
+
"@digilogiclabs/saas-factory-payments": "^1.2.9",
|
|
23
|
+
"@digilogiclabs/saas-factory-ai": "^1.0.0",
|
|
24
|
+
"@digilogiclabs/saas-factory-ui": "^1.0.1",
|
|
25
|
+
"ai": "^3.4.0",
|
|
26
|
+
"@ai-sdk/openai": "^0.0.70",
|
|
27
|
+
"@ai-sdk/anthropic": "^0.0.57",
|
|
28
|
+
"stripe": "^16.12.0",
|
|
29
|
+
"@stripe/react-stripe-js": "^2.8.0",
|
|
30
|
+
"@stripe/stripe-js": "^4.10.0",
|
|
31
|
+
"tailwindcss": "^4.0.0",
|
|
32
|
+
"clsx": "^2.0.0",
|
|
33
|
+
"class-variance-authority": "^0.7.0",
|
|
34
|
+
"tailwind-merge": "^2.0.0",
|
|
35
|
+
"next-themes": "^0.4.0",
|
|
36
|
+
"lucide-react": "^0.460.0",
|
|
37
|
+
"zod": "^3.22.4",
|
|
38
|
+
"zustand": "^4.5.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "^5.7.0",
|
|
42
|
+
"@types/node": "^22.0.0",
|
|
43
|
+
"@types/react": "^19.0.0",
|
|
44
|
+
"@types/react-dom": "^19.0.0",
|
|
45
|
+
"eslint": "^9.0.0",
|
|
46
|
+
"eslint-config-next": "^15.0.0",
|
|
47
|
+
"prettier": "^3.4.0",
|
|
48
|
+
"vitest": "^2.1.0",
|
|
49
|
+
"@testing-library/react": "^16.0.0",
|
|
50
|
+
"@testing-library/jest-dom": "^6.6.0"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20.0.0"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server'
|
|
2
|
+
|
|
3
|
+
// Note: In production, you would use the AI SDK here
|
|
4
|
+
// import { openai } from '@ai-sdk/openai'
|
|
5
|
+
// import { generateText } from 'ai'
|
|
6
|
+
|
|
7
|
+
export async function POST(request: NextRequest) {
|
|
8
|
+
try {
|
|
9
|
+
const { messages, model } = await request.json()
|
|
10
|
+
|
|
11
|
+
// Demo response - replace with actual AI SDK integration
|
|
12
|
+
// In production:
|
|
13
|
+
// const { text } = await generateText({
|
|
14
|
+
// model: openai(model),
|
|
15
|
+
// messages,
|
|
16
|
+
// })
|
|
17
|
+
|
|
18
|
+
// Simulated response for demo
|
|
19
|
+
const lastMessage = messages[messages.length - 1]?.content || ''
|
|
20
|
+
|
|
21
|
+
// Simple demo responses
|
|
22
|
+
let response = "I'm an AI assistant. How can I help you today?"
|
|
23
|
+
|
|
24
|
+
if (lastMessage.toLowerCase().includes('hello') || lastMessage.toLowerCase().includes('hi')) {
|
|
25
|
+
response = "Hello! I'm your AI assistant. I can help you with coding, writing, analysis, and much more. What would you like to explore today?"
|
|
26
|
+
} else if (lastMessage.toLowerCase().includes('code') || lastMessage.toLowerCase().includes('python')) {
|
|
27
|
+
response = `Here's a simple Python example:
|
|
28
|
+
|
|
29
|
+
\`\`\`python
|
|
30
|
+
def greet(name: str) -> str:
|
|
31
|
+
"""Return a greeting message."""
|
|
32
|
+
return f"Hello, {name}! Welcome to AI Platform."
|
|
33
|
+
|
|
34
|
+
# Usage
|
|
35
|
+
print(greet("Developer"))
|
|
36
|
+
\`\`\`
|
|
37
|
+
|
|
38
|
+
Would you like me to explain this code or help with something more specific?`
|
|
39
|
+
} else if (lastMessage.toLowerCase().includes('explain')) {
|
|
40
|
+
response = "I'd be happy to explain! Could you provide more details about what concept or topic you'd like me to clarify?"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return NextResponse.json({
|
|
44
|
+
content: response,
|
|
45
|
+
model,
|
|
46
|
+
})
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('Chat API error:', error)
|
|
49
|
+
return NextResponse.json(
|
|
50
|
+
{ error: 'Failed to process request' },
|
|
51
|
+
{ status: 500 }
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
}
|