tvi-cli 0.1.4
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 +147 -0
- package/dist/index.js +4315 -0
- package/package.json +75 -0
- package/templates/addons/biome/biome.json.hbs +83 -0
- package/templates/addons/husky/.husky/pre-commit +1 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/apple-touch-icon.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/favicon-96x96.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/favicon.svg +6 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/site.webmanifest.hbs +21 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-192x192.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-512x512.png +0 -0
- package/templates/addons/pwa/apps/web/next/src/app/manifest.ts.hbs +26 -0
- package/templates/addons/pwa/apps/web/vite/public/logo.png +0 -0
- package/templates/addons/pwa/apps/web/vite/pwa-assets.config.ts.hbs +12 -0
- package/templates/addons/turborepo/turbo.json.hbs +43 -0
- package/templates/api/orpc/native/utils/orpc.ts.hbs +35 -0
- package/templates/api/orpc/server/base/src/lib/context.ts.hbs +125 -0
- package/templates/api/orpc/server/base/src/lib/orpc.ts.hbs +21 -0
- package/templates/api/orpc/server/next/src/app/rpc/[...all]/route.ts.hbs +23 -0
- package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +35 -0
- package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +42 -0
- package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +30 -0
- package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +31 -0
- package/templates/api/trpc/native/utils/trpc.ts.hbs +32 -0
- package/templates/api/trpc/server/base/src/lib/context.ts.hbs +127 -0
- package/templates/api/trpc/server/base/src/lib/trpc.ts.hbs +26 -0
- package/templates/api/trpc/server/next/src/app/trpc/[trpc]/route.ts +14 -0
- package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +97 -0
- package/templates/auth/native/native-base/lib/auth-client.ts.hbs +13 -0
- package/templates/auth/native/nativewind/app/(drawer)/index.tsx.hbs +95 -0
- package/templates/auth/native/nativewind/components/sign-in.tsx.hbs +93 -0
- package/templates/auth/native/nativewind/components/sign-up.tsx.hbs +104 -0
- package/templates/auth/native/unistyles/app/(drawer)/index.tsx.hbs +179 -0
- package/templates/auth/native/unistyles/components/sign-in.tsx.hbs +134 -0
- package/templates/auth/native/unistyles/components/sign-up.tsx.hbs +152 -0
- package/templates/auth/server/base/src/lib/auth.ts.hbs +141 -0
- package/templates/auth/server/db/drizzle/mysql/src/db/schema/auth.ts +58 -0
- package/templates/auth/server/db/drizzle/postgres/src/db/schema/auth.ts +47 -0
- package/templates/auth/server/db/drizzle/sqlite/src/db/schema/auth.ts +55 -0
- package/templates/auth/server/db/mongoose/mongodb/src/db/models/auth.model.ts +68 -0
- package/templates/auth/server/db/prisma/mongodb/prisma/schema/auth.prisma +59 -0
- package/templates/auth/server/db/prisma/mysql/prisma/schema/auth.prisma +59 -0
- package/templates/auth/server/db/prisma/postgres/prisma/schema/auth.prisma +59 -0
- package/templates/auth/server/db/prisma/sqlite/prisma/schema/auth.prisma +59 -0
- package/templates/auth/server/next/src/app/api/auth/[...all]/route.ts +4 -0
- package/templates/auth/web/nuxt/app/components/SignInForm.vue +77 -0
- package/templates/auth/web/nuxt/app/components/SignUpForm.vue +84 -0
- package/templates/auth/web/nuxt/app/components/UserMenu.vue +42 -0
- package/templates/auth/web/nuxt/app/middleware/auth.ts +12 -0
- package/templates/auth/web/nuxt/app/pages/dashboard.vue +27 -0
- package/templates/auth/web/nuxt/app/pages/login.vue +24 -0
- package/templates/auth/web/nuxt/app/plugins/auth-client.ts +16 -0
- package/templates/auth/web/react/base/src/lib/auth-client.ts.hbs +10 -0
- package/templates/auth/web/react/next/src/app/dashboard/page.tsx.hbs +47 -0
- package/templates/auth/web/react/next/src/app/login/page.tsx +16 -0
- package/templates/auth/web/react/next/src/components/sign-in-form.tsx +135 -0
- package/templates/auth/web/react/next/src/components/sign-up-form.tsx +160 -0
- package/templates/auth/web/react/next/src/components/theme-provider.tsx +11 -0
- package/templates/auth/web/react/next/src/components/user-menu.tsx +60 -0
- package/templates/auth/web/react/react-router/src/components/sign-in-form.tsx +135 -0
- package/templates/auth/web/react/react-router/src/components/sign-up-form.tsx +160 -0
- package/templates/auth/web/react/react-router/src/components/user-menu.tsx +60 -0
- package/templates/auth/web/react/react-router/src/routes/dashboard.tsx.hbs +40 -0
- package/templates/auth/web/react/react-router/src/routes/login.tsx +13 -0
- package/templates/auth/web/react/tanstack-router/src/components/sign-in-form.tsx +139 -0
- package/templates/auth/web/react/tanstack-router/src/components/sign-up-form.tsx +164 -0
- package/templates/auth/web/react/tanstack-router/src/components/user-menu.tsx +62 -0
- package/templates/auth/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +47 -0
- package/templates/auth/web/react/tanstack-router/src/routes/login.tsx +18 -0
- package/templates/auth/web/react/tanstack-start/src/components/sign-in-form.tsx +139 -0
- package/templates/auth/web/react/tanstack-start/src/components/sign-up-form.tsx +164 -0
- package/templates/auth/web/react/tanstack-start/src/components/user-menu.tsx +62 -0
- package/templates/auth/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +51 -0
- package/templates/auth/web/react/tanstack-start/src/routes/login.tsx +18 -0
- package/templates/auth/web/solid/src/components/sign-in-form.tsx +132 -0
- package/templates/auth/web/solid/src/components/sign-up-form.tsx +158 -0
- package/templates/auth/web/solid/src/components/user-menu.tsx.hbs +55 -0
- package/templates/auth/web/solid/src/lib/auth-client.ts +5 -0
- package/templates/auth/web/solid/src/routes/dashboard.tsx +38 -0
- package/templates/auth/web/solid/src/routes/login.tsx +23 -0
- package/templates/auth/web/svelte/src/components/SignInForm.svelte +108 -0
- package/templates/auth/web/svelte/src/components/SignUpForm.svelte +142 -0
- package/templates/auth/web/svelte/src/components/UserMenu.svelte +54 -0
- package/templates/auth/web/svelte/src/lib/auth-client.ts +6 -0
- package/templates/auth/web/svelte/src/routes/dashboard/+page.svelte +31 -0
- package/templates/auth/web/svelte/src/routes/login/+page.svelte +12 -0
- package/templates/backend/convex/packages/backend/_gitignore +2 -0
- package/templates/backend/convex/packages/backend/convex/README.md +90 -0
- package/templates/backend/convex/packages/backend/convex/healthCheck.ts +7 -0
- package/templates/backend/convex/packages/backend/convex/schema.ts +9 -0
- package/templates/backend/convex/packages/backend/convex/todos.ts +42 -0
- package/templates/backend/convex/packages/backend/convex/tsconfig.json +25 -0
- package/templates/backend/convex/packages/backend/package.json.hbs +17 -0
- package/templates/backend/server/elysia/src/index.ts.hbs +72 -0
- package/templates/backend/server/express/src/index.ts.hbs +88 -0
- package/templates/backend/server/fastify/src/index.ts.hbs +155 -0
- package/templates/backend/server/hono/src/index.ts.hbs +133 -0
- package/templates/backend/server/next/next-env.d.ts +5 -0
- package/templates/backend/server/next/next.config.ts +7 -0
- package/templates/backend/server/next/package.json.hbs +24 -0
- package/templates/backend/server/next/src/app/route.ts +5 -0
- package/templates/backend/server/next/src/middleware.ts +19 -0
- package/templates/backend/server/next/tsconfig.json.hbs +33 -0
- package/templates/backend/server/server-base/_gitignore +52 -0
- package/templates/backend/server/server-base/package.json.hbs +28 -0
- package/templates/backend/server/server-base/src/routers/index.ts.hbs +53 -0
- package/templates/backend/server/server-base/tsconfig.json.hbs +39 -0
- package/templates/base/_gitignore +2 -0
- package/templates/base/package.json.hbs +11 -0
- package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +10 -0
- package/templates/db/drizzle/mysql/src/db/index.ts.hbs +20 -0
- package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +10 -0
- package/templates/db/drizzle/postgres/src/db/index.ts.hbs +12 -0
- package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +24 -0
- package/templates/db/drizzle/sqlite/src/db/index.ts.hbs +35 -0
- package/templates/db/mongoose/mongodb/src/db/index.ts.hbs +9 -0
- package/templates/db/prisma/mongodb/prisma/index.ts.hbs +5 -0
- package/templates/db/prisma/mongodb/prisma/schema/schema.prisma +10 -0
- package/templates/db/prisma/mongodb/prisma.config.ts.hbs +8 -0
- package/templates/db/prisma/mysql/prisma/index.ts +5 -0
- package/templates/db/prisma/mysql/prisma/schema/schema.prisma +10 -0
- package/templates/db/prisma/mysql/prisma.config.ts +8 -0
- package/templates/db/prisma/postgres/prisma/index.ts +5 -0
- package/templates/db/prisma/postgres/prisma/schema/schema.prisma.hbs +13 -0
- package/templates/db/prisma/postgres/prisma.config.ts.hbs +12 -0
- package/templates/db/prisma/sqlite/prisma/index.ts +5 -0
- package/templates/db/prisma/sqlite/prisma/schema/schema.prisma +10 -0
- package/templates/db/prisma/sqlite/prisma.config.ts +8 -0
- package/templates/examples/ai/native/nativewind/app/(drawer)/ai.tsx.hbs +155 -0
- package/templates/examples/ai/native/nativewind/polyfills.js +25 -0
- package/templates/examples/ai/native/unistyles/app/(drawer)/ai.tsx.hbs +279 -0
- package/templates/examples/ai/native/unistyles/polyfills.js +25 -0
- package/templates/examples/ai/server/next/src/app/ai/route.ts +15 -0
- package/templates/examples/ai/web/nuxt/app/pages/ai.vue +63 -0
- package/templates/examples/ai/web/react/next/src/app/ai/page.tsx +67 -0
- package/templates/examples/ai/web/react/react-router/src/routes/ai.tsx +64 -0
- package/templates/examples/ai/web/react/tanstack-router/src/routes/ai.tsx +69 -0
- package/templates/examples/ai/web/react/tanstack-start/src/routes/ai.tsx +69 -0
- package/templates/examples/ai/web/svelte/src/routes/ai/+page.svelte +98 -0
- package/templates/examples/todo/native/nativewind/app/(drawer)/todos.tsx.hbs +295 -0
- package/templates/examples/todo/native/unistyles/app/(drawer)/todos.tsx.hbs +340 -0
- package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +79 -0
- package/templates/examples/todo/server/drizzle/mysql/src/db/schema/todo.ts +7 -0
- package/templates/examples/todo/server/drizzle/postgres/src/db/schema/todo.ts +7 -0
- package/templates/examples/todo/server/drizzle/sqlite/src/db/schema/todo.ts +7 -0
- package/templates/examples/todo/server/mongoose/base/src/routers/todo.ts.hbs +66 -0
- package/templates/examples/todo/server/mongoose/mongodb/src/db/models/todo.model.ts +24 -0
- package/templates/examples/todo/server/prisma/base/src/routers/todo.ts.hbs +118 -0
- package/templates/examples/todo/server/prisma/mongodb/prisma/schema/todo.prisma +7 -0
- package/templates/examples/todo/server/prisma/mysql/prisma/schema/todo.prisma +7 -0
- package/templates/examples/todo/server/prisma/postgres/prisma/schema/todo.prisma +7 -0
- package/templates/examples/todo/server/prisma/sqlite/prisma/schema/todo.prisma +7 -0
- package/templates/examples/todo/web/nuxt/app/pages/todos.vue +108 -0
- package/templates/examples/todo/web/react/next/src/app/todos/page.tsx.hbs +245 -0
- package/templates/examples/todo/web/react/react-router/src/routes/todos.tsx.hbs +242 -0
- package/templates/examples/todo/web/react/tanstack-router/src/routes/todos.tsx.hbs +247 -0
- package/templates/examples/todo/web/react/tanstack-start/src/routes/todos.tsx.hbs +268 -0
- package/templates/examples/todo/web/solid/src/routes/todos.tsx.hbs +132 -0
- package/templates/examples/todo/web/svelte/src/routes/todos/+page.svelte.hbs +317 -0
- package/templates/extras/_npmrc.hbs +5 -0
- package/templates/extras/pnpm-workspace.yaml +3 -0
- package/templates/frontend/native/native-base/assets/adaptive-icon.png +0 -0
- package/templates/frontend/native/native-base/assets/favicon.png +0 -0
- package/templates/frontend/native/native-base/assets/icon.png +0 -0
- package/templates/frontend/native/native-base/assets/splash.png +0 -0
- package/templates/frontend/native/nativewind/_gitignore +25 -0
- package/templates/frontend/native/nativewind/app/(drawer)/(tabs)/_layout.tsx +46 -0
- package/templates/frontend/native/nativewind/app/(drawer)/(tabs)/index.tsx +19 -0
- package/templates/frontend/native/nativewind/app/(drawer)/(tabs)/two.tsx +19 -0
- package/templates/frontend/native/nativewind/app/(drawer)/_layout.tsx.hbs +67 -0
- package/templates/frontend/native/nativewind/app/(drawer)/index.tsx.hbs +95 -0
- package/templates/frontend/native/nativewind/app/+html.tsx +47 -0
- package/templates/frontend/native/nativewind/app/+not-found.tsx +29 -0
- package/templates/frontend/native/nativewind/app/_layout.tsx.hbs +126 -0
- package/templates/frontend/native/nativewind/app/modal.tsx +14 -0
- package/templates/frontend/native/nativewind/app-env.d.ts +2 -0
- package/templates/frontend/native/nativewind/app.json +46 -0
- package/templates/frontend/native/nativewind/babel.config.js +11 -0
- package/templates/frontend/native/nativewind/components/container.tsx +8 -0
- package/templates/frontend/native/nativewind/components/header-button.tsx +26 -0
- package/templates/frontend/native/nativewind/components/tabbar-icon.tsx +8 -0
- package/templates/frontend/native/nativewind/global.css +50 -0
- package/templates/frontend/native/nativewind/lib/android-navigation-bar.tsx +11 -0
- package/templates/frontend/native/nativewind/lib/constants.ts +18 -0
- package/templates/frontend/native/nativewind/lib/use-color-scheme.ts +12 -0
- package/templates/frontend/native/nativewind/metro.config.js +59 -0
- package/templates/frontend/native/nativewind/package.json.hbs +49 -0
- package/templates/frontend/native/nativewind/tailwind.config.js +59 -0
- package/templates/frontend/native/nativewind/tsconfig.json.hbs +23 -0
- package/templates/frontend/native/unistyles/_gitignore +24 -0
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/_layout.tsx +39 -0
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/index.tsx +37 -0
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/two.tsx +37 -0
- package/templates/frontend/native/unistyles/app/(drawer)/_layout.tsx.hbs +87 -0
- package/templates/frontend/native/unistyles/app/(drawer)/index.tsx.hbs +194 -0
- package/templates/frontend/native/unistyles/app/+html.tsx +48 -0
- package/templates/frontend/native/unistyles/app/+not-found.tsx +65 -0
- package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +104 -0
- package/templates/frontend/native/unistyles/app/modal.tsx +33 -0
- package/templates/frontend/native/unistyles/app.json +44 -0
- package/templates/frontend/native/unistyles/babel.config.js +20 -0
- package/templates/frontend/native/unistyles/breakpoints.ts +9 -0
- package/templates/frontend/native/unistyles/components/container.tsx +15 -0
- package/templates/frontend/native/unistyles/components/header-button.tsx +36 -0
- package/templates/frontend/native/unistyles/components/tabbar-icon.tsx +8 -0
- package/templates/frontend/native/unistyles/expo-env.d.ts +3 -0
- package/templates/frontend/native/unistyles/index.js +2 -0
- package/templates/frontend/native/unistyles/metro.config.js +20 -0
- package/templates/frontend/native/unistyles/package.json.hbs +50 -0
- package/templates/frontend/native/unistyles/theme.ts +98 -0
- package/templates/frontend/native/unistyles/tsconfig.json.hbs +17 -0
- package/templates/frontend/native/unistyles/unistyles.ts +27 -0
- package/templates/frontend/nuxt/_gitignore +24 -0
- package/templates/frontend/nuxt/app/app.config.ts +15 -0
- package/templates/frontend/nuxt/app/app.vue +13 -0
- package/templates/frontend/nuxt/app/assets/css/main.css +2 -0
- package/templates/frontend/nuxt/app/components/Header.vue.hbs +45 -0
- package/templates/frontend/nuxt/app/components/Loader.vue +5 -0
- package/templates/frontend/nuxt/app/components/ModeToggle.vue +23 -0
- package/templates/frontend/nuxt/app/layouts/default.vue.hbs +11 -0
- package/templates/frontend/nuxt/app/pages/index.vue.hbs +57 -0
- package/templates/frontend/nuxt/app/plugins/vue-query.ts.hbs +44 -0
- package/templates/frontend/nuxt/nuxt.config.ts.hbs +19 -0
- package/templates/frontend/nuxt/package.json.hbs +25 -0
- package/templates/frontend/nuxt/public/favicon.ico +0 -0
- package/templates/frontend/nuxt/public/robots.txt +2 -0
- package/templates/frontend/nuxt/server/tsconfig.json +3 -0
- package/templates/frontend/nuxt/tsconfig.json.hbs +9 -0
- package/templates/frontend/react/next/next-env.d.ts.hbs +5 -0
- package/templates/frontend/react/next/next.config.ts.hbs +5 -0
- package/templates/frontend/react/next/package.json.hbs +34 -0
- package/templates/frontend/react/next/postcss.config.mjs.hbs +5 -0
- package/templates/frontend/react/next/src/app/favicon.ico +0 -0
- package/templates/frontend/react/next/src/app/layout.tsx.hbs +41 -0
- package/templates/frontend/react/next/src/app/page.tsx.hbs +68 -0
- package/templates/frontend/react/next/src/components/mode-toggle.tsx.hbs +39 -0
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +56 -0
- package/templates/frontend/react/next/src/components/theme-provider.tsx.hbs +11 -0
- package/templates/frontend/react/next/tsconfig.json.hbs +33 -0
- package/templates/frontend/react/react-router/package.json.hbs +42 -0
- package/templates/frontend/react/react-router/public/favicon.ico +0 -0
- package/templates/frontend/react/react-router/react-router.config.ts +6 -0
- package/templates/frontend/react/react-router/src/components/mode-toggle.tsx +37 -0
- package/templates/frontend/react/react-router/src/components/theme-provider.tsx +73 -0
- package/templates/frontend/react/react-router/src/root.tsx.hbs +152 -0
- package/templates/frontend/react/react-router/src/routes/_index.tsx.hbs +74 -0
- package/templates/frontend/react/react-router/src/routes.ts +4 -0
- package/templates/frontend/react/react-router/tsconfig.json.hbs +32 -0
- package/templates/frontend/react/react-router/vite.config.ts.hbs +33 -0
- package/templates/frontend/react/tanstack-router/index.html +12 -0
- package/templates/frontend/react/tanstack-router/package.json.hbs +41 -0
- package/templates/frontend/react/tanstack-router/src/components/mode-toggle.tsx +37 -0
- package/templates/frontend/react/tanstack-router/src/components/theme-provider.tsx +73 -0
- package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +66 -0
- package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +100 -0
- package/templates/frontend/react/tanstack-router/src/routes/index.tsx.hbs +74 -0
- package/templates/frontend/react/tanstack-router/tsconfig.json.hbs +23 -0
- package/templates/frontend/react/tanstack-router/vite.config.ts.hbs +39 -0
- package/templates/frontend/react/tanstack-start/package.json.hbs +44 -0
- package/templates/frontend/react/tanstack-start/public/robots.txt +3 -0
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +144 -0
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +97 -0
- package/templates/frontend/react/tanstack-start/src/routes/index.tsx.hbs +74 -0
- package/templates/frontend/react/tanstack-start/tsconfig.json.hbs +33 -0
- package/templates/frontend/react/tanstack-start/vite.config.ts +8 -0
- package/templates/frontend/react/web-base/_gitignore +52 -0
- package/templates/frontend/react/web-base/components.json +21 -0
- package/templates/frontend/react/web-base/src/components/header.tsx.hbs +79 -0
- package/templates/frontend/react/web-base/src/components/loader.tsx +9 -0
- package/templates/frontend/react/web-base/src/components/ui/button.tsx +59 -0
- package/templates/frontend/react/web-base/src/components/ui/card.tsx +92 -0
- package/templates/frontend/react/web-base/src/components/ui/checkbox.tsx +30 -0
- package/templates/frontend/react/web-base/src/components/ui/dropdown-menu.tsx +257 -0
- package/templates/frontend/react/web-base/src/components/ui/input.tsx +21 -0
- package/templates/frontend/react/web-base/src/components/ui/label.tsx +22 -0
- package/templates/frontend/react/web-base/src/components/ui/skeleton.tsx +13 -0
- package/templates/frontend/react/web-base/src/components/ui/sonner.tsx +25 -0
- package/templates/frontend/react/web-base/src/index.css +134 -0
- package/templates/frontend/react/web-base/src/lib/utils.ts +6 -0
- package/templates/frontend/solid/_gitignore +7 -0
- package/templates/frontend/solid/index.html +13 -0
- package/templates/frontend/solid/package.json.hbs +27 -0
- package/templates/frontend/solid/public/robots.txt +3 -0
- package/templates/frontend/solid/src/components/header.tsx.hbs +38 -0
- package/templates/frontend/solid/src/components/loader.tsx +9 -0
- package/templates/frontend/solid/src/main.tsx.hbs +38 -0
- package/templates/frontend/solid/src/routes/__root.tsx.hbs +34 -0
- package/templates/frontend/solid/src/routes/index.tsx.hbs +61 -0
- package/templates/frontend/solid/src/styles.css +5 -0
- package/templates/frontend/solid/tsconfig.json.hbs +34 -0
- package/templates/frontend/solid/vite.config.js.hbs +39 -0
- package/templates/frontend/svelte/_gitignore +23 -0
- package/templates/frontend/svelte/_npmrc +1 -0
- package/templates/frontend/svelte/package.json.hbs +31 -0
- package/templates/frontend/svelte/src/app.css +5 -0
- package/templates/frontend/svelte/src/app.d.ts +13 -0
- package/templates/frontend/svelte/src/app.html +12 -0
- package/templates/frontend/svelte/src/components/Header.svelte.hbs +40 -0
- package/templates/frontend/svelte/src/lib/index.ts +1 -0
- package/templates/frontend/svelte/src/routes/+layout.svelte.hbs +54 -0
- package/templates/frontend/svelte/src/routes/+page.svelte.hbs +72 -0
- package/templates/frontend/svelte/static/favicon.png +0 -0
- package/templates/frontend/svelte/svelte.config.js +18 -0
- package/templates/frontend/svelte/tsconfig.json.hbs +24 -0
- package/templates/frontend/svelte/vite.config.ts +7 -0
- package/templates/runtime/workers/apps/server/wrangler.jsonc.hbs +34 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
import { createAuthClient } from "better-auth/vue";
|
2
|
+
|
3
|
+
export default defineNuxtPlugin(nuxtApp => {
|
4
|
+
const config = useRuntimeConfig()
|
5
|
+
const serverUrl = config.public.serverURL
|
6
|
+
|
7
|
+
const authClient = createAuthClient({
|
8
|
+
baseURL: serverUrl
|
9
|
+
})
|
10
|
+
|
11
|
+
return {
|
12
|
+
provide: {
|
13
|
+
authClient: authClient
|
14
|
+
}
|
15
|
+
}
|
16
|
+
})
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use client"
|
2
|
+
import { authClient } from "@/lib/auth-client";
|
3
|
+
{{#if (eq api "orpc")}}
|
4
|
+
import { useQuery } from "@tanstack/react-query";
|
5
|
+
import { orpc } from "@/utils/orpc";
|
6
|
+
{{/if}}
|
7
|
+
{{#if (eq api "trpc")}}
|
8
|
+
import { useQuery } from "@tanstack/react-query";
|
9
|
+
import { trpc } from "@/utils/trpc";
|
10
|
+
{{/if}}
|
11
|
+
import { useRouter } from "next/navigation";
|
12
|
+
import { useEffect } from "react";
|
13
|
+
|
14
|
+
export default function Dashboard() {
|
15
|
+
const router = useRouter();
|
16
|
+
const { data: session, isPending } = authClient.useSession();
|
17
|
+
|
18
|
+
{{#if (eq api "orpc")}}
|
19
|
+
const privateData = useQuery(orpc.privateData.queryOptions());
|
20
|
+
{{/if}}
|
21
|
+
{{#if (eq api "trpc")}}
|
22
|
+
const privateData = useQuery(trpc.privateData.queryOptions());
|
23
|
+
{{/if}}
|
24
|
+
|
25
|
+
useEffect(() => {
|
26
|
+
if (!session && !isPending) {
|
27
|
+
router.push("/login");
|
28
|
+
}
|
29
|
+
}, [session, isPending]);
|
30
|
+
|
31
|
+
if (isPending) {
|
32
|
+
return <div>Loading...</div>;
|
33
|
+
}
|
34
|
+
|
35
|
+
return (
|
36
|
+
<div>
|
37
|
+
<h1>Dashboard</h1>
|
38
|
+
<p>Welcome {session?.user.name}</p>
|
39
|
+
{{#if (eq api "orpc")}}
|
40
|
+
<p>privateData: {privateData.data?.message}</p>
|
41
|
+
{{/if}}
|
42
|
+
{{#if (eq api "trpc")}}
|
43
|
+
<p>privateData: {privateData.data?.message}</p>
|
44
|
+
{{/if}}
|
45
|
+
</div>
|
46
|
+
);
|
47
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import SignInForm from "@/components/sign-in-form";
|
4
|
+
import SignUpForm from "@/components/sign-up-form";
|
5
|
+
import { useState } from "react";
|
6
|
+
|
7
|
+
|
8
|
+
export default function LoginPage() {
|
9
|
+
const [showSignIn, setShowSignIn] = useState(false);
|
10
|
+
|
11
|
+
return showSignIn ? (
|
12
|
+
<SignInForm onSwitchToSignUp={() => setShowSignIn(false)} />
|
13
|
+
) : (
|
14
|
+
<SignUpForm onSwitchToSignIn={() => setShowSignIn(true)} />
|
15
|
+
);
|
16
|
+
}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
import { authClient } from "@/lib/auth-client";
|
2
|
+
import { useForm } from "@tanstack/react-form";
|
3
|
+
import { toast } from "sonner";
|
4
|
+
import z from "zod/v4";
|
5
|
+
import Loader from "./loader";
|
6
|
+
import { Button } from "./ui/button";
|
7
|
+
import { Input } from "./ui/input";
|
8
|
+
import { Label } from "./ui/label";
|
9
|
+
import { useRouter } from "next/navigation";
|
10
|
+
|
11
|
+
export default function SignInForm({
|
12
|
+
onSwitchToSignUp,
|
13
|
+
}: {
|
14
|
+
onSwitchToSignUp: () => void;
|
15
|
+
}) {
|
16
|
+
const router = useRouter()
|
17
|
+
const { isPending } = authClient.useSession();
|
18
|
+
|
19
|
+
const form = useForm({
|
20
|
+
defaultValues: {
|
21
|
+
email: "",
|
22
|
+
password: "",
|
23
|
+
},
|
24
|
+
onSubmit: async ({ value }) => {
|
25
|
+
await authClient.signIn.email(
|
26
|
+
{
|
27
|
+
email: value.email,
|
28
|
+
password: value.password,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
onSuccess: () => {
|
32
|
+
router.push("/dashboard")
|
33
|
+
toast.success("Sign in successful");
|
34
|
+
},
|
35
|
+
onError: (error) => {
|
36
|
+
toast.error(error.error.message);
|
37
|
+
},
|
38
|
+
},
|
39
|
+
);
|
40
|
+
},
|
41
|
+
validators: {
|
42
|
+
onSubmit: z.object({
|
43
|
+
email: z.email("Invalid email address"),
|
44
|
+
password: z.string().min(8, "Password must be at least 8 characters"),
|
45
|
+
}),
|
46
|
+
},
|
47
|
+
});
|
48
|
+
|
49
|
+
if (isPending) {
|
50
|
+
return <Loader />;
|
51
|
+
}
|
52
|
+
|
53
|
+
return (
|
54
|
+
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
55
|
+
<h1 className="mb-6 text-center text-3xl font-bold">Welcome Back</h1>
|
56
|
+
|
57
|
+
<form
|
58
|
+
onSubmit={(e) => {
|
59
|
+
e.preventDefault();
|
60
|
+
e.stopPropagation();
|
61
|
+
void form.handleSubmit();
|
62
|
+
}}
|
63
|
+
className="space-y-4"
|
64
|
+
>
|
65
|
+
<div>
|
66
|
+
<form.Field name="email">
|
67
|
+
{(field) => (
|
68
|
+
<div className="space-y-2">
|
69
|
+
<Label htmlFor={field.name}>Email</Label>
|
70
|
+
<Input
|
71
|
+
id={field.name}
|
72
|
+
name={field.name}
|
73
|
+
type="email"
|
74
|
+
value={field.state.value}
|
75
|
+
onBlur={field.handleBlur}
|
76
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
77
|
+
/>
|
78
|
+
{field.state.meta.errors.map((error) => (
|
79
|
+
<p key={error?.message} className="text-red-500">
|
80
|
+
{error?.message}
|
81
|
+
</p>
|
82
|
+
))}
|
83
|
+
</div>
|
84
|
+
)}
|
85
|
+
</form.Field>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div>
|
89
|
+
<form.Field name="password">
|
90
|
+
{(field) => (
|
91
|
+
<div className="space-y-2">
|
92
|
+
<Label htmlFor={field.name}>Password</Label>
|
93
|
+
<Input
|
94
|
+
id={field.name}
|
95
|
+
name={field.name}
|
96
|
+
type="password"
|
97
|
+
value={field.state.value}
|
98
|
+
onBlur={field.handleBlur}
|
99
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
100
|
+
/>
|
101
|
+
{field.state.meta.errors.map((error) => (
|
102
|
+
<p key={error?.message} className="text-red-500">
|
103
|
+
{error?.message}
|
104
|
+
</p>
|
105
|
+
))}
|
106
|
+
</div>
|
107
|
+
)}
|
108
|
+
</form.Field>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<form.Subscribe>
|
112
|
+
{(state) => (
|
113
|
+
<Button
|
114
|
+
type="submit"
|
115
|
+
className="w-full"
|
116
|
+
disabled={!state.canSubmit || state.isSubmitting}
|
117
|
+
>
|
118
|
+
{state.isSubmitting ? "Submitting..." : "Sign In"}
|
119
|
+
</Button>
|
120
|
+
)}
|
121
|
+
</form.Subscribe>
|
122
|
+
</form>
|
123
|
+
|
124
|
+
<div className="mt-4 text-center">
|
125
|
+
<Button
|
126
|
+
variant="link"
|
127
|
+
onClick={onSwitchToSignUp}
|
128
|
+
className="text-indigo-600 hover:text-indigo-800"
|
129
|
+
>
|
130
|
+
Need an account? Sign Up
|
131
|
+
</Button>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
);
|
135
|
+
}
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import { authClient } from "@/lib/auth-client";
|
2
|
+
import { useForm } from "@tanstack/react-form";
|
3
|
+
import { toast } from "sonner";
|
4
|
+
import z from "zod/v4";
|
5
|
+
import Loader from "./loader";
|
6
|
+
import { Button } from "./ui/button";
|
7
|
+
import { Input } from "./ui/input";
|
8
|
+
import { Label } from "./ui/label";
|
9
|
+
import { useRouter } from "next/navigation";
|
10
|
+
|
11
|
+
export default function SignUpForm({
|
12
|
+
onSwitchToSignIn,
|
13
|
+
}: {
|
14
|
+
onSwitchToSignIn: () => void;
|
15
|
+
}) {
|
16
|
+
const router = useRouter();
|
17
|
+
const { isPending } = authClient.useSession();
|
18
|
+
|
19
|
+
const form = useForm({
|
20
|
+
defaultValues: {
|
21
|
+
email: "",
|
22
|
+
password: "",
|
23
|
+
name: "",
|
24
|
+
},
|
25
|
+
onSubmit: async ({ value }) => {
|
26
|
+
await authClient.signUp.email(
|
27
|
+
{
|
28
|
+
email: value.email,
|
29
|
+
password: value.password,
|
30
|
+
name: value.name,
|
31
|
+
},
|
32
|
+
{
|
33
|
+
onSuccess: () => {
|
34
|
+
router.push("/dashboard");
|
35
|
+
toast.success("Sign up successful");
|
36
|
+
},
|
37
|
+
onError: (error) => {
|
38
|
+
toast.error(error.error.message);
|
39
|
+
},
|
40
|
+
},
|
41
|
+
);
|
42
|
+
},
|
43
|
+
validators: {
|
44
|
+
onSubmit: z.object({
|
45
|
+
name: z.string().min(2, "Name must be at least 2 characters"),
|
46
|
+
email: z.email("Invalid email address"),
|
47
|
+
password: z.string().min(8, "Password must be at least 8 characters"),
|
48
|
+
}),
|
49
|
+
},
|
50
|
+
});
|
51
|
+
|
52
|
+
if (isPending) {
|
53
|
+
return <Loader />;
|
54
|
+
}
|
55
|
+
|
56
|
+
return (
|
57
|
+
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
58
|
+
<h1 className="mb-6 text-center text-3xl font-bold">Create Account</h1>
|
59
|
+
|
60
|
+
<form
|
61
|
+
onSubmit={(e) => {
|
62
|
+
e.preventDefault();
|
63
|
+
e.stopPropagation();
|
64
|
+
void form.handleSubmit();
|
65
|
+
}}
|
66
|
+
className="space-y-4"
|
67
|
+
>
|
68
|
+
<div>
|
69
|
+
<form.Field name="name">
|
70
|
+
{(field) => (
|
71
|
+
<div className="space-y-2">
|
72
|
+
<Label htmlFor={field.name}>Name</Label>
|
73
|
+
<Input
|
74
|
+
id={field.name}
|
75
|
+
name={field.name}
|
76
|
+
value={field.state.value}
|
77
|
+
onBlur={field.handleBlur}
|
78
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
79
|
+
/>
|
80
|
+
{field.state.meta.errors.map((error) => (
|
81
|
+
<p key={error?.message} className="text-red-500">
|
82
|
+
{error?.message}
|
83
|
+
</p>
|
84
|
+
))}
|
85
|
+
</div>
|
86
|
+
)}
|
87
|
+
</form.Field>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<div>
|
91
|
+
<form.Field name="email">
|
92
|
+
{(field) => (
|
93
|
+
<div className="space-y-2">
|
94
|
+
<Label htmlFor={field.name}>Email</Label>
|
95
|
+
<Input
|
96
|
+
id={field.name}
|
97
|
+
name={field.name}
|
98
|
+
type="email"
|
99
|
+
value={field.state.value}
|
100
|
+
onBlur={field.handleBlur}
|
101
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
102
|
+
/>
|
103
|
+
{field.state.meta.errors.map((error) => (
|
104
|
+
<p key={error?.message} className="text-red-500">
|
105
|
+
{error?.message}
|
106
|
+
</p>
|
107
|
+
))}
|
108
|
+
</div>
|
109
|
+
)}
|
110
|
+
</form.Field>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div>
|
114
|
+
<form.Field name="password">
|
115
|
+
{(field) => (
|
116
|
+
<div className="space-y-2">
|
117
|
+
<Label htmlFor={field.name}>Password</Label>
|
118
|
+
<Input
|
119
|
+
id={field.name}
|
120
|
+
name={field.name}
|
121
|
+
type="password"
|
122
|
+
value={field.state.value}
|
123
|
+
onBlur={field.handleBlur}
|
124
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
125
|
+
/>
|
126
|
+
{field.state.meta.errors.map((error) => (
|
127
|
+
<p key={error?.message} className="text-red-500">
|
128
|
+
{error?.message}
|
129
|
+
</p>
|
130
|
+
))}
|
131
|
+
</div>
|
132
|
+
)}
|
133
|
+
</form.Field>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<form.Subscribe>
|
137
|
+
{(state) => (
|
138
|
+
<Button
|
139
|
+
type="submit"
|
140
|
+
className="w-full"
|
141
|
+
disabled={!state.canSubmit || state.isSubmitting}
|
142
|
+
>
|
143
|
+
{state.isSubmitting ? "Submitting..." : "Sign Up"}
|
144
|
+
</Button>
|
145
|
+
)}
|
146
|
+
</form.Subscribe>
|
147
|
+
</form>
|
148
|
+
|
149
|
+
<div className="mt-4 text-center">
|
150
|
+
<Button
|
151
|
+
variant="link"
|
152
|
+
onClick={onSwitchToSignIn}
|
153
|
+
className="text-indigo-600 hover:text-indigo-800"
|
154
|
+
>
|
155
|
+
Already have an account? Sign In
|
156
|
+
</Button>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
);
|
160
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import { ThemeProvider as NextThemesProvider } from "next-themes"
|
5
|
+
|
6
|
+
export function ThemeProvider({
|
7
|
+
children,
|
8
|
+
...props
|
9
|
+
}: React.ComponentProps<typeof NextThemesProvider>) {
|
10
|
+
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
|
11
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import {
|
2
|
+
DropdownMenu,
|
3
|
+
DropdownMenuContent,
|
4
|
+
DropdownMenuItem,
|
5
|
+
DropdownMenuLabel,
|
6
|
+
DropdownMenuSeparator,
|
7
|
+
DropdownMenuTrigger,
|
8
|
+
} from "@/components/ui/dropdown-menu";
|
9
|
+
import { authClient } from "@/lib/auth-client";
|
10
|
+
import { Button } from "./ui/button";
|
11
|
+
import { Skeleton } from "./ui/skeleton";
|
12
|
+
import { useRouter } from "next/navigation";
|
13
|
+
import Link from "next/link";
|
14
|
+
|
15
|
+
export default function UserMenu() {
|
16
|
+
const router = useRouter();
|
17
|
+
const { data: session, isPending } = authClient.useSession();
|
18
|
+
|
19
|
+
if (isPending) {
|
20
|
+
return <Skeleton className="h-9 w-24" />;
|
21
|
+
}
|
22
|
+
|
23
|
+
if (!session) {
|
24
|
+
return (
|
25
|
+
<Button variant="outline" asChild>
|
26
|
+
<Link href="/login">Sign In</Link>
|
27
|
+
</Button>
|
28
|
+
);
|
29
|
+
}
|
30
|
+
|
31
|
+
return (
|
32
|
+
<DropdownMenu>
|
33
|
+
<DropdownMenuTrigger asChild>
|
34
|
+
<Button variant="outline">{session.user.name}</Button>
|
35
|
+
</DropdownMenuTrigger>
|
36
|
+
<DropdownMenuContent className="bg-card">
|
37
|
+
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
38
|
+
<DropdownMenuSeparator />
|
39
|
+
<DropdownMenuItem>{session.user.email}</DropdownMenuItem>
|
40
|
+
<DropdownMenuItem asChild>
|
41
|
+
<Button
|
42
|
+
variant="destructive"
|
43
|
+
className="w-full"
|
44
|
+
onClick={() => {
|
45
|
+
authClient.signOut({
|
46
|
+
fetchOptions: {
|
47
|
+
onSuccess: () => {
|
48
|
+
router.push("/");
|
49
|
+
},
|
50
|
+
},
|
51
|
+
});
|
52
|
+
}}
|
53
|
+
>
|
54
|
+
Sign Out
|
55
|
+
</Button>
|
56
|
+
</DropdownMenuItem>
|
57
|
+
</DropdownMenuContent>
|
58
|
+
</DropdownMenu>
|
59
|
+
);
|
60
|
+
}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
import { authClient } from "@/lib/auth-client";
|
2
|
+
import { useForm } from "@tanstack/react-form";
|
3
|
+
import { useNavigate } from "react-router";
|
4
|
+
import { toast } from "sonner";
|
5
|
+
import z from "zod/v4";
|
6
|
+
import Loader from "./loader";
|
7
|
+
import { Button } from "./ui/button";
|
8
|
+
import { Input } from "./ui/input";
|
9
|
+
import { Label } from "./ui/label";
|
10
|
+
|
11
|
+
export default function SignInForm({
|
12
|
+
onSwitchToSignUp,
|
13
|
+
}: {
|
14
|
+
onSwitchToSignUp: () => void;
|
15
|
+
}) {
|
16
|
+
const navigate = useNavigate();
|
17
|
+
const { isPending } = authClient.useSession();
|
18
|
+
|
19
|
+
const form = useForm({
|
20
|
+
defaultValues: {
|
21
|
+
email: "",
|
22
|
+
password: "",
|
23
|
+
},
|
24
|
+
onSubmit: async ({ value }) => {
|
25
|
+
await authClient.signIn.email(
|
26
|
+
{
|
27
|
+
email: value.email,
|
28
|
+
password: value.password,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
onSuccess: () => {
|
32
|
+
navigate("/dashboard");
|
33
|
+
toast.success("Sign in successful");
|
34
|
+
},
|
35
|
+
onError: (error) => {
|
36
|
+
toast.error(error.error.message);
|
37
|
+
},
|
38
|
+
}
|
39
|
+
);
|
40
|
+
},
|
41
|
+
validators: {
|
42
|
+
onSubmit: z.object({
|
43
|
+
email: z.email("Invalid email address"),
|
44
|
+
password: z.string().min(8, "Password must be at least 8 characters"),
|
45
|
+
}),
|
46
|
+
},
|
47
|
+
});
|
48
|
+
|
49
|
+
if (isPending) {
|
50
|
+
return <Loader />;
|
51
|
+
}
|
52
|
+
|
53
|
+
return (
|
54
|
+
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
55
|
+
<h1 className="mb-6 text-center text-3xl font-bold">Welcome Back</h1>
|
56
|
+
|
57
|
+
<form
|
58
|
+
onSubmit={(e) => {
|
59
|
+
e.preventDefault();
|
60
|
+
e.stopPropagation();
|
61
|
+
void form.handleSubmit();
|
62
|
+
}}
|
63
|
+
className="space-y-4"
|
64
|
+
>
|
65
|
+
<div>
|
66
|
+
<form.Field name="email">
|
67
|
+
{(field) => (
|
68
|
+
<div className="space-y-2">
|
69
|
+
<Label htmlFor={field.name}>Email</Label>
|
70
|
+
<Input
|
71
|
+
id={field.name}
|
72
|
+
name={field.name}
|
73
|
+
type="email"
|
74
|
+
value={field.state.value}
|
75
|
+
onBlur={field.handleBlur}
|
76
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
77
|
+
/>
|
78
|
+
{field.state.meta.errors.map((error) => (
|
79
|
+
<p key={error?.message} className="text-red-500">
|
80
|
+
{error?.message}
|
81
|
+
</p>
|
82
|
+
))}
|
83
|
+
</div>
|
84
|
+
)}
|
85
|
+
</form.Field>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div>
|
89
|
+
<form.Field name="password">
|
90
|
+
{(field) => (
|
91
|
+
<div className="space-y-2">
|
92
|
+
<Label htmlFor={field.name}>Password</Label>
|
93
|
+
<Input
|
94
|
+
id={field.name}
|
95
|
+
name={field.name}
|
96
|
+
type="password"
|
97
|
+
value={field.state.value}
|
98
|
+
onBlur={field.handleBlur}
|
99
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
100
|
+
/>
|
101
|
+
{field.state.meta.errors.map((error) => (
|
102
|
+
<p key={error?.message} className="text-red-500">
|
103
|
+
{error?.message}
|
104
|
+
</p>
|
105
|
+
))}
|
106
|
+
</div>
|
107
|
+
)}
|
108
|
+
</form.Field>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<form.Subscribe>
|
112
|
+
{(state) => (
|
113
|
+
<Button
|
114
|
+
type="submit"
|
115
|
+
className="w-full"
|
116
|
+
disabled={!state.canSubmit || state.isSubmitting}
|
117
|
+
>
|
118
|
+
{state.isSubmitting ? "Submitting..." : "Sign In"}
|
119
|
+
</Button>
|
120
|
+
)}
|
121
|
+
</form.Subscribe>
|
122
|
+
</form>
|
123
|
+
|
124
|
+
<div className="mt-4 text-center">
|
125
|
+
<Button
|
126
|
+
variant="link"
|
127
|
+
onClick={onSwitchToSignUp}
|
128
|
+
className="text-indigo-600 hover:text-indigo-800"
|
129
|
+
>
|
130
|
+
Need an account? Sign Up
|
131
|
+
</Button>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
);
|
135
|
+
}
|