@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,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
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useState, useRef, useEffect } from 'react'
|
|
4
|
+
import { Button, Card } from '@digilogiclabs/saas-factory-ui'
|
|
5
|
+
import { Send, Bot, User, Loader2, Sparkles } from 'lucide-react'
|
|
6
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
7
|
+
import Link from 'next/link'
|
|
8
|
+
|
|
9
|
+
interface Message {
|
|
10
|
+
id: string
|
|
11
|
+
role: 'user' | 'assistant'
|
|
12
|
+
content: string
|
|
13
|
+
timestamp: Date
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const MODELS = [
|
|
17
|
+
{ id: 'gpt-4o', name: 'GPT-4o', provider: 'OpenAI' },
|
|
18
|
+
{ id: 'claude-3-5-sonnet', name: 'Claude 3.5 Sonnet', provider: 'Anthropic' },
|
|
19
|
+
{ id: 'gpt-4o-mini', name: 'GPT-4o Mini', provider: 'OpenAI' },
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
export default function ChatPage() {
|
|
23
|
+
const { user, loading: authLoading } = useAuth()
|
|
24
|
+
const [messages, setMessages] = useState<Message[]>([])
|
|
25
|
+
const [input, setInput] = useState('')
|
|
26
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
27
|
+
const [selectedModel, setSelectedModel] = useState(MODELS[0].id)
|
|
28
|
+
const messagesEndRef = useRef<HTMLDivElement>(null)
|
|
29
|
+
|
|
30
|
+
const scrollToBottom = () => {
|
|
31
|
+
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' })
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
scrollToBottom()
|
|
36
|
+
}, [messages])
|
|
37
|
+
|
|
38
|
+
const handleSubmit = async (e: React.FormEvent) => {
|
|
39
|
+
e.preventDefault()
|
|
40
|
+
if (!input.trim() || isLoading) return
|
|
41
|
+
|
|
42
|
+
const userMessage: Message = {
|
|
43
|
+
id: Date.now().toString(),
|
|
44
|
+
role: 'user',
|
|
45
|
+
content: input,
|
|
46
|
+
timestamp: new Date(),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setMessages(prev => [...prev, userMessage])
|
|
50
|
+
setInput('')
|
|
51
|
+
setIsLoading(true)
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const response = await fetch('/api/chat', {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
headers: { 'Content-Type': 'application/json' },
|
|
57
|
+
body: JSON.stringify({
|
|
58
|
+
messages: [...messages, userMessage].map(m => ({
|
|
59
|
+
role: m.role,
|
|
60
|
+
content: m.content,
|
|
61
|
+
})),
|
|
62
|
+
model: selectedModel,
|
|
63
|
+
}),
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const data = await response.json()
|
|
67
|
+
|
|
68
|
+
const assistantMessage: Message = {
|
|
69
|
+
id: (Date.now() + 1).toString(),
|
|
70
|
+
role: 'assistant',
|
|
71
|
+
content: data.content || 'Sorry, I could not process your request.',
|
|
72
|
+
timestamp: new Date(),
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setMessages(prev => [...prev, assistantMessage])
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('Chat error:', error)
|
|
78
|
+
const errorMessage: Message = {
|
|
79
|
+
id: (Date.now() + 1).toString(),
|
|
80
|
+
role: 'assistant',
|
|
81
|
+
content: 'Sorry, there was an error processing your request. Please try again.',
|
|
82
|
+
timestamp: new Date(),
|
|
83
|
+
}
|
|
84
|
+
setMessages(prev => [...prev, errorMessage])
|
|
85
|
+
} finally {
|
|
86
|
+
setIsLoading(false)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (authLoading) {
|
|
91
|
+
return (
|
|
92
|
+
<div className="min-h-screen bg-slate-900 flex items-center justify-center">
|
|
93
|
+
<Loader2 className="w-8 h-8 text-purple-400 animate-spin" />
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!user) {
|
|
99
|
+
return (
|
|
100
|
+
<div className="min-h-screen bg-slate-900 flex items-center justify-center">
|
|
101
|
+
<Card className="p-8 bg-white/5 border-white/10 text-center max-w-md">
|
|
102
|
+
<Bot className="w-16 h-16 text-purple-400 mx-auto mb-4" />
|
|
103
|
+
<h2 className="text-2xl font-bold text-white mb-2">Sign in to Chat</h2>
|
|
104
|
+
<p className="text-gray-400 mb-6">
|
|
105
|
+
Create an account to start chatting with AI models.
|
|
106
|
+
</p>
|
|
107
|
+
<div className="flex gap-2 justify-center">
|
|
108
|
+
<Link href="/login">
|
|
109
|
+
<Button variant="outline" className="border-white/20 text-white">Sign In</Button>
|
|
110
|
+
</Link>
|
|
111
|
+
<Link href="/signup">
|
|
112
|
+
<Button className="bg-purple-600 hover:bg-purple-700">Sign Up</Button>
|
|
113
|
+
</Link>
|
|
114
|
+
</div>
|
|
115
|
+
</Card>
|
|
116
|
+
</div>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div className="h-screen bg-slate-900 flex flex-col">
|
|
122
|
+
{/* Header */}
|
|
123
|
+
<header className="border-b border-white/10 bg-black/20 px-4 py-3">
|
|
124
|
+
<div className="max-w-4xl mx-auto flex items-center justify-between">
|
|
125
|
+
<div className="flex items-center gap-2">
|
|
126
|
+
<Link href="/" className="flex items-center gap-2 text-white">
|
|
127
|
+
<Bot className="w-6 h-6 text-purple-400" />
|
|
128
|
+
<span className="font-bold">AI Chat</span>
|
|
129
|
+
</Link>
|
|
130
|
+
</div>
|
|
131
|
+
<select
|
|
132
|
+
value={selectedModel}
|
|
133
|
+
onChange={(e) => setSelectedModel(e.target.value)}
|
|
134
|
+
className="bg-white/10 border border-white/20 rounded-lg px-3 py-1.5 text-white text-sm focus:ring-2 focus:ring-purple-500"
|
|
135
|
+
>
|
|
136
|
+
{MODELS.map((model) => (
|
|
137
|
+
<option key={model.id} value={model.id} className="bg-slate-800">
|
|
138
|
+
{model.name}
|
|
139
|
+
</option>
|
|
140
|
+
))}
|
|
141
|
+
</select>
|
|
142
|
+
</div>
|
|
143
|
+
</header>
|
|
144
|
+
|
|
145
|
+
{/* Messages */}
|
|
146
|
+
<div className="flex-1 overflow-y-auto px-4 py-6">
|
|
147
|
+
<div className="max-w-4xl mx-auto space-y-6">
|
|
148
|
+
{messages.length === 0 && (
|
|
149
|
+
<div className="text-center py-20">
|
|
150
|
+
<Sparkles className="w-16 h-16 text-purple-400 mx-auto mb-4" />
|
|
151
|
+
<h2 className="text-2xl font-bold text-white mb-2">Start a Conversation</h2>
|
|
152
|
+
<p className="text-gray-400">Ask me anything or try one of these prompts:</p>
|
|
153
|
+
<div className="flex flex-wrap gap-2 justify-center mt-4">
|
|
154
|
+
{['Explain quantum computing', 'Write a Python function', 'Help me brainstorm'].map((prompt) => (
|
|
155
|
+
<button
|
|
156
|
+
key={prompt}
|
|
157
|
+
onClick={() => setInput(prompt)}
|
|
158
|
+
className="px-4 py-2 bg-white/5 border border-white/10 rounded-lg text-gray-300 hover:bg-white/10 transition text-sm"
|
|
159
|
+
>
|
|
160
|
+
{prompt}
|
|
161
|
+
</button>
|
|
162
|
+
))}
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
|
|
167
|
+
{messages.map((message) => (
|
|
168
|
+
<div
|
|
169
|
+
key={message.id}
|
|
170
|
+
className={`flex gap-4 ${message.role === 'user' ? 'justify-end' : ''}`}
|
|
171
|
+
>
|
|
172
|
+
{message.role === 'assistant' && (
|
|
173
|
+
<div className="w-8 h-8 rounded-lg bg-purple-500/20 flex items-center justify-center flex-shrink-0">
|
|
174
|
+
<Bot className="w-5 h-5 text-purple-400" />
|
|
175
|
+
</div>
|
|
176
|
+
)}
|
|
177
|
+
<div
|
|
178
|
+
className={`max-w-2xl rounded-lg px-4 py-3 ${
|
|
179
|
+
message.role === 'user'
|
|
180
|
+
? 'bg-purple-600 text-white'
|
|
181
|
+
: 'bg-white/5 text-gray-200'
|
|
182
|
+
}`}
|
|
183
|
+
>
|
|
184
|
+
<p className="whitespace-pre-wrap">{message.content}</p>
|
|
185
|
+
</div>
|
|
186
|
+
{message.role === 'user' && (
|
|
187
|
+
<div className="w-8 h-8 rounded-lg bg-blue-500/20 flex items-center justify-center flex-shrink-0">
|
|
188
|
+
<User className="w-5 h-5 text-blue-400" />
|
|
189
|
+
</div>
|
|
190
|
+
)}
|
|
191
|
+
</div>
|
|
192
|
+
))}
|
|
193
|
+
|
|
194
|
+
{isLoading && (
|
|
195
|
+
<div className="flex gap-4">
|
|
196
|
+
<div className="w-8 h-8 rounded-lg bg-purple-500/20 flex items-center justify-center">
|
|
197
|
+
<Bot className="w-5 h-5 text-purple-400" />
|
|
198
|
+
</div>
|
|
199
|
+
<div className="bg-white/5 rounded-lg px-4 py-3">
|
|
200
|
+
<Loader2 className="w-5 h-5 text-purple-400 animate-spin" />
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
)}
|
|
204
|
+
|
|
205
|
+
<div ref={messagesEndRef} />
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
{/* Input */}
|
|
210
|
+
<div className="border-t border-white/10 bg-black/20 px-4 py-4">
|
|
211
|
+
<form onSubmit={handleSubmit} className="max-w-4xl mx-auto flex gap-2">
|
|
212
|
+
<input
|
|
213
|
+
type="text"
|
|
214
|
+
value={input}
|
|
215
|
+
onChange={(e) => setInput(e.target.value)}
|
|
216
|
+
placeholder="Type your message..."
|
|
217
|
+
className="flex-1 bg-white/10 border border-white/20 rounded-lg px-4 py-2 text-white placeholder-gray-400 focus:ring-2 focus:ring-purple-500 focus:border-transparent"
|
|
218
|
+
disabled={isLoading}
|
|
219
|
+
/>
|
|
220
|
+
<Button
|
|
221
|
+
type="submit"
|
|
222
|
+
disabled={!input.trim() || isLoading}
|
|
223
|
+
className="bg-purple-600 hover:bg-purple-700"
|
|
224
|
+
>
|
|
225
|
+
{isLoading ? (
|
|
226
|
+
<Loader2 className="w-5 h-5 animate-spin" />
|
|
227
|
+
) : (
|
|
228
|
+
<Send className="w-5 h-5" />
|
|
229
|
+
)}
|
|
230
|
+
</Button>
|
|
231
|
+
</form>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Suspense } from 'react'
|
|
2
|
+
import { Button, Card } from '@digilogiclabs/saas-factory-ui'
|
|
3
|
+
import { MessageSquare, Zap, Key, CreditCard, BarChart, Settings } from 'lucide-react'
|
|
4
|
+
import { requireAuth } from '@/lib/auth-server'
|
|
5
|
+
import Link from 'next/link'
|
|
6
|
+
|
|
7
|
+
async function getUsageStats(userId: string) {
|
|
8
|
+
await new Promise(resolve => setTimeout(resolve, 100))
|
|
9
|
+
return {
|
|
10
|
+
apiCalls: 1234,
|
|
11
|
+
tokensUsed: 45678,
|
|
12
|
+
modelsUsed: 3,
|
|
13
|
+
creditsRemaining: 850,
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function StatCard({ title, value, icon: Icon, description }: {
|
|
18
|
+
title: string
|
|
19
|
+
value: string | number
|
|
20
|
+
icon: React.ComponentType<{ className?: string }>
|
|
21
|
+
description?: string
|
|
22
|
+
}) {
|
|
23
|
+
return (
|
|
24
|
+
<Card className="p-6 bg-white/5 border-white/10">
|
|
25
|
+
<div className="flex items-center justify-between">
|
|
26
|
+
<div>
|
|
27
|
+
<p className="text-sm font-medium text-gray-400">{title}</p>
|
|
28
|
+
<p className="text-2xl font-bold text-white">{value}</p>
|
|
29
|
+
{description && <p className="text-xs text-gray-500 mt-1">{description}</p>}
|
|
30
|
+
</div>
|
|
31
|
+
<div className="w-12 h-12 bg-purple-500/20 rounded-lg flex items-center justify-center">
|
|
32
|
+
<Icon className="h-6 w-6 text-purple-400" />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</Card>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function UsageStats({ userId }: { userId: string }) {
|
|
40
|
+
const stats = await getUsageStats(userId)
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
|
|
44
|
+
<StatCard title="API Calls" value={stats.apiCalls.toLocaleString()} icon={Zap} description="This month" />
|
|
45
|
+
<StatCard title="Tokens Used" value={`${(stats.tokensUsed / 1000).toFixed(1)}K`} icon={MessageSquare} description="This month" />
|
|
46
|
+
<StatCard title="Models Used" value={stats.modelsUsed} icon={BarChart} />
|
|
47
|
+
<StatCard title="Credits" value={stats.creditsRemaining} icon={CreditCard} description="Remaining" />
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function StatsSkeleton() {
|
|
53
|
+
return (
|
|
54
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
|
|
55
|
+
{[...Array(4)].map((_, i) => (
|
|
56
|
+
<Card key={i} className="p-6 bg-white/5 border-white/10">
|
|
57
|
+
<div className="animate-pulse">
|
|
58
|
+
<div className="h-4 bg-gray-700 rounded w-1/2 mb-2"></div>
|
|
59
|
+
<div className="h-8 bg-gray-700 rounded w-1/3"></div>
|
|
60
|
+
</div>
|
|
61
|
+
</Card>
|
|
62
|
+
))}
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default async function DashboardPage() {
|
|
68
|
+
const user = await requireAuth()
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div className="min-h-screen bg-slate-900">
|
|
72
|
+
<div className="max-w-7xl mx-auto px-4 py-8">
|
|
73
|
+
{/* Header */}
|
|
74
|
+
<div className="flex items-center justify-between mb-8">
|
|
75
|
+
<div>
|
|
76
|
+
<h1 className="text-3xl font-bold text-white">Dashboard</h1>
|
|
77
|
+
<p className="text-gray-400 mt-1">Welcome back, {user.name || user.email}</p>
|
|
78
|
+
</div>
|
|
79
|
+
<Link href="/chat">
|
|
80
|
+
<Button className="bg-purple-600 hover:bg-purple-700">
|
|
81
|
+
<MessageSquare className="w-4 h-4 mr-2" />
|
|
82
|
+
New Chat
|
|
83
|
+
</Button>
|
|
84
|
+
</Link>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
{/* Stats */}
|
|
88
|
+
<Suspense fallback={<StatsSkeleton />}>
|
|
89
|
+
<UsageStats userId={user.id} />
|
|
90
|
+
</Suspense>
|
|
91
|
+
|
|
92
|
+
{/* Quick Actions */}
|
|
93
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
|
|
94
|
+
<Card className="p-6 bg-white/5 border-white/10">
|
|
95
|
+
<div className="flex items-center mb-4">
|
|
96
|
+
<Key className="h-6 w-6 text-purple-400 mr-3" />
|
|
97
|
+
<h3 className="text-lg font-semibold text-white">API Keys</h3>
|
|
98
|
+
</div>
|
|
99
|
+
<p className="text-gray-400 mb-4">
|
|
100
|
+
Manage your API keys for programmatic access.
|
|
101
|
+
</p>
|
|
102
|
+
<Button className="w-full" variant="outline">Manage Keys</Button>
|
|
103
|
+
</Card>
|
|
104
|
+
|
|
105
|
+
<Card className="p-6 bg-white/5 border-white/10">
|
|
106
|
+
<div className="flex items-center mb-4">
|
|
107
|
+
<CreditCard className="h-6 w-6 text-purple-400 mr-3" />
|
|
108
|
+
<h3 className="text-lg font-semibold text-white">Billing</h3>
|
|
109
|
+
</div>
|
|
110
|
+
<p className="text-gray-400 mb-4">
|
|
111
|
+
View usage and manage your subscription.
|
|
112
|
+
</p>
|
|
113
|
+
<Button className="w-full" variant="outline">View Billing</Button>
|
|
114
|
+
</Card>
|
|
115
|
+
|
|
116
|
+
<Card className="p-6 bg-white/5 border-white/10">
|
|
117
|
+
<div className="flex items-center mb-4">
|
|
118
|
+
<Settings className="h-6 w-6 text-purple-400 mr-3" />
|
|
119
|
+
<h3 className="text-lg font-semibold text-white">Settings</h3>
|
|
120
|
+
</div>
|
|
121
|
+
<p className="text-gray-400 mb-4">
|
|
122
|
+
Configure your account preferences.
|
|
123
|
+
</p>
|
|
124
|
+
<Button className="w-full" variant="outline">Open Settings</Button>
|
|
125
|
+
</Card>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
{/* Recent Activity */}
|
|
129
|
+
<Card className="p-6 bg-white/5 border-white/10">
|
|
130
|
+
<h3 className="text-lg font-semibold text-white mb-4">Recent Conversations</h3>
|
|
131
|
+
<div className="text-center py-8 text-gray-500">
|
|
132
|
+
<MessageSquare className="w-12 h-12 mx-auto mb-4 opacity-50" />
|
|
133
|
+
<p>No recent conversations. Start a new chat!</p>
|
|
134
|
+
<Link href="/chat">
|
|
135
|
+
<Button className="mt-4 bg-purple-600 hover:bg-purple-700">Start Chatting</Button>
|
|
136
|
+
</Link>
|
|
137
|
+
</div>
|
|
138
|
+
</Card>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
@theme {
|
|
4
|
+
--color-primary: oklch(60% 0.25 295);
|
|
5
|
+
--color-background: oklch(15% 0.02 256);
|
|
6
|
+
--color-foreground: oklch(95% 0 0);
|
|
7
|
+
--font-sans: 'Inter', system-ui, sans-serif;
|
|
8
|
+
--radius: 0.5rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
body {
|
|
12
|
+
font-family: var(--font-sans);
|
|
13
|
+
background-color: var(--color-background);
|
|
14
|
+
color: var(--color-foreground);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Custom scrollbar for dark theme */
|
|
18
|
+
::-webkit-scrollbar {
|
|
19
|
+
width: 8px;
|
|
20
|
+
height: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
::-webkit-scrollbar-track {
|
|
24
|
+
background: rgba(255, 255, 255, 0.05);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
::-webkit-scrollbar-thumb {
|
|
28
|
+
background: rgba(255, 255, 255, 0.2);
|
|
29
|
+
border-radius: 4px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
::-webkit-scrollbar-thumb:hover {
|
|
33
|
+
background: rgba(255, 255, 255, 0.3);
|
|
34
|
+
}
|