@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,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drizzle ORM Schema
|
|
3
|
+
*
|
|
4
|
+
* Define your database tables here. Each app uses its own schema namespace
|
|
5
|
+
* for isolation when sharing a PostgreSQL instance.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { db } from '@/lib/db/drizzle';
|
|
9
|
+
* import { users } from '@/lib/db/schema';
|
|
10
|
+
* const allUsers = await db.select().from(users);
|
|
11
|
+
*
|
|
12
|
+
* Generate migrations:
|
|
13
|
+
* npx drizzle-kit generate
|
|
14
|
+
*
|
|
15
|
+
* Apply migrations:
|
|
16
|
+
* npx drizzle-kit push
|
|
17
|
+
*/
|
|
18
|
+
import { pgTable, text, timestamp, boolean } from 'drizzle-orm/pg-core';
|
|
19
|
+
// import { pgSchema } from 'drizzle-orm/pg-core'; // Uncomment for schema isolation
|
|
20
|
+
|
|
21
|
+
// Use a schema namespace for isolation (recommended for multi-app databases)
|
|
22
|
+
// export const appSchema = pgSchema('myapp');
|
|
23
|
+
// export const users = appSchema.table('users', { ... });
|
|
24
|
+
|
|
25
|
+
// Or use public schema (simpler for single-app databases)
|
|
26
|
+
export const users = pgTable('users', {
|
|
27
|
+
id: text('id').primaryKey(),
|
|
28
|
+
email: text('email').notNull().unique(),
|
|
29
|
+
name: text('name'),
|
|
30
|
+
emailVerified: boolean('email_verified').default(false),
|
|
31
|
+
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
|
32
|
+
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
|
|
33
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createBrowserClient } from '@supabase/ssr';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Supabase client for use in Client Components.
|
|
5
|
+
* Uses browser-side auth (reads cookies automatically).
|
|
6
|
+
*/
|
|
7
|
+
export function createClient() {
|
|
8
|
+
return createBrowserClient(
|
|
9
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
10
|
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createServerClient } from '@supabase/ssr';
|
|
2
|
+
import { cookies } from 'next/headers';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Supabase client for use in Server Components, Route Handlers, and Server Actions.
|
|
6
|
+
* Reads and writes auth cookies via Next.js cookies() API.
|
|
7
|
+
*/
|
|
8
|
+
export async function createClient() {
|
|
9
|
+
const cookieStore = await cookies();
|
|
10
|
+
|
|
11
|
+
return createServerClient(
|
|
12
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
13
|
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
14
|
+
{
|
|
15
|
+
cookies: {
|
|
16
|
+
getAll() {
|
|
17
|
+
return cookieStore.getAll();
|
|
18
|
+
},
|
|
19
|
+
setAll(cookiesToSet) {
|
|
20
|
+
try {
|
|
21
|
+
cookiesToSet.forEach(({ name, value, options }) =>
|
|
22
|
+
cookieStore.set(name, value, options)
|
|
23
|
+
);
|
|
24
|
+
} catch {
|
|
25
|
+
// Called from a Server Component — cookies are read-only
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
import { createClient } from '@supabase/supabase-js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Supabase admin client with service_role key.
|
|
6
|
+
* Bypasses Row Level Security — use only in trusted server-side code
|
|
7
|
+
* (webhooks, cron jobs, admin operations).
|
|
8
|
+
*/
|
|
9
|
+
export function createServiceClient() {
|
|
10
|
+
return createClient(
|
|
11
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
12
|
+
process.env.SUPABASE_SERVICE_ROLE_KEY!,
|
|
13
|
+
{ auth: { persistSession: false } }
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EmailBranding } from '@digilogiclabs/platform-core/email-templates';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* App branding for shared email templates.
|
|
5
|
+
* Used by platform-core's email template functions (welcomeEmail, notificationEmail, etc.)
|
|
6
|
+
*
|
|
7
|
+
* Update these values to match your app's branding.
|
|
8
|
+
*/
|
|
9
|
+
export const APP_BRANDING: EmailBranding = {
|
|
10
|
+
appName: 'My App',
|
|
11
|
+
primaryColor: '#3b82f6',
|
|
12
|
+
gradientFrom: '#3b82f6',
|
|
13
|
+
gradientTo: '#8b5cf6',
|
|
14
|
+
fromEmail: 'noreply@example.com',
|
|
15
|
+
supportEmail: 'support@example.com',
|
|
16
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000',
|
|
17
|
+
footerText: 'Built with Digi Logic Labs platform',
|
|
18
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email client singleton.
|
|
3
|
+
*
|
|
4
|
+
* Lazy-initializes a Resend client when first needed.
|
|
5
|
+
* Returns null gracefully if RESEND_API_KEY is not configured.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { sendEmail } from '@/lib/email/client';
|
|
9
|
+
* await sendEmail({ to: 'user@example.com', subject: 'Hello', html: '<p>Hi</p>' });
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
let resendClient: Resend | null = null;
|
|
13
|
+
let initialized = false;
|
|
14
|
+
|
|
15
|
+
type Resend = {
|
|
16
|
+
emails: {
|
|
17
|
+
send: (params: {
|
|
18
|
+
from: string;
|
|
19
|
+
to: string | string[];
|
|
20
|
+
subject: string;
|
|
21
|
+
html: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
replyTo?: string;
|
|
24
|
+
}) => Promise<{ data: { id: string } | null; error: { message: string } | null }>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function getResend(): Resend | null {
|
|
29
|
+
if (initialized) return resendClient;
|
|
30
|
+
initialized = true;
|
|
31
|
+
|
|
32
|
+
const apiKey = process.env.RESEND_API_KEY;
|
|
33
|
+
if (!apiKey) {
|
|
34
|
+
console.warn('[Email] RESEND_API_KEY not configured — emails will be logged to console');
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
// Dynamic import to avoid requiring resend in all environments
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
41
|
+
const { Resend } = require('resend');
|
|
42
|
+
resendClient = new Resend(apiKey);
|
|
43
|
+
return resendClient;
|
|
44
|
+
} catch {
|
|
45
|
+
console.warn('[Email] resend package not installed — emails will be logged to console');
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const DEFAULT_FROM = process.env.EMAIL_FROM || 'noreply@example.com';
|
|
51
|
+
|
|
52
|
+
interface EmailParams {
|
|
53
|
+
to: string | string[];
|
|
54
|
+
subject: string;
|
|
55
|
+
html: string;
|
|
56
|
+
text?: string;
|
|
57
|
+
from?: string;
|
|
58
|
+
replyTo?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Send an email via Resend. Returns true on success, false on failure.
|
|
63
|
+
* Falls back to console logging in development or when Resend is not configured.
|
|
64
|
+
*/
|
|
65
|
+
export async function sendEmail(params: EmailParams): Promise<boolean> {
|
|
66
|
+
const from = params.from || DEFAULT_FROM;
|
|
67
|
+
const resend = getResend();
|
|
68
|
+
|
|
69
|
+
if (!resend) {
|
|
70
|
+
if (process.env.NODE_ENV === 'development') {
|
|
71
|
+
console.log('[Email] Would send:', { to: params.to, subject: params.subject, from });
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const { error } = await resend.emails.send({
|
|
78
|
+
from,
|
|
79
|
+
to: params.to,
|
|
80
|
+
subject: params.subject,
|
|
81
|
+
html: params.html,
|
|
82
|
+
text: params.text,
|
|
83
|
+
replyTo: params.replyTo,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (error) {
|
|
87
|
+
console.error('[Email] Send failed:', error.message);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return true;
|
|
92
|
+
} catch (err) {
|
|
93
|
+
console.error('[Email] Send error:', err);
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error boundary page.
|
|
5
|
+
*
|
|
6
|
+
* Catches runtime errors in the app and shows a recovery UI.
|
|
7
|
+
* Shows error details in development mode only.
|
|
8
|
+
*/
|
|
9
|
+
export default function Error({
|
|
10
|
+
error,
|
|
11
|
+
reset,
|
|
12
|
+
}: {
|
|
13
|
+
error: Error & { digest?: string };
|
|
14
|
+
reset: () => void;
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<main className="flex min-h-screen items-center justify-center bg-white px-4 dark:bg-gray-950">
|
|
18
|
+
<div className="text-center">
|
|
19
|
+
<div className="mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30">
|
|
20
|
+
<svg
|
|
21
|
+
className="h-8 w-8 text-red-600 dark:text-red-400"
|
|
22
|
+
fill="none"
|
|
23
|
+
viewBox="0 0 24 24"
|
|
24
|
+
strokeWidth="1.5"
|
|
25
|
+
stroke="currentColor"
|
|
26
|
+
>
|
|
27
|
+
<path
|
|
28
|
+
strokeLinecap="round"
|
|
29
|
+
strokeLinejoin="round"
|
|
30
|
+
d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"
|
|
31
|
+
/>
|
|
32
|
+
</svg>
|
|
33
|
+
</div>
|
|
34
|
+
<h1 className="text-2xl font-semibold text-gray-900 dark:text-white">
|
|
35
|
+
Something went wrong
|
|
36
|
+
</h1>
|
|
37
|
+
<p className="mt-2 max-w-md text-gray-600 dark:text-gray-400">
|
|
38
|
+
An unexpected error occurred. Please try again.
|
|
39
|
+
</p>
|
|
40
|
+
{error.digest && (
|
|
41
|
+
<p className="mt-1 text-xs text-gray-400 dark:text-gray-500">
|
|
42
|
+
Error ID: {error.digest}
|
|
43
|
+
</p>
|
|
44
|
+
)}
|
|
45
|
+
|
|
46
|
+
{process.env.NODE_ENV === 'development' && (
|
|
47
|
+
<pre className="mx-auto mt-4 max-w-lg overflow-auto rounded-lg bg-gray-100 p-4 text-left text-xs text-red-600 dark:bg-gray-900 dark:text-red-400">
|
|
48
|
+
{error.message}
|
|
49
|
+
{error.stack && `\n\n${error.stack}`}
|
|
50
|
+
</pre>
|
|
51
|
+
)}
|
|
52
|
+
|
|
53
|
+
<div className="mt-8 flex items-center justify-center gap-4">
|
|
54
|
+
<button
|
|
55
|
+
onClick={reset}
|
|
56
|
+
className="rounded-lg bg-blue-600 px-5 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700"
|
|
57
|
+
>
|
|
58
|
+
Try Again
|
|
59
|
+
</button>
|
|
60
|
+
<a
|
|
61
|
+
href="/"
|
|
62
|
+
className="rounded-lg border border-gray-300 px-5 py-2.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800"
|
|
63
|
+
>
|
|
64
|
+
Go Home
|
|
65
|
+
</a>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</main>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Root error boundary.
|
|
5
|
+
*
|
|
6
|
+
* This is the last-resort error handler that catches errors in the root layout.
|
|
7
|
+
* It must render its own <html> and <body> tags since it replaces the entire page.
|
|
8
|
+
* Uses inline styles only — no framework CSS is available at this level.
|
|
9
|
+
*/
|
|
10
|
+
export default function GlobalError({
|
|
11
|
+
error,
|
|
12
|
+
reset,
|
|
13
|
+
}: {
|
|
14
|
+
error: Error & { digest?: string };
|
|
15
|
+
reset: () => void;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<html lang="en">
|
|
19
|
+
<body
|
|
20
|
+
style={{
|
|
21
|
+
margin: 0,
|
|
22
|
+
minHeight: '100vh',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
fontFamily:
|
|
27
|
+
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
28
|
+
backgroundColor: '#fafafa',
|
|
29
|
+
color: '#111',
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<div style={{ textAlign: 'center', padding: '2rem' }}>
|
|
33
|
+
<div
|
|
34
|
+
style={{
|
|
35
|
+
width: 64,
|
|
36
|
+
height: 64,
|
|
37
|
+
margin: '0 auto 1rem',
|
|
38
|
+
borderRadius: '50%',
|
|
39
|
+
backgroundColor: '#fee2e2',
|
|
40
|
+
display: 'flex',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
fontSize: 32,
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
!
|
|
47
|
+
</div>
|
|
48
|
+
<h1 style={{ fontSize: '1.5rem', fontWeight: 600, margin: 0 }}>
|
|
49
|
+
Something went wrong
|
|
50
|
+
</h1>
|
|
51
|
+
<p style={{ color: '#666', marginTop: '0.5rem' }}>
|
|
52
|
+
A critical error occurred. Please try reloading the page.
|
|
53
|
+
</p>
|
|
54
|
+
{error.digest && (
|
|
55
|
+
<p style={{ color: '#999', fontSize: '0.75rem', marginTop: '0.25rem' }}>
|
|
56
|
+
Error ID: {error.digest}
|
|
57
|
+
</p>
|
|
58
|
+
)}
|
|
59
|
+
<div
|
|
60
|
+
style={{
|
|
61
|
+
marginTop: '2rem',
|
|
62
|
+
display: 'flex',
|
|
63
|
+
gap: '1rem',
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<button
|
|
68
|
+
onClick={reset}
|
|
69
|
+
style={{
|
|
70
|
+
padding: '0.625rem 1.25rem',
|
|
71
|
+
backgroundColor: '#2563eb',
|
|
72
|
+
color: 'white',
|
|
73
|
+
border: 'none',
|
|
74
|
+
borderRadius: '0.5rem',
|
|
75
|
+
cursor: 'pointer',
|
|
76
|
+
fontSize: '0.875rem',
|
|
77
|
+
fontWeight: 500,
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
Try Again
|
|
81
|
+
</button>
|
|
82
|
+
<a
|
|
83
|
+
href="/"
|
|
84
|
+
style={{
|
|
85
|
+
padding: '0.625rem 1.25rem',
|
|
86
|
+
backgroundColor: 'white',
|
|
87
|
+
color: '#374151',
|
|
88
|
+
border: '1px solid #d1d5db',
|
|
89
|
+
borderRadius: '0.5rem',
|
|
90
|
+
textDecoration: 'none',
|
|
91
|
+
fontSize: '0.875rem',
|
|
92
|
+
fontWeight: 500,
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
Go Home
|
|
96
|
+
</a>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</body>
|
|
100
|
+
</html>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Custom 404 page.
|
|
5
|
+
*
|
|
6
|
+
* Shown when a route is not found. Uses Tailwind CSS for styling.
|
|
7
|
+
* Customize the links and messaging to match your app.
|
|
8
|
+
*/
|
|
9
|
+
export default function NotFound() {
|
|
10
|
+
return (
|
|
11
|
+
<main className="flex min-h-screen items-center justify-center bg-white px-4 dark:bg-gray-950">
|
|
12
|
+
<div className="text-center">
|
|
13
|
+
<p className="bg-gradient-to-r from-blue-500 to-purple-600 bg-clip-text text-8xl font-bold text-transparent">
|
|
14
|
+
404
|
|
15
|
+
</p>
|
|
16
|
+
<h1 className="mt-4 text-2xl font-semibold text-gray-900 dark:text-white">
|
|
17
|
+
Page not found
|
|
18
|
+
</h1>
|
|
19
|
+
<p className="mt-2 max-w-md text-gray-600 dark:text-gray-400">
|
|
20
|
+
The page you're looking for doesn't exist or has been moved.
|
|
21
|
+
</p>
|
|
22
|
+
<div className="mt-8 flex items-center justify-center gap-4">
|
|
23
|
+
<Link
|
|
24
|
+
href="/"
|
|
25
|
+
className="rounded-lg bg-blue-600 px-5 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700"
|
|
26
|
+
>
|
|
27
|
+
Go Home
|
|
28
|
+
</Link>
|
|
29
|
+
<Link
|
|
30
|
+
href="/dashboard"
|
|
31
|
+
className="rounded-lg border border-gray-300 px-5 py-2.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800"
|
|
32
|
+
>
|
|
33
|
+
Dashboard
|
|
34
|
+
</Link>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</main>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
export const dynamic = 'force-dynamic';
|
|
4
|
+
|
|
5
|
+
interface ServiceHealth {
|
|
6
|
+
status: 'up' | 'down' | 'unknown';
|
|
7
|
+
responseTime?: number;
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* GET /api/health
|
|
13
|
+
*
|
|
14
|
+
* Non-destructive health check for monitoring (Uptime Kuma, Coolify, K8s probes).
|
|
15
|
+
* Returns 200 if healthy, 503 if degraded/unhealthy.
|
|
16
|
+
*/
|
|
17
|
+
export async function GET() {
|
|
18
|
+
const services: Record<string, ServiceHealth> = {};
|
|
19
|
+
const details: string[] = [];
|
|
20
|
+
|
|
21
|
+
// Check database connectivity
|
|
22
|
+
try {
|
|
23
|
+
const start = Date.now();
|
|
24
|
+
// Replace with your database check — e.g. a simple SELECT 1
|
|
25
|
+
const dbUrl = process.env.DATABASE_URL;
|
|
26
|
+
services.database = dbUrl
|
|
27
|
+
? { status: 'up', responseTime: Date.now() - start }
|
|
28
|
+
: { status: 'down', error: 'DATABASE_URL not configured' };
|
|
29
|
+
} catch {
|
|
30
|
+
services.database = { status: 'down', error: 'Database connection failed' };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check Redis connectivity
|
|
34
|
+
try {
|
|
35
|
+
const start = Date.now();
|
|
36
|
+
const redisUrl = process.env.REDIS_URL;
|
|
37
|
+
services.cache = redisUrl
|
|
38
|
+
? { status: 'up', responseTime: Date.now() - start }
|
|
39
|
+
: { status: 'unknown', error: 'REDIS_URL not configured (optional)' };
|
|
40
|
+
} catch {
|
|
41
|
+
services.cache = { status: 'down', error: 'Cache connection failed' };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Check email service
|
|
45
|
+
services.email = process.env.RESEND_API_KEY
|
|
46
|
+
? { status: 'up' }
|
|
47
|
+
: { status: 'unknown', error: 'RESEND_API_KEY not configured' };
|
|
48
|
+
|
|
49
|
+
// Determine overall status
|
|
50
|
+
const dbDown = services.database?.status === 'down';
|
|
51
|
+
let status: 'healthy' | 'degraded' | 'unhealthy';
|
|
52
|
+
|
|
53
|
+
if (dbDown) {
|
|
54
|
+
status = 'unhealthy';
|
|
55
|
+
details.push('Database is down — critical service unavailable');
|
|
56
|
+
} else if (Object.values(services).some((s) => s.status === 'down')) {
|
|
57
|
+
status = 'degraded';
|
|
58
|
+
details.push('Some services degraded');
|
|
59
|
+
} else {
|
|
60
|
+
status = 'healthy';
|
|
61
|
+
details.push('All systems operational');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return NextResponse.json(
|
|
65
|
+
{ status, timestamp: new Date().toISOString(), services, details },
|
|
66
|
+
{ status: status === 'healthy' ? 200 : 503 }
|
|
67
|
+
);
|
|
68
|
+
}
|