create-ej-app 25.0.0 → 27.0.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/README.md +125 -226
- package/cli.ts +83 -28
- package/package.json +2 -2
- package/template/api/.vscode/settings.json +1 -1
- package/template/api/{.github/copilot-instructions.md → AGENTS.md} +0 -2
- package/template/api/CLAUDE.md +1 -0
- package/template/api/package.json +10 -10
- package/template/nextjs/.dockerignore +1 -0
- package/template/nextjs/AGENTS.md +260 -0
- package/template/nextjs/CLAUDE.md +1 -0
- package/template/nextjs/README.md +109 -0
- package/template/nextjs/bunfig.toml +3 -0
- package/template/nextjs/eslint.config.mjs +6 -5
- package/template/nextjs/gitignore +6 -0
- package/template/nextjs/next.config.ts +8 -1
- package/template/nextjs/package.json +47 -40
- package/template/nextjs/public/logo-dark.svg +4 -0
- package/template/nextjs/public/logo.svg +4 -0
- package/template/nextjs/src/app/(admin)/actions/users.ts +183 -0
- package/template/nextjs/src/app/(admin)/admin/_components/admin-header.tsx +24 -0
- package/template/nextjs/src/app/(admin)/admin/_components/admin-search.tsx +16 -0
- package/template/nextjs/src/app/(admin)/admin/_components/admin-sidebar.tsx +42 -0
- package/template/nextjs/src/app/(admin)/admin/layout.tsx +53 -0
- package/template/nextjs/src/app/(admin)/admin/page.tsx +11 -2
- package/template/nextjs/src/app/(admin)/admin/settings/layout.tsx +24 -0
- package/template/nextjs/src/app/(admin)/admin/settings/users/[userId]/page.tsx +43 -0
- package/template/nextjs/src/app/(admin)/admin/settings/users/new/page.tsx +16 -0
- package/template/nextjs/src/app/(admin)/admin/settings/users/page.tsx +377 -0
- package/template/nextjs/src/app/(admin)/admin/settings/users/user-form.tsx +138 -0
- package/template/nextjs/src/app/(admin)/admin/settings/users/validation.ts +23 -0
- package/template/nextjs/src/app/(app)/app/layout.tsx +44 -0
- package/template/nextjs/src/app/(app)/app/page.tsx +14 -2
- package/template/nextjs/src/app/(auth)/(account)/layout.tsx +64 -0
- package/template/nextjs/src/app/(auth)/(account)/profile/page.tsx +16 -0
- package/template/nextjs/src/app/(auth)/(account)/profile/profile-form.tsx +247 -0
- package/template/nextjs/src/app/(auth)/login/email-login-form.tsx +56 -29
- package/template/nextjs/src/app/(auth)/login/page.tsx +45 -12
- package/template/nextjs/src/app/(auth)/login/social-login-buttons.tsx +85 -17
- package/template/nextjs/src/app/(marketing)/layout.tsx +35 -4
- package/template/nextjs/src/app/(marketing)/legal.tsx +56 -0
- package/template/nextjs/src/app/(marketing)/page.tsx +20 -2
- package/template/nextjs/src/app/(marketing)/privacy/page.tsx +43 -2
- package/template/nextjs/src/app/(marketing)/terms/page.tsx +33 -2
- package/template/nextjs/src/app/error.tsx +37 -0
- package/template/nextjs/src/app/fonts/geist-mono/GeistMono-Variable.woff2 +0 -0
- package/template/nextjs/src/app/fonts/geist-sans/Geist-Variable.woff2 +0 -0
- package/template/nextjs/src/app/fonts/index.ts +60 -0
- package/template/nextjs/src/app/global-error.tsx +38 -0
- package/template/nextjs/src/app/globals.css +29 -0
- package/template/nextjs/src/app/layout.tsx +45 -18
- package/template/nextjs/src/app/not-found.tsx +25 -3
- package/template/nextjs/src/app/robots.ts +29 -0
- package/template/nextjs/src/app/sitemap.ts +21 -0
- package/template/nextjs/src/components/confirm-dialog.tsx +79 -0
- package/template/nextjs/src/components/dashboard-header.tsx +70 -0
- package/template/nextjs/src/components/data-table/enum.ts +5 -0
- package/template/nextjs/src/components/data-table/features.ts +49 -0
- package/template/nextjs/src/components/data-table/index.tsx +961 -0
- package/template/nextjs/src/components/data-table/types.ts +76 -0
- package/template/nextjs/src/components/error.tsx +71 -0
- package/template/nextjs/src/components/loader.tsx +18 -2
- package/template/nextjs/src/components/logo.tsx +49 -0
- package/template/nextjs/src/components/navigation-search.tsx +140 -0
- package/template/nextjs/src/components/navigation-sidebar.tsx +241 -0
- package/template/nextjs/src/components/page-heading.tsx +38 -0
- package/template/nextjs/src/components/react-query-provider.tsx +41 -2
- package/template/nextjs/src/components/route-error.tsx +55 -0
- package/template/nextjs/src/components/screen-size.tsx +36 -0
- package/template/nextjs/src/components/site-footer.tsx +20 -4
- package/template/nextjs/src/components/theme-provider.tsx +48 -0
- package/template/nextjs/src/components/theme-toggle.tsx +58 -5
- package/template/nextjs/src/components/ui/alert-dialog.tsx +199 -0
- package/template/nextjs/src/components/ui/avatar.tsx +112 -0
- package/template/nextjs/src/components/ui/badge.tsx +54 -0
- package/template/nextjs/src/components/ui/button.tsx +3 -1
- package/template/nextjs/src/components/ui/card.tsx +4 -4
- package/template/nextjs/src/components/ui/collapsible.tsx +33 -0
- package/template/nextjs/src/components/ui/command.tsx +192 -0
- package/template/nextjs/src/components/ui/dialog.tsx +164 -0
- package/template/nextjs/src/components/ui/dropdown-menu.tsx +273 -0
- package/template/nextjs/src/components/ui/input-group.tsx +156 -0
- package/template/nextjs/src/components/ui/select.tsx +195 -0
- package/template/nextjs/src/components/ui/sheet.tsx +143 -0
- package/template/nextjs/src/components/ui/sidebar.tsx +702 -0
- package/template/nextjs/src/components/ui/skeleton.tsx +13 -0
- package/template/nextjs/src/components/ui/table.tsx +116 -0
- package/template/nextjs/src/components/ui/textarea.tsx +18 -0
- package/template/nextjs/src/components/ui/tooltip.tsx +57 -0
- package/template/nextjs/src/components/user-menu.tsx +206 -0
- package/template/nextjs/src/db/common.ts +10 -0
- package/template/nextjs/src/db/index.ts +16 -6
- package/template/nextjs/src/db/relations.ts +21 -0
- package/template/nextjs/src/db/schema.ts +85 -46
- package/template/nextjs/src/emails/components/email-layout.tsx +27 -11
- package/template/nextjs/src/emails/magic-link.tsx +15 -13
- package/template/nextjs/src/emails/test.tsx +11 -9
- package/template/nextjs/src/emails/welcome.tsx +12 -9
- package/template/nextjs/src/env.ts +1 -1
- package/template/nextjs/src/hooks/use-mobile.ts +14 -12
- package/template/nextjs/src/instrumentation.ts +20 -2
- package/template/nextjs/src/lib/actions.ts +55 -0
- package/template/nextjs/src/lib/admin-navigation.ts +43 -0
- package/template/nextjs/src/lib/auth-client.ts +20 -9
- package/template/nextjs/src/lib/auth-permissions.ts +61 -0
- package/template/nextjs/src/lib/auth.ts +33 -3
- package/template/nextjs/src/lib/callback-url.ts +28 -0
- package/template/nextjs/src/lib/constants.ts +21 -0
- package/template/nextjs/src/lib/delay.ts +10 -0
- package/template/nextjs/src/lib/email-service.ts +21 -0
- package/template/nextjs/src/lib/errors.ts +74 -0
- package/template/nextjs/src/lib/format-currency.ts +22 -24
- package/template/nextjs/src/lib/format-date.ts +69 -6
- package/template/nextjs/src/lib/nodemailer.ts +27 -3
- package/template/nextjs/src/lib/otel.ts +92 -2
- package/template/nextjs/src/lib/safe-action-client.ts +60 -9
- package/template/nextjs/src/lib/safe-action.ts +152 -16
- package/template/nextjs/src/lib/search.ts +16 -0
- package/template/nextjs/src/lib/seo.ts +7 -0
- package/template/nextjs/src/lib/siteConfig.ts +17 -1
- package/template/nextjs/src/lib/toast-message.ts +87 -1
- package/template/nextjs/src/lib/validations.ts +30 -0
- package/template/nextjs/src/proxy.ts +48 -0
- package/template/nextjs/src/scripts/reset-db.ts +22 -0
- package/template/nextjs/src/scripts/seed.ts +59 -8
- package/template/nextjs/src/scripts/test-mail.ts +28 -20
- package/template/nextjs/tests/admin/users.test.ts +64 -0
- package/template/nextjs/tests/db/fk-indexes.test.ts +62 -0
- package/template/nextjs/tests/db/seed.test.ts +49 -0
- package/template/nextjs/tests/helpers/action.ts +71 -0
- package/template/nextjs/tests/helpers/fixtures.ts +78 -0
- package/template/nextjs/tests/helpers/index.ts +2 -0
- package/template/nextjs/tests/lib/callback-url.test.ts +48 -0
- package/template/nextjs/tests/lib/client-server-boundary.test.ts +57 -0
- package/template/nextjs/tests/lib/errors.test.ts +10 -0
- package/template/nextjs/tests/lib/search.test.ts +23 -0
- package/template/nextjs/tests/setup/pglite-db.ts +63 -0
- package/template/nextjs/tests/setup/preload.ts +95 -0
- package/template/nextjs/tsconfig.json +1 -0
- package/template/saas-starter/.dockerignore +8 -0
- package/template/saas-starter/.env.example +25 -0
- package/template/saas-starter/.vscode/extensions.json +11 -0
- package/template/saas-starter/.vscode/settings.json +3 -0
- package/template/saas-starter/AGENTS.md +302 -0
- package/template/saas-starter/CLAUDE.md +1 -0
- package/template/saas-starter/Dockerfile +15 -0
- package/template/saas-starter/README.md +125 -0
- package/template/saas-starter/bunfig.toml +3 -0
- package/template/saas-starter/components.json +25 -0
- package/template/saas-starter/drizzle.config.ts +10 -0
- package/template/saas-starter/eslint.config.mjs +24 -0
- package/template/saas-starter/gitignore +14 -0
- package/template/saas-starter/next.config.ts +32 -0
- package/template/saas-starter/package.json +97 -0
- package/template/saas-starter/postcss.config.mjs +7 -0
- package/template/saas-starter/prettier.config.mjs +11 -0
- package/template/saas-starter/public/logo-dark.svg +4 -0
- package/template/saas-starter/public/logo.svg +4 -0
- package/template/saas-starter/public/placeholder.svg +1 -0
- package/template/saas-starter/src/app/(admin)/actions/contact-leads.ts +51 -0
- package/template/saas-starter/src/app/(admin)/actions/feedbacks.ts +91 -0
- package/template/saas-starter/src/app/(admin)/actions/users.ts +183 -0
- package/template/saas-starter/src/app/(admin)/admin/_components/admin-header.tsx +24 -0
- package/template/saas-starter/src/app/(admin)/admin/_components/admin-search.tsx +16 -0
- package/template/saas-starter/src/app/(admin)/admin/_components/admin-sidebar.tsx +42 -0
- package/template/saas-starter/src/app/(admin)/admin/contact-leads/page.tsx +123 -0
- package/template/saas-starter/src/app/(admin)/admin/feedbacks/page.tsx +161 -0
- package/template/saas-starter/src/app/(admin)/admin/layout.tsx +53 -0
- package/template/saas-starter/src/app/(admin)/admin/page.tsx +60 -0
- package/template/saas-starter/src/app/(admin)/admin/settings/layout.tsx +24 -0
- package/template/saas-starter/src/app/(admin)/admin/settings/users/[userId]/page.tsx +43 -0
- package/template/saas-starter/src/app/(admin)/admin/settings/users/new/page.tsx +16 -0
- package/template/saas-starter/src/app/(admin)/admin/settings/users/page.tsx +377 -0
- package/template/saas-starter/src/app/(admin)/admin/settings/users/user-form.tsx +138 -0
- package/template/saas-starter/src/app/(admin)/admin/settings/users/validation.ts +23 -0
- package/template/saas-starter/src/app/(admin)/admin/support-tickets/[ticketId]/page.tsx +17 -0
- package/template/saas-starter/src/app/(admin)/admin/support-tickets/page.tsx +5 -0
- package/template/saas-starter/src/app/(app)/actions/billing.ts +216 -0
- package/template/saas-starter/src/app/(app)/actions/feedbacks.ts +28 -0
- package/template/saas-starter/src/app/(app)/actions/feedbacks.validation.ts +12 -0
- package/template/saas-starter/src/app/(app)/actions/members.ts +189 -0
- package/template/saas-starter/src/app/(app)/actions/organizations.ts +230 -0
- package/template/saas-starter/src/app/(app)/actions/organizations.validation.ts +17 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/dashboard/page.tsx +17 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/layout.tsx +31 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/_components/billing-email-form.tsx +92 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/_components/danger-zone.tsx +357 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/_components/general-settings-form.tsx +130 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/_components/plans-section.tsx +222 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/billing/page.tsx +115 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/layout.tsx +24 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/members/_components/invite-member-dialog.tsx +168 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/members/_components/members-tabs.tsx +604 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/members/page.tsx +33 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/settings/page.tsx +55 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/support-tickets/[ticketId]/page.tsx +25 -0
- package/template/saas-starter/src/app/(app)/app/[orgId]/support-tickets/page.tsx +25 -0
- package/template/saas-starter/src/app/(app)/app/_components/app-header.tsx +31 -0
- package/template/saas-starter/src/app/(app)/app/_components/app-search.tsx +26 -0
- package/template/saas-starter/src/app/(app)/app/_components/app-sidebar.tsx +30 -0
- package/template/saas-starter/src/app/(app)/app/_components/feedback-dialog.tsx +108 -0
- package/template/saas-starter/src/app/(app)/app/_components/organization-context.tsx +37 -0
- package/template/saas-starter/src/app/(app)/app/_components/organization-switcher.tsx +200 -0
- package/template/saas-starter/src/app/(app)/app/layout.tsx +64 -0
- package/template/saas-starter/src/app/(app)/app/onboarding/_components/create-organization-form.tsx +117 -0
- package/template/saas-starter/src/app/(app)/app/onboarding/page.tsx +40 -0
- package/template/saas-starter/src/app/(app)/app/page.tsx +76 -0
- package/template/saas-starter/src/app/(auth)/(account)/layout.tsx +64 -0
- package/template/saas-starter/src/app/(auth)/(account)/profile/page.tsx +16 -0
- package/template/saas-starter/src/app/(auth)/(account)/profile/profile-form.tsx +247 -0
- package/template/saas-starter/src/app/(auth)/(account)/support/[ticketId]/page.tsx +19 -0
- package/template/saas-starter/src/app/(auth)/(account)/support/page.tsx +9 -0
- package/template/saas-starter/src/app/(auth)/login/email-login-form.tsx +131 -0
- package/template/saas-starter/src/app/(auth)/login/page.tsx +105 -0
- package/template/saas-starter/src/app/(auth)/login/social-login-buttons.tsx +137 -0
- package/template/saas-starter/src/app/(invitation)/accept-invitation/[id]/accept-invitation-form.tsx +94 -0
- package/template/saas-starter/src/app/(invitation)/accept-invitation/[id]/page.tsx +153 -0
- package/template/saas-starter/src/app/(invitation)/actions/invitations.ts +32 -0
- package/template/saas-starter/src/app/(marketing)/contact-us/actions.ts +23 -0
- package/template/saas-starter/src/app/(marketing)/contact-us/contact-form.tsx +118 -0
- package/template/saas-starter/src/app/(marketing)/contact-us/page.tsx +20 -0
- package/template/saas-starter/src/app/(marketing)/contact-us/validation.ts +22 -0
- package/template/saas-starter/src/app/(marketing)/layout.tsx +48 -0
- package/template/saas-starter/src/app/(marketing)/legal.tsx +66 -0
- package/template/saas-starter/src/app/(marketing)/page.tsx +24 -0
- package/template/saas-starter/src/app/(marketing)/privacy/page.tsx +63 -0
- package/template/saas-starter/src/app/(marketing)/terms/page.tsx +41 -0
- package/template/saas-starter/src/app/actions/support-tickets.ts +510 -0
- package/template/saas-starter/src/app/actions/support-tickets.validation.ts +112 -0
- package/template/saas-starter/src/app/actions/uploads.ts +36 -0
- package/template/saas-starter/src/app/actions/uploads.validation.ts +24 -0
- package/template/saas-starter/src/app/api/auth/[...all]/route.ts +4 -0
- package/template/saas-starter/src/app/api/webhooks/stripe/route.ts +94 -0
- package/template/saas-starter/src/app/error.tsx +37 -0
- package/template/saas-starter/src/app/favicon.ico +0 -0
- package/template/saas-starter/src/app/fonts/geist-mono/GeistMono-Variable.woff2 +0 -0
- package/template/saas-starter/src/app/fonts/geist-sans/Geist-Variable.woff2 +0 -0
- package/template/saas-starter/src/app/fonts/index.ts +60 -0
- package/template/saas-starter/src/app/global-error.tsx +38 -0
- package/template/saas-starter/src/app/globals.css +269 -0
- package/template/saas-starter/src/app/layout.tsx +77 -0
- package/template/saas-starter/src/app/not-found.tsx +49 -0
- package/template/saas-starter/src/app/robots.ts +36 -0
- package/template/saas-starter/src/app/sitemap.ts +21 -0
- package/template/saas-starter/src/components/confirm-dialog.tsx +79 -0
- package/template/saas-starter/src/components/dashboard-header.tsx +70 -0
- package/template/saas-starter/src/components/data-table/enum.ts +5 -0
- package/template/saas-starter/src/components/data-table/features.ts +49 -0
- package/template/saas-starter/src/components/data-table/index.tsx +961 -0
- package/template/saas-starter/src/components/data-table/types.ts +76 -0
- package/template/saas-starter/src/components/error.tsx +71 -0
- package/template/saas-starter/src/components/file-upload.tsx +254 -0
- package/template/saas-starter/src/components/loader.tsx +41 -0
- package/template/saas-starter/src/components/logo.tsx +49 -0
- package/template/saas-starter/src/components/navigation-search.tsx +140 -0
- package/template/saas-starter/src/components/navigation-sidebar.tsx +241 -0
- package/template/saas-starter/src/components/page-heading.tsx +38 -0
- package/template/saas-starter/src/components/react-query-provider.tsx +51 -0
- package/template/saas-starter/src/components/route-error.tsx +55 -0
- package/template/saas-starter/src/components/screen-size.tsx +76 -0
- package/template/saas-starter/src/components/site-footer.tsx +39 -0
- package/template/saas-starter/src/components/support/create-support-ticket-dialog.tsx +122 -0
- package/template/saas-starter/src/components/support/support-ticket-conversation.tsx +236 -0
- package/template/saas-starter/src/components/support/support-ticket-shared.tsx +58 -0
- package/template/saas-starter/src/components/support/support-tickets-table.tsx +281 -0
- package/template/saas-starter/src/components/theme-provider.tsx +115 -0
- package/template/saas-starter/src/components/theme-toggle.tsx +75 -0
- package/template/saas-starter/src/components/ui/alert-dialog.tsx +199 -0
- package/template/saas-starter/src/components/ui/avatar.tsx +112 -0
- package/template/saas-starter/src/components/ui/badge.tsx +54 -0
- package/template/saas-starter/src/components/ui/button.tsx +69 -0
- package/template/saas-starter/src/components/ui/card.tsx +103 -0
- package/template/saas-starter/src/components/ui/checkbox.tsx +32 -0
- package/template/saas-starter/src/components/ui/collapsible.tsx +33 -0
- package/template/saas-starter/src/components/ui/command.tsx +192 -0
- package/template/saas-starter/src/components/ui/dialog.tsx +164 -0
- package/template/saas-starter/src/components/ui/dropdown-menu.tsx +273 -0
- package/template/saas-starter/src/components/ui/field.tsx +238 -0
- package/template/saas-starter/src/components/ui/input-group.tsx +156 -0
- package/template/saas-starter/src/components/ui/input.tsx +19 -0
- package/template/saas-starter/src/components/ui/label.tsx +24 -0
- package/template/saas-starter/src/components/ui/popover.tsx +89 -0
- package/template/saas-starter/src/components/ui/select.tsx +195 -0
- package/template/saas-starter/src/components/ui/separator.tsx +28 -0
- package/template/saas-starter/src/components/ui/sheet.tsx +143 -0
- package/template/saas-starter/src/components/ui/sidebar.tsx +702 -0
- package/template/saas-starter/src/components/ui/skeleton.tsx +13 -0
- package/template/saas-starter/src/components/ui/sonner.tsx +45 -0
- package/template/saas-starter/src/components/ui/switch.tsx +33 -0
- package/template/saas-starter/src/components/ui/table.tsx +116 -0
- package/template/saas-starter/src/components/ui/tabs.tsx +90 -0
- package/template/saas-starter/src/components/ui/textarea.tsx +18 -0
- package/template/saas-starter/src/components/ui/tooltip.tsx +57 -0
- package/template/saas-starter/src/components/user-menu.tsx +213 -0
- package/template/saas-starter/src/db/common.ts +63 -0
- package/template/saas-starter/src/db/enums.ts +50 -0
- package/template/saas-starter/src/db/index.ts +60 -0
- package/template/saas-starter/src/db/relations.ts +112 -0
- package/template/saas-starter/src/db/schema.ts +342 -0
- package/template/saas-starter/src/emails/components/email-layout.tsx +79 -0
- package/template/saas-starter/src/emails/invitation.tsx +69 -0
- package/template/saas-starter/src/emails/magic-link.tsx +51 -0
- package/template/saas-starter/src/emails/test.tsx +34 -0
- package/template/saas-starter/src/emails/welcome.tsx +37 -0
- package/template/saas-starter/src/env.ts +66 -0
- package/template/saas-starter/src/hooks/use-mobile.ts +21 -0
- package/template/saas-starter/src/instrumentation.ts +44 -0
- package/template/saas-starter/src/lib/actions.ts +55 -0
- package/template/saas-starter/src/lib/admin-navigation.ts +63 -0
- package/template/saas-starter/src/lib/app-navigation.ts +63 -0
- package/template/saas-starter/src/lib/auth-client.ts +34 -0
- package/template/saas-starter/src/lib/auth-permissions.ts +61 -0
- package/template/saas-starter/src/lib/auth.ts +312 -0
- package/template/saas-starter/src/lib/billing.ts +152 -0
- package/template/saas-starter/src/lib/callback-url.ts +28 -0
- package/template/saas-starter/src/lib/cn.ts +4 -0
- package/template/saas-starter/src/lib/constants.ts +91 -0
- package/template/saas-starter/src/lib/delay.ts +12 -0
- package/template/saas-starter/src/lib/email-service.ts +118 -0
- package/template/saas-starter/src/lib/errors.ts +74 -0
- package/template/saas-starter/src/lib/format-currency.ts +25 -0
- package/template/saas-starter/src/lib/format-date.ts +75 -0
- package/template/saas-starter/src/lib/image-url.ts +54 -0
- package/template/saas-starter/src/lib/nodemailer.ts +67 -0
- package/template/saas-starter/src/lib/organization-access.ts +73 -0
- package/template/saas-starter/src/lib/otel.ts +117 -0
- package/template/saas-starter/src/lib/plan-limits.ts +37 -0
- package/template/saas-starter/src/lib/plans.ts +90 -0
- package/template/saas-starter/src/lib/rbac.ts +44 -0
- package/template/saas-starter/src/lib/safe-action-client.ts +126 -0
- package/template/saas-starter/src/lib/safe-action.ts +187 -0
- package/template/saas-starter/src/lib/search.ts +16 -0
- package/template/saas-starter/src/lib/seo.ts +7 -0
- package/template/saas-starter/src/lib/siteConfig.ts +20 -0
- package/template/saas-starter/src/lib/storage.ts +311 -0
- package/template/saas-starter/src/lib/stripe.ts +9 -0
- package/template/saas-starter/src/lib/toast-message.ts +101 -0
- package/template/saas-starter/src/lib/validations.ts +95 -0
- package/template/saas-starter/src/proxy.ts +48 -0
- package/template/saas-starter/src/scripts/cleanup-temp-uploads.ts +24 -0
- package/template/saas-starter/src/scripts/reset-db.ts +22 -0
- package/template/saas-starter/src/scripts/seed.ts +85 -0
- package/template/saas-starter/src/scripts/setup-db.ts +72 -0
- package/template/saas-starter/src/scripts/setup-stripe-plans.ts +206 -0
- package/template/saas-starter/src/scripts/test-mail.ts +43 -0
- package/template/saas-starter/tests/admin/users.test.ts +64 -0
- package/template/saas-starter/tests/db/fk-indexes.test.ts +62 -0
- package/template/saas-starter/tests/db/seed.test.ts +57 -0
- package/template/saas-starter/tests/helpers/action.ts +71 -0
- package/template/saas-starter/tests/helpers/fixtures.ts +151 -0
- package/template/saas-starter/tests/helpers/index.ts +2 -0
- package/template/saas-starter/tests/lib/callback-url.test.ts +48 -0
- package/template/saas-starter/tests/lib/client-server-boundary.test.ts +57 -0
- package/template/saas-starter/tests/lib/errors.test.ts +10 -0
- package/template/saas-starter/tests/lib/image-url.test.ts +31 -0
- package/template/saas-starter/tests/lib/search.test.ts +23 -0
- package/template/saas-starter/tests/marketing/contact-and-feedback.test.ts +86 -0
- package/template/saas-starter/tests/organizations/organizations.test.ts +175 -0
- package/template/saas-starter/tests/setup/pglite-db.ts +67 -0
- package/template/saas-starter/tests/setup/preload.ts +108 -0
- package/template/saas-starter/tests/support/support-tickets.test.ts +145 -0
- package/template/saas-starter/tsconfig.json +52 -0
- package/cli.js +0 -143
- package/template/nextjs/src/app/(admin)/layout.tsx +0 -20
- package/template/nextjs/src/app/(app)/layout.tsx +0 -20
- package/template/nextjs/terraform/artifact-registry.tf +0 -5
- package/template/nextjs/terraform/backend-service.tf +0 -13
- package/template/nextjs/terraform/cleanup.sh +0 -9
- package/template/nextjs/terraform/cloudbuild.tf +0 -70
- package/template/nextjs/terraform/cloudrun.tf +0 -68
- package/template/nextjs/terraform/database.tf +0 -60
- package/template/nextjs/terraform/forwarding-rule.tf +0 -43
- package/template/nextjs/terraform/gitignore +0 -4
- package/template/nextjs/terraform/ip-address.tf +0 -11
- package/template/nextjs/terraform/network-endpoint-group.tf +0 -11
- package/template/nextjs/terraform/network.tf +0 -21
- package/template/nextjs/terraform/pre.sh +0 -3
- package/template/nextjs/terraform/providers.tf +0 -18
- package/template/nextjs/terraform/secret.txt +0 -11
- package/template/nextjs/terraform/setup.sh +0 -25
- package/template/nextjs/terraform/ssl-certs.tf +0 -32
- package/template/nextjs/terraform/target-https-proxy copy.tf +0 -14
- package/template/nextjs/terraform/target-https-proxy.tf +0 -14
- package/template/nextjs/terraform/terraform.tfvars +0 -4
- package/template/nextjs/terraform/url-map.tf +0 -23
- package/template/nextjs/terraform/variables.tf +0 -21
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm'
|
|
2
|
+
import { type NextRequest, NextResponse } from 'next/server'
|
|
3
|
+
import type Stripe from 'stripe'
|
|
4
|
+
import { db } from '~/db'
|
|
5
|
+
import { stripeWebhooksEventsTable } from '~/db/schema'
|
|
6
|
+
import { env } from '~/env'
|
|
7
|
+
import { syncSubscriptionFromStripe } from '~/lib/billing'
|
|
8
|
+
import { stripeClient } from '~/lib/stripe'
|
|
9
|
+
|
|
10
|
+
const RELEVANT_EVENTS: ReadonlySet<string> = new Set([
|
|
11
|
+
'checkout.session.completed',
|
|
12
|
+
'customer.subscription.created',
|
|
13
|
+
'customer.subscription.updated',
|
|
14
|
+
'customer.subscription.deleted',
|
|
15
|
+
'customer.subscription.trial_will_end',
|
|
16
|
+
'customer.subscription.paused',
|
|
17
|
+
'customer.subscription.resumed',
|
|
18
|
+
'invoice.paid',
|
|
19
|
+
'invoice.payment_succeeded',
|
|
20
|
+
'invoice.payment_failed'
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
const extractCustomerId = (event: Stripe.Event): string | null => {
|
|
24
|
+
const object = event.data.object as {
|
|
25
|
+
customer?: string | { id: string } | null
|
|
26
|
+
}
|
|
27
|
+
const customer = object.customer
|
|
28
|
+
if (!customer) return null
|
|
29
|
+
return typeof customer === 'string' ? customer : customer.id
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function POST(req: NextRequest) {
|
|
33
|
+
const body = await req.text()
|
|
34
|
+
const signature = req.headers.get('stripe-signature')
|
|
35
|
+
|
|
36
|
+
if (!signature) {
|
|
37
|
+
return new NextResponse('Missing stripe-signature header', { status: 400 })
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let event: Stripe.Event
|
|
41
|
+
try {
|
|
42
|
+
event = stripeClient.webhooks.constructEvent(
|
|
43
|
+
body,
|
|
44
|
+
signature,
|
|
45
|
+
env.STRIPE_WEBHOOK_SECRET
|
|
46
|
+
)
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('Stripe webhook signature verification failed:', error)
|
|
49
|
+
return new NextResponse('Unauthorized', { status: 400 })
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!RELEVANT_EVENTS.has(event.type)) {
|
|
53
|
+
return NextResponse.json({ received: true, ignored: true })
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const existing = await db.query.stripeWebhooksEventsTable.findFirst({
|
|
57
|
+
where: eq(stripeWebhooksEventsTable.id, event.id)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
if (existing?.processed) {
|
|
61
|
+
return NextResponse.json({ received: true, duplicate: true })
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!existing) {
|
|
65
|
+
await db
|
|
66
|
+
.insert(stripeWebhooksEventsTable)
|
|
67
|
+
.values({ id: event.id, type: event.type })
|
|
68
|
+
.onConflictDoNothing()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const customerId = extractCustomerId(event)
|
|
73
|
+
if (customerId) {
|
|
74
|
+
await syncSubscriptionFromStripe(customerId)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
await db
|
|
78
|
+
.update(stripeWebhooksEventsTable)
|
|
79
|
+
.set({ processed: true, processedAt: new Date(), error: null })
|
|
80
|
+
.where(eq(stripeWebhooksEventsTable.id, event.id))
|
|
81
|
+
|
|
82
|
+
return NextResponse.json({ received: true, processed: true })
|
|
83
|
+
} catch (error) {
|
|
84
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
85
|
+
console.error(`Failed to process Stripe event ${event.id}:`, error)
|
|
86
|
+
|
|
87
|
+
await db
|
|
88
|
+
.update(stripeWebhooksEventsTable)
|
|
89
|
+
.set({ error: message, payload: event as unknown })
|
|
90
|
+
.where(eq(stripeWebhooksEventsTable.id, event.id))
|
|
91
|
+
|
|
92
|
+
return new NextResponse('Webhook handler failed', { status: 500 })
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { usePathname } from 'next/navigation'
|
|
4
|
+
import { useEffect } from 'react'
|
|
5
|
+
import { RouteError } from '~/components/route-error'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Root segment error boundary.
|
|
9
|
+
*
|
|
10
|
+
* Catches runtime errors in pages and nested layouts under the root layout.
|
|
11
|
+
* Does not catch errors thrown in the root layout itself; see `global-error.tsx`.
|
|
12
|
+
*/
|
|
13
|
+
export default function Error({
|
|
14
|
+
error,
|
|
15
|
+
unstable_retry
|
|
16
|
+
}: {
|
|
17
|
+
error: Error & { digest?: string }
|
|
18
|
+
unstable_retry: () => void
|
|
19
|
+
}) {
|
|
20
|
+
const pathname = usePathname()
|
|
21
|
+
const homeHref =
|
|
22
|
+
pathname?.startsWith('/admin') && pathname !== '/admin' ? '/admin' : '/'
|
|
23
|
+
const homeLabel = homeHref === '/admin' ? 'Back to Admin' : 'Go Home'
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
console.error('Route error boundary:', error)
|
|
27
|
+
}, [error])
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<RouteError
|
|
31
|
+
error={error}
|
|
32
|
+
onRetry={unstable_retry}
|
|
33
|
+
homeHref={homeHref}
|
|
34
|
+
homeLabel={homeLabel}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Global font definitions shared across all route groups.
|
|
3
|
+
*
|
|
4
|
+
* Fonts are defined here in a single module so that `next/font/local` generates
|
|
5
|
+
* a stable CSS module hash regardless of which layout imports them. Defining
|
|
6
|
+
* fonts inside individual route-group layouts (e.g. `(marketing)` or `(admin)`)
|
|
7
|
+
* causes the server and client to produce different class name hashes, leading
|
|
8
|
+
* to React hydration mismatches.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* import { geistMono, geistSans } from '~/app/fonts'
|
|
12
|
+
* <body className={`${geistSans.variable} ${geistMono.variable}`}>
|
|
13
|
+
*
|
|
14
|
+
* @module app/fonts/index
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import localFont from 'next/font/local'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Geist Sans - primary variable font for body and UI text.
|
|
21
|
+
*
|
|
22
|
+
* Exposed as the CSS custom property `--font-geist-sans` so it can be
|
|
23
|
+
* referenced in Tailwind via `font-sans`.
|
|
24
|
+
*
|
|
25
|
+
* @see https://vercel.com/font/sans
|
|
26
|
+
*/
|
|
27
|
+
export const geistSans = localFont({
|
|
28
|
+
src: '../fonts/geist-sans/Geist-Variable.woff2',
|
|
29
|
+
variable: '--font-geist-sans',
|
|
30
|
+
weight: '100 900'
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Geist Mono - monospace variable font for code blocks, badges, and
|
|
35
|
+
* any UI element that benefits from fixed-width rendering.
|
|
36
|
+
*
|
|
37
|
+
* Exposed as the CSS custom property `--font-geist-mono`.
|
|
38
|
+
*
|
|
39
|
+
* `adjustFontFallback` is disabled because the automatic metric adjustment
|
|
40
|
+
* produces undesirable layout shifts with the custom fallback stack below.
|
|
41
|
+
*
|
|
42
|
+
* @see https://vercel.com/font/mono
|
|
43
|
+
*/
|
|
44
|
+
export const geistMono = localFont({
|
|
45
|
+
src: '../fonts/geist-mono/GeistMono-Variable.woff2',
|
|
46
|
+
variable: '--font-geist-mono',
|
|
47
|
+
adjustFontFallback: false,
|
|
48
|
+
fallback: [
|
|
49
|
+
'ui-monospace',
|
|
50
|
+
'SFMono-Regular',
|
|
51
|
+
'Roboto Mono',
|
|
52
|
+
'Menlo',
|
|
53
|
+
'Monaco',
|
|
54
|
+
'Liberation Mono',
|
|
55
|
+
'DejaVu Sans Mono',
|
|
56
|
+
'Courier New',
|
|
57
|
+
'monospace'
|
|
58
|
+
],
|
|
59
|
+
weight: '100 900'
|
|
60
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react'
|
|
4
|
+
import { RouteError } from '~/components/route-error'
|
|
5
|
+
import { siteConfig } from '~/lib/siteConfig'
|
|
6
|
+
import { geistMono, geistSans } from './fonts'
|
|
7
|
+
import './globals.css'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Root layout error boundary.
|
|
11
|
+
*
|
|
12
|
+
* Replaces the entire root layout when an error is thrown there.
|
|
13
|
+
* Must define its own document shell (`html` / `body`) and styles.
|
|
14
|
+
*/
|
|
15
|
+
export default function GlobalError({
|
|
16
|
+
error,
|
|
17
|
+
unstable_retry
|
|
18
|
+
}: {
|
|
19
|
+
error: Error & { digest?: string }
|
|
20
|
+
unstable_retry: () => void
|
|
21
|
+
}) {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
console.error('Global error boundary:', error)
|
|
24
|
+
}, [error])
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<html
|
|
28
|
+
lang="en"
|
|
29
|
+
suppressHydrationWarning
|
|
30
|
+
className={`${geistSans.variable} ${geistMono.variable}`}
|
|
31
|
+
>
|
|
32
|
+
<body>
|
|
33
|
+
<title>This Page Failed to Load | {siteConfig.name}</title>
|
|
34
|
+
<RouteError error={error} onRetry={unstable_retry} />
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
@import 'tw-animate-css';
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
@theme inline {
|
|
7
|
+
--color-background: var(--background);
|
|
8
|
+
--color-foreground: var(--foreground);
|
|
9
|
+
--color-card: var(--card);
|
|
10
|
+
--color-card-foreground: var(--card-foreground);
|
|
11
|
+
--color-popover: var(--popover);
|
|
12
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
13
|
+
--color-primary: var(--primary);
|
|
14
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
15
|
+
--color-secondary: var(--secondary);
|
|
16
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
17
|
+
--color-muted: var(--muted);
|
|
18
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
19
|
+
--color-accent: var(--accent);
|
|
20
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
21
|
+
--color-destructive: var(--destructive);
|
|
22
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
23
|
+
--color-border: var(--border);
|
|
24
|
+
--color-input: var(--input);
|
|
25
|
+
--color-ring: var(--ring);
|
|
26
|
+
--color-chart-1: var(--chart-1);
|
|
27
|
+
--color-chart-2: var(--chart-2);
|
|
28
|
+
--color-chart-3: var(--chart-3);
|
|
29
|
+
--color-chart-4: var(--chart-4);
|
|
30
|
+
--color-chart-5: var(--chart-5);
|
|
31
|
+
|
|
32
|
+
--color-success: var(--success);
|
|
33
|
+
--color-success-foreground: var(--success-foreground);
|
|
34
|
+
--color-warning: var(--warning);
|
|
35
|
+
--color-warning-foreground: var(--warning-foreground);
|
|
36
|
+
--color-info: var(--info);
|
|
37
|
+
--color-info-foreground: var(--info-foreground);
|
|
38
|
+
|
|
39
|
+
--color-sidebar: var(--sidebar);
|
|
40
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
41
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
42
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
43
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
44
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
45
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
46
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
47
|
+
|
|
48
|
+
--font-heading: var(--font-geist-sans);
|
|
49
|
+
--font-sans: var(--font-geist-sans);
|
|
50
|
+
--font-mono: var(--font-geist-mono);
|
|
51
|
+
|
|
52
|
+
--radius-sm: calc(var(--radius) * 0.6);
|
|
53
|
+
--radius-md: calc(var(--radius) * 0.8);
|
|
54
|
+
--radius-lg: var(--radius);
|
|
55
|
+
--radius-xl: calc(var(--radius) * 1.4);
|
|
56
|
+
--radius-2xl: calc(var(--radius) * 1.8);
|
|
57
|
+
--radius-3xl: calc(var(--radius) * 2.2);
|
|
58
|
+
--radius-4xl: calc(var(--radius) * 2.6);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:root {
|
|
62
|
+
--radius: 0.625rem;
|
|
63
|
+
--background: oklch(1 0 0);
|
|
64
|
+
--foreground: oklch(0.145 0 0);
|
|
65
|
+
--card: oklch(1 0 0);
|
|
66
|
+
--card-foreground: oklch(0.145 0 0);
|
|
67
|
+
--popover: oklch(1 0 0);
|
|
68
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
69
|
+
--primary: oklch(0.205 0 0);
|
|
70
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
71
|
+
--secondary: oklch(0.97 0 0);
|
|
72
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
73
|
+
--muted: oklch(0.97 0 0);
|
|
74
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
75
|
+
--accent: oklch(0.97 0 0);
|
|
76
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
77
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
78
|
+
--destructive-foreground: oklch(1 0 0);
|
|
79
|
+
--border: oklch(0.922 0 0);
|
|
80
|
+
--input: oklch(0.922 0 0);
|
|
81
|
+
--ring: oklch(0.708 0 0);
|
|
82
|
+
--chart-1: oklch(0.87 0 0);
|
|
83
|
+
--chart-2: oklch(0.556 0 0);
|
|
84
|
+
--chart-3: oklch(0.439 0 0);
|
|
85
|
+
--chart-4: oklch(0.371 0 0);
|
|
86
|
+
--chart-5: oklch(0.269 0 0);
|
|
87
|
+
--sidebar: oklch(0.985 0 0);
|
|
88
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
89
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
90
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
91
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
92
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
93
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
94
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
95
|
+
|
|
96
|
+
--success: oklch(0.552 0.152 149.579);
|
|
97
|
+
--success-foreground: oklch(1 0 0);
|
|
98
|
+
--warning: oklch(0.574 0.188 70.08);
|
|
99
|
+
--warning-foreground: oklch(1 0 0);
|
|
100
|
+
--info: oklch(0.569 0.165 254.624);
|
|
101
|
+
--info-foreground: oklch(1 0 0);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.dark {
|
|
105
|
+
--background: oklch(0.145 0 0);
|
|
106
|
+
--foreground: oklch(0.985 0 0);
|
|
107
|
+
--card: oklch(0.205 0 0);
|
|
108
|
+
--card-foreground: oklch(0.985 0 0);
|
|
109
|
+
--popover: oklch(0.205 0 0);
|
|
110
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
111
|
+
--primary: oklch(0.922 0 0);
|
|
112
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
113
|
+
--secondary: oklch(0.269 0 0);
|
|
114
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
115
|
+
--muted: oklch(0.269 0 0);
|
|
116
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
117
|
+
--accent: oklch(0.269 0 0);
|
|
118
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
119
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
120
|
+
--destructive-foreground: oklch(0.985 0 0);
|
|
121
|
+
--border: oklch(1 0 0 / 10%);
|
|
122
|
+
--input: oklch(1 0 0 / 15%);
|
|
123
|
+
--ring: oklch(0.556 0 0);
|
|
124
|
+
--chart-1: oklch(0.87 0 0);
|
|
125
|
+
--chart-2: oklch(0.556 0 0);
|
|
126
|
+
--chart-3: oklch(0.439 0 0);
|
|
127
|
+
--chart-4: oklch(0.371 0 0);
|
|
128
|
+
--chart-5: oklch(0.269 0 0);
|
|
129
|
+
--sidebar: oklch(0.205 0 0);
|
|
130
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
131
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
132
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
133
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
134
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
135
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
136
|
+
--sidebar-ring: oklch(0.556 0 0);
|
|
137
|
+
|
|
138
|
+
--success: oklch(0.723 0.192 149.579);
|
|
139
|
+
--success-foreground: oklch(0.145 0 0);
|
|
140
|
+
--warning: oklch(0.769 0.188 70.08);
|
|
141
|
+
--warning-foreground: oklch(0.205 0 0);
|
|
142
|
+
--info: oklch(0.707 0.165 254.624);
|
|
143
|
+
--info-foreground: oklch(0.205 0 0);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@layer base {
|
|
147
|
+
* {
|
|
148
|
+
@apply border-border outline-ring/50;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
html {
|
|
152
|
+
@apply font-sans antialiased;
|
|
153
|
+
scroll-behavior: smooth;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
body {
|
|
157
|
+
@apply text-foreground bg-background min-h-screen;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
button:not([disabled]),
|
|
161
|
+
[role='button']:not([disabled]) {
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@media (prefers-reduced-motion: reduce) {
|
|
166
|
+
html {
|
|
167
|
+
scroll-behavior: auto;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@theme inline {
|
|
173
|
+
@keyframes accordion-down {
|
|
174
|
+
from {
|
|
175
|
+
height: 0;
|
|
176
|
+
}
|
|
177
|
+
to {
|
|
178
|
+
height: var(
|
|
179
|
+
--radix-accordion-content-height,
|
|
180
|
+
var(--accordion-panel-height, auto)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@keyframes accordion-up {
|
|
186
|
+
from {
|
|
187
|
+
height: var(
|
|
188
|
+
--radix-accordion-content-height,
|
|
189
|
+
var(--accordion-panel-height, auto)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
to {
|
|
193
|
+
height: 0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@custom-variant data-open {
|
|
199
|
+
&:where([data-state='open']),
|
|
200
|
+
&:where([data-open]:not([data-open='false'])) {
|
|
201
|
+
@slot;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@custom-variant data-closed {
|
|
206
|
+
&:where([data-state='closed']),
|
|
207
|
+
&:where([data-closed]:not([data-closed='false'])) {
|
|
208
|
+
@slot;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@custom-variant data-checked {
|
|
213
|
+
&:where([data-state='checked']),
|
|
214
|
+
&:where([data-checked]:not([data-checked='false'])) {
|
|
215
|
+
@slot;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@custom-variant data-unchecked {
|
|
220
|
+
&:where([data-state='unchecked']),
|
|
221
|
+
&:where([data-unchecked]:not([data-unchecked='false'])) {
|
|
222
|
+
@slot;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@custom-variant data-selected {
|
|
227
|
+
&:where([data-selected='true']) {
|
|
228
|
+
@slot;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@custom-variant data-disabled {
|
|
233
|
+
&:where([data-disabled='true']),
|
|
234
|
+
&:where([data-disabled]:not([data-disabled='false'])) {
|
|
235
|
+
@slot;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@custom-variant data-active {
|
|
240
|
+
&:where([data-state='active']),
|
|
241
|
+
&:where([data-active]:not([data-active='false'])) {
|
|
242
|
+
@slot;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@custom-variant data-horizontal {
|
|
247
|
+
&:where([data-orientation='horizontal']) {
|
|
248
|
+
@slot;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
@custom-variant data-vertical {
|
|
253
|
+
&:where([data-orientation='vertical']) {
|
|
254
|
+
@slot;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
@utility no-scrollbar {
|
|
259
|
+
-ms-overflow-style: none;
|
|
260
|
+
scrollbar-width: none;
|
|
261
|
+
|
|
262
|
+
&::-webkit-scrollbar {
|
|
263
|
+
display: none;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@utility container {
|
|
268
|
+
@apply mx-auto p-4;
|
|
269
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Root layout: document shell, fonts, metadata, and the
|
|
3
|
+
* client providers every page shares (TanStack Query, theme, tooltips,
|
|
4
|
+
* toasts, and the navigation progress bar).
|
|
5
|
+
*
|
|
6
|
+
* @module app/layout
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Metadata, Viewport } from 'next'
|
|
10
|
+
import { Loader } from '~/components/loader'
|
|
11
|
+
import { ReactQueryProvider } from '~/components/react-query-provider'
|
|
12
|
+
import { ScreenSize } from '~/components/screen-size'
|
|
13
|
+
import { ThemeProvider } from '~/components/theme-provider'
|
|
14
|
+
import { Toaster } from '~/components/ui/sonner'
|
|
15
|
+
import { TooltipProvider } from '~/components/ui/tooltip'
|
|
16
|
+
import { env } from '~/env'
|
|
17
|
+
import { siteConfig } from '~/lib/siteConfig'
|
|
18
|
+
import { geistMono, geistSans } from './fonts'
|
|
19
|
+
import './globals.css'
|
|
20
|
+
|
|
21
|
+
export const metadata: Metadata = {
|
|
22
|
+
metadataBase: new URL(env.BETTER_AUTH_URL),
|
|
23
|
+
title: {
|
|
24
|
+
default: siteConfig.name,
|
|
25
|
+
template: `%s | ${siteConfig.name}`
|
|
26
|
+
},
|
|
27
|
+
description: siteConfig.description,
|
|
28
|
+
applicationName: siteConfig.name,
|
|
29
|
+
openGraph: {
|
|
30
|
+
type: 'website',
|
|
31
|
+
locale: 'en_US',
|
|
32
|
+
siteName: siteConfig.name,
|
|
33
|
+
description: siteConfig.description
|
|
34
|
+
},
|
|
35
|
+
twitter: {
|
|
36
|
+
card: 'summary_large_image',
|
|
37
|
+
description: siteConfig.description
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Browser chrome colors, matching `--background` in globals.css. */
|
|
42
|
+
export const viewport: Viewport = {
|
|
43
|
+
themeColor: [
|
|
44
|
+
{ media: '(prefers-color-scheme: light)', color: '#ffffff' },
|
|
45
|
+
{ media: '(prefers-color-scheme: dark)', color: '#0a0a0a' }
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default function RootLayout({
|
|
50
|
+
children
|
|
51
|
+
}: Readonly<{
|
|
52
|
+
children: React.ReactNode
|
|
53
|
+
}>) {
|
|
54
|
+
return (
|
|
55
|
+
<html
|
|
56
|
+
lang="en"
|
|
57
|
+
suppressHydrationWarning
|
|
58
|
+
className={`${geistSans.variable} ${geistMono.variable}`}
|
|
59
|
+
>
|
|
60
|
+
<body>
|
|
61
|
+
<ReactQueryProvider>
|
|
62
|
+
<ThemeProvider>
|
|
63
|
+
<TooltipProvider>
|
|
64
|
+
<Loader />
|
|
65
|
+
{children}
|
|
66
|
+
{env.APP_ENV === 'development' ? <ScreenSize /> : null}
|
|
67
|
+
<Toaster />
|
|
68
|
+
</TooltipProvider>
|
|
69
|
+
</ThemeProvider>
|
|
70
|
+
</ReactQueryProvider>
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Renders every request dynamically, so env-driven metadata stays current. */
|
|
77
|
+
export const dynamic = 'force-dynamic'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 404 Not Found Page
|
|
3
|
+
*
|
|
4
|
+
* Global catch-all page displayed when a route is not found.
|
|
5
|
+
* Redirects users back to the appropriate home page based on the current route context.
|
|
6
|
+
*
|
|
7
|
+
* **Behavior:**
|
|
8
|
+
* - Admin routes (/admin/*) redirect to /admin
|
|
9
|
+
* - All other routes redirect to /
|
|
10
|
+
*
|
|
11
|
+
* @module app/not-found
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
'use client'
|
|
15
|
+
|
|
16
|
+
import Link from 'next/link'
|
|
17
|
+
import { usePathname } from 'next/navigation'
|
|
18
|
+
import { Button } from '~/components/ui/button'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Not Found Page Component
|
|
22
|
+
*
|
|
23
|
+
* Displays a 404 error message with context-aware home button.
|
|
24
|
+
* Uses the current pathname to determine the appropriate home route.
|
|
25
|
+
*
|
|
26
|
+
* @returns {JSX.Element} 404 error page with navigation button
|
|
27
|
+
*/
|
|
28
|
+
export default function NotFound() {
|
|
29
|
+
const pathname = usePathname()
|
|
30
|
+
const homeRoute =
|
|
31
|
+
pathname?.startsWith('/admin') && pathname !== '/admin' ? '/admin' : '/'
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<main className="bg-background text-foreground flex min-h-screen flex-col">
|
|
35
|
+
<section className="flex min-h-[60vh] flex-col items-center justify-center px-4">
|
|
36
|
+
<div className="text-center">
|
|
37
|
+
<h1 className="text-foreground mb-2 text-6xl font-bold">404</h1>
|
|
38
|
+
<p className="text-muted-foreground mb-8 text-xl">Page not found</p>
|
|
39
|
+
<p className="text-muted-foreground mb-8 max-w-md text-base">
|
|
40
|
+
The page you're looking for doesn't exist.
|
|
41
|
+
</p>
|
|
42
|
+
<Button asChild>
|
|
43
|
+
<Link href={homeRoute}>Return Home</Link>
|
|
44
|
+
</Button>
|
|
45
|
+
</div>
|
|
46
|
+
</section>
|
|
47
|
+
</main>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { MetadataRoute } from 'next'
|
|
2
|
+
import { env } from '~/env'
|
|
3
|
+
|
|
4
|
+
/** Renders every request dynamically, so the environment check is live. */
|
|
5
|
+
export const dynamic = 'force-dynamic'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* robots.txt. Staging blocks every crawler; production keeps signed-in
|
|
9
|
+
* surfaces and the API out of search results.
|
|
10
|
+
*/
|
|
11
|
+
export default function robots(): MetadataRoute.Robots {
|
|
12
|
+
if (env.APP_ENV === 'staging') {
|
|
13
|
+
return { rules: [{ userAgent: '*', disallow: '/' }] }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const baseUrl = env.BETTER_AUTH_URL
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
rules: [
|
|
20
|
+
{
|
|
21
|
+
userAgent: '*',
|
|
22
|
+
allow: '/',
|
|
23
|
+
disallow: [
|
|
24
|
+
'/api/',
|
|
25
|
+
'/admin',
|
|
26
|
+
'/app',
|
|
27
|
+
'/accept-invitation',
|
|
28
|
+
'/profile',
|
|
29
|
+
'/support'
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
sitemap: `${baseUrl}/sitemap.xml`,
|
|
34
|
+
host: baseUrl
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MetadataRoute } from 'next'
|
|
2
|
+
import { env } from '~/env'
|
|
3
|
+
|
|
4
|
+
export const dynamic = 'force-dynamic'
|
|
5
|
+
|
|
6
|
+
/** Public pages only. Staging returns an empty sitemap. */
|
|
7
|
+
export default function sitemap(): MetadataRoute.Sitemap {
|
|
8
|
+
if (env.APP_ENV === 'staging') return []
|
|
9
|
+
|
|
10
|
+
const baseUrl = env.BETTER_AUTH_URL
|
|
11
|
+
const lastModified = new Date()
|
|
12
|
+
|
|
13
|
+
const routes = ['/', '/contact-us', '/privacy', '/terms', '/login']
|
|
14
|
+
|
|
15
|
+
return routes.map(path => ({
|
|
16
|
+
url: `${baseUrl}${path === '/' ? '' : path}`,
|
|
17
|
+
lastModified,
|
|
18
|
+
changeFrequency: path === '/' ? 'weekly' : 'monthly',
|
|
19
|
+
priority: path === '/' ? 1 : 0.7
|
|
20
|
+
}))
|
|
21
|
+
}
|