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,179 @@
|
|
1
|
+
import { authClient } from "@/lib/auth-client";
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
3
|
+
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
|
4
|
+
import { StyleSheet } from "react-native-unistyles";
|
5
|
+
|
6
|
+
import { Container } from "@/components/container";
|
7
|
+
import { SignIn } from "@/components/sign-in";
|
8
|
+
import { SignUp } from "@/components/sign-up";
|
9
|
+
{{#if (eq api "orpc")}}
|
10
|
+
import { queryClient, orpc } from "@/utils/orpc";
|
11
|
+
{{/if}}
|
12
|
+
{{#if (eq api "trpc")}}
|
13
|
+
import { queryClient, trpc } from "@/utils/trpc";
|
14
|
+
{{/if}}
|
15
|
+
|
16
|
+
export default function Home() {
|
17
|
+
{{#if (eq api "orpc")}}
|
18
|
+
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
19
|
+
const privateData = useQuery(orpc.privateData.queryOptions());
|
20
|
+
{{/if}}
|
21
|
+
{{#if (eq api "trpc")}}
|
22
|
+
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
23
|
+
const privateData = useQuery(trpc.privateData.queryOptions());
|
24
|
+
{{/if}}
|
25
|
+
const { data: session } = authClient.useSession();
|
26
|
+
|
27
|
+
return (
|
28
|
+
<Container>
|
29
|
+
<ScrollView>
|
30
|
+
<View style={styles.pageContainer}>
|
31
|
+
<Text style={styles.headerTitle}>TVI</Text>
|
32
|
+
{session?.user ? (
|
33
|
+
<View style={styles.sessionInfoCard}>
|
34
|
+
<View style={styles.sessionUserRow}>
|
35
|
+
<Text style={styles.welcomeText}>
|
36
|
+
Welcome,{" "}
|
37
|
+
<Text style={styles.userNameText}>{session.user.name}</Text>
|
38
|
+
</Text>
|
39
|
+
</View>
|
40
|
+
<Text style={styles.emailText}>{session.user.email}</Text>
|
41
|
+
|
42
|
+
<TouchableOpacity
|
43
|
+
style={styles.signOutButton}
|
44
|
+
onPress={() => {
|
45
|
+
authClient.signOut();
|
46
|
+
queryClient.invalidateQueries();
|
47
|
+
}}
|
48
|
+
>
|
49
|
+
<Text style={styles.signOutButtonText}>Sign Out</Text>
|
50
|
+
</TouchableOpacity>
|
51
|
+
</View>
|
52
|
+
) : null}
|
53
|
+
<View style={styles.apiStatusCard}>
|
54
|
+
<Text style={styles.cardTitle}>API Status</Text>
|
55
|
+
<View style={styles.apiStatusRow}>
|
56
|
+
<View
|
57
|
+
style={[
|
58
|
+
styles.statusIndicatorDot,
|
59
|
+
healthCheck.data
|
60
|
+
? styles.statusIndicatorGreen
|
61
|
+
: styles.statusIndicatorRed,
|
62
|
+
]}
|
63
|
+
/>
|
64
|
+
<Text style={styles.mutedText}>
|
65
|
+
{healthCheck.isLoading
|
66
|
+
? "Checking..."
|
67
|
+
: healthCheck.data
|
68
|
+
? "Connected to API"
|
69
|
+
: "API Disconnected"}
|
70
|
+
</Text>
|
71
|
+
</View>
|
72
|
+
</View>
|
73
|
+
<View style={styles.privateDataCard}>
|
74
|
+
<Text style={styles.cardTitle}>Private Data</Text>
|
75
|
+
{privateData && (
|
76
|
+
<View>
|
77
|
+
<Text style={styles.mutedText}>
|
78
|
+
{privateData.data?.message}
|
79
|
+
</Text>
|
80
|
+
</View>
|
81
|
+
)}
|
82
|
+
</View>
|
83
|
+
{!session?.user && (
|
84
|
+
<>
|
85
|
+
<SignIn />
|
86
|
+
<SignUp />
|
87
|
+
</>
|
88
|
+
)}
|
89
|
+
</View>
|
90
|
+
</ScrollView>
|
91
|
+
</Container>
|
92
|
+
);
|
93
|
+
}
|
94
|
+
|
95
|
+
const styles = StyleSheet.create((theme) => ({
|
96
|
+
pageContainer: {
|
97
|
+
paddingHorizontal: 8,
|
98
|
+
},
|
99
|
+
headerTitle: {
|
100
|
+
color: theme?.colors?.typography,
|
101
|
+
fontSize: 30,
|
102
|
+
fontWeight: "bold",
|
103
|
+
marginBottom: 16,
|
104
|
+
},
|
105
|
+
sessionInfoCard: {
|
106
|
+
marginBottom: 24,
|
107
|
+
padding: 16,
|
108
|
+
borderRadius: 8,
|
109
|
+
borderWidth: 1,
|
110
|
+
borderColor: theme?.colors?.border,
|
111
|
+
},
|
112
|
+
sessionUserRow: {
|
113
|
+
flexDirection: "row",
|
114
|
+
justifyContent: "space-between",
|
115
|
+
alignItems: "center",
|
116
|
+
marginBottom: 8,
|
117
|
+
},
|
118
|
+
welcomeText: {
|
119
|
+
color: theme?.colors?.typography,
|
120
|
+
fontSize: 16,
|
121
|
+
},
|
122
|
+
userNameText: {
|
123
|
+
fontWeight: "500",
|
124
|
+
color: theme?.colors?.typography,
|
125
|
+
},
|
126
|
+
emailText: {
|
127
|
+
color: theme?.colors?.typography,
|
128
|
+
fontSize: 14,
|
129
|
+
marginBottom: 16,
|
130
|
+
},
|
131
|
+
signOutButton: {
|
132
|
+
backgroundColor: theme?.colors?.destructive,
|
133
|
+
paddingVertical: 8,
|
134
|
+
paddingHorizontal: 16,
|
135
|
+
borderRadius: 6,
|
136
|
+
alignSelf: "flex-start",
|
137
|
+
},
|
138
|
+
signOutButtonText: {
|
139
|
+
fontWeight: "500",
|
140
|
+
},
|
141
|
+
apiStatusCard: {
|
142
|
+
marginBottom: 24,
|
143
|
+
borderRadius: 8,
|
144
|
+
borderWidth: 1,
|
145
|
+
borderColor: theme?.colors?.border,
|
146
|
+
padding: 16,
|
147
|
+
},
|
148
|
+
cardTitle: {
|
149
|
+
marginBottom: 12,
|
150
|
+
fontWeight: "500",
|
151
|
+
color: theme?.colors?.typography,
|
152
|
+
},
|
153
|
+
apiStatusRow: {
|
154
|
+
flexDirection: "row",
|
155
|
+
alignItems: "center",
|
156
|
+
gap: 8,
|
157
|
+
},
|
158
|
+
statusIndicatorDot: {
|
159
|
+
height: 12,
|
160
|
+
width: 12,
|
161
|
+
borderRadius: 9999,
|
162
|
+
},
|
163
|
+
statusIndicatorGreen: {
|
164
|
+
backgroundColor: theme.colors.success,
|
165
|
+
},
|
166
|
+
statusIndicatorRed: {
|
167
|
+
backgroundColor: theme.colors.destructive,
|
168
|
+
},
|
169
|
+
mutedText: {
|
170
|
+
color: theme?.colors?.typography,
|
171
|
+
},
|
172
|
+
privateDataCard: {
|
173
|
+
marginBottom: 24,
|
174
|
+
borderRadius: 8,
|
175
|
+
borderWidth: 1,
|
176
|
+
borderColor: theme?.colors?.border,
|
177
|
+
padding: 16,
|
178
|
+
},
|
179
|
+
}));
|
@@ -0,0 +1,134 @@
|
|
1
|
+
import { authClient } from "@/lib/auth-client";
|
2
|
+
{{#if (eq api "trpc")}}
|
3
|
+
import { queryClient } from "@/utils/trpc";
|
4
|
+
{{/if}}
|
5
|
+
{{#if (eq api "orpc")}}
|
6
|
+
import { queryClient } from "@/utils/orpc";
|
7
|
+
{{/if}}
|
8
|
+
import { useState } from "react";
|
9
|
+
import {
|
10
|
+
ActivityIndicator,
|
11
|
+
Text,
|
12
|
+
TextInput,
|
13
|
+
TouchableOpacity,
|
14
|
+
View,
|
15
|
+
} from "react-native";
|
16
|
+
import { StyleSheet } from "react-native-unistyles";
|
17
|
+
|
18
|
+
export function SignIn() {
|
19
|
+
const [email, setEmail] = useState("");
|
20
|
+
const [password, setPassword] = useState("");
|
21
|
+
const [isLoading, setIsLoading] = useState(false);
|
22
|
+
const [error, setError] = useState<string | null>(null);
|
23
|
+
|
24
|
+
const handleLogin = async () => {
|
25
|
+
setIsLoading(true);
|
26
|
+
setError(null);
|
27
|
+
|
28
|
+
await authClient.signIn.email(
|
29
|
+
{
|
30
|
+
email,
|
31
|
+
password,
|
32
|
+
},
|
33
|
+
{
|
34
|
+
onError: (error) => {
|
35
|
+
setError(error.error?.message || "Failed to sign in");
|
36
|
+
setIsLoading(false);
|
37
|
+
},
|
38
|
+
onSuccess: () => {
|
39
|
+
setEmail("");
|
40
|
+
setPassword("");
|
41
|
+
queryClient.refetchQueries();
|
42
|
+
},
|
43
|
+
onFinished: () => {
|
44
|
+
setIsLoading(false);
|
45
|
+
},
|
46
|
+
},
|
47
|
+
);
|
48
|
+
};
|
49
|
+
|
50
|
+
return (
|
51
|
+
<View style={styles.container}>
|
52
|
+
<Text style={styles.title}>Sign In</Text>
|
53
|
+
|
54
|
+
{error && (
|
55
|
+
<View style={styles.errorContainer}>
|
56
|
+
<Text style={styles.errorText}>{error}</Text>
|
57
|
+
</View>
|
58
|
+
)}
|
59
|
+
|
60
|
+
<TextInput
|
61
|
+
style={styles.input}
|
62
|
+
placeholder="Email"
|
63
|
+
value={email}
|
64
|
+
onChangeText={setEmail}
|
65
|
+
keyboardType="email-address"
|
66
|
+
autoCapitalize="none"
|
67
|
+
/>
|
68
|
+
|
69
|
+
<TextInput
|
70
|
+
style={styles.input}
|
71
|
+
placeholder="Password"
|
72
|
+
value={password}
|
73
|
+
onChangeText={setPassword}
|
74
|
+
secureTextEntry
|
75
|
+
/>
|
76
|
+
|
77
|
+
<TouchableOpacity
|
78
|
+
onPress={handleLogin}
|
79
|
+
disabled={isLoading}
|
80
|
+
style={styles.button}
|
81
|
+
>
|
82
|
+
{isLoading ? (
|
83
|
+
<ActivityIndicator size="small" color="#fff" />
|
84
|
+
) : (
|
85
|
+
<Text style={styles.buttonText}>Sign In</Text>
|
86
|
+
)}
|
87
|
+
</TouchableOpacity>
|
88
|
+
</View>
|
89
|
+
);
|
90
|
+
}
|
91
|
+
|
92
|
+
const styles = StyleSheet.create((theme) => ({
|
93
|
+
container: {
|
94
|
+
marginTop: 24,
|
95
|
+
padding: 16,
|
96
|
+
borderRadius: 8,
|
97
|
+
borderWidth: 1,
|
98
|
+
borderColor: theme.colors.border,
|
99
|
+
},
|
100
|
+
title: {
|
101
|
+
fontSize: 18,
|
102
|
+
fontWeight: "600",
|
103
|
+
color: theme.colors.typography,
|
104
|
+
marginBottom: 16,
|
105
|
+
},
|
106
|
+
errorContainer: {
|
107
|
+
marginBottom: 16,
|
108
|
+
padding: 12,
|
109
|
+
borderRadius: 6,
|
110
|
+
},
|
111
|
+
errorText: {
|
112
|
+
color: theme.colors.destructive,
|
113
|
+
fontSize: 14,
|
114
|
+
},
|
115
|
+
input: {
|
116
|
+
marginBottom: 12,
|
117
|
+
padding: 16,
|
118
|
+
borderRadius: 6,
|
119
|
+
color: theme.colors.typography,
|
120
|
+
borderWidth: 1,
|
121
|
+
borderColor: theme.colors.border,
|
122
|
+
},
|
123
|
+
button: {
|
124
|
+
backgroundColor: theme.colors.primary,
|
125
|
+
padding: 16,
|
126
|
+
borderRadius: 6,
|
127
|
+
flexDirection: "row",
|
128
|
+
justifyContent: "center",
|
129
|
+
alignItems: "center",
|
130
|
+
},
|
131
|
+
buttonText: {
|
132
|
+
fontWeight: "500",
|
133
|
+
},
|
134
|
+
}));
|
@@ -0,0 +1,152 @@
|
|
1
|
+
import { authClient } from "@/lib/auth-client";
|
2
|
+
{{#if (eq api "trpc")}}
|
3
|
+
import { queryClient } from "@/utils/trpc";
|
4
|
+
{{/if}}
|
5
|
+
{{#if (eq api "orpc")}}
|
6
|
+
import { queryClient } from "@/utils/orpc";
|
7
|
+
{{/if}}
|
8
|
+
import { useState } from "react";
|
9
|
+
import {
|
10
|
+
ActivityIndicator,
|
11
|
+
Text,
|
12
|
+
TextInput,
|
13
|
+
TouchableOpacity,
|
14
|
+
View,
|
15
|
+
} from "react-native";
|
16
|
+
import { StyleSheet } from "react-native-unistyles";
|
17
|
+
|
18
|
+
export function SignUp() {
|
19
|
+
const [name, setName] = useState("");
|
20
|
+
const [email, setEmail] = useState("");
|
21
|
+
const [password, setPassword] = useState("");
|
22
|
+
const [isLoading, setIsLoading] = useState(false);
|
23
|
+
const [error, setError] = useState<string | null>(null);
|
24
|
+
|
25
|
+
const handleSignUp = async () => {
|
26
|
+
setIsLoading(true);
|
27
|
+
setError(null);
|
28
|
+
|
29
|
+
await authClient.signUp.email(
|
30
|
+
{
|
31
|
+
name,
|
32
|
+
email,
|
33
|
+
password,
|
34
|
+
},
|
35
|
+
{
|
36
|
+
onError: (error) => {
|
37
|
+
setError(error.error?.message || "Failed to sign up");
|
38
|
+
setIsLoading(false);
|
39
|
+
},
|
40
|
+
onSuccess: () => {
|
41
|
+
setName("");
|
42
|
+
setEmail("");
|
43
|
+
setPassword("");
|
44
|
+
queryClient.refetchQueries();
|
45
|
+
},
|
46
|
+
onFinished: () => {
|
47
|
+
setIsLoading(false);
|
48
|
+
},
|
49
|
+
},
|
50
|
+
);
|
51
|
+
};
|
52
|
+
|
53
|
+
return (
|
54
|
+
<View style={styles.container}>
|
55
|
+
<Text style={styles.title}>Create Account</Text>
|
56
|
+
|
57
|
+
{error && (
|
58
|
+
<View style={styles.errorContainer}>
|
59
|
+
<Text style={styles.errorText}>{error}</Text>
|
60
|
+
</View>
|
61
|
+
)}
|
62
|
+
|
63
|
+
<TextInput
|
64
|
+
style={styles.input}
|
65
|
+
placeholder="Name"
|
66
|
+
value={name}
|
67
|
+
onChangeText={setName}
|
68
|
+
/>
|
69
|
+
|
70
|
+
<TextInput
|
71
|
+
style={styles.input}
|
72
|
+
placeholder="Email"
|
73
|
+
value={email}
|
74
|
+
onChangeText={setEmail}
|
75
|
+
keyboardType="email-address"
|
76
|
+
autoCapitalize="none"
|
77
|
+
/>
|
78
|
+
|
79
|
+
<TextInput
|
80
|
+
style={styles.inputLast}
|
81
|
+
placeholder="Password"
|
82
|
+
value={password}
|
83
|
+
onChangeText={setPassword}
|
84
|
+
secureTextEntry
|
85
|
+
/>
|
86
|
+
|
87
|
+
<TouchableOpacity
|
88
|
+
onPress={handleSignUp}
|
89
|
+
disabled={isLoading}
|
90
|
+
style={styles.button}
|
91
|
+
>
|
92
|
+
{isLoading ? (
|
93
|
+
<ActivityIndicator size="small" color="#fff" />
|
94
|
+
) : (
|
95
|
+
<Text style={styles.buttonText}>Sign Up</Text>
|
96
|
+
)}
|
97
|
+
</TouchableOpacity>
|
98
|
+
</View>
|
99
|
+
);
|
100
|
+
}
|
101
|
+
|
102
|
+
const styles = StyleSheet.create((theme) => ({
|
103
|
+
container: {
|
104
|
+
marginTop: 24,
|
105
|
+
padding: 16,
|
106
|
+
borderRadius: 8,
|
107
|
+
borderWidth: 1,
|
108
|
+
borderColor: theme.colors.border,
|
109
|
+
},
|
110
|
+
title: {
|
111
|
+
fontSize: 18,
|
112
|
+
fontWeight: "600",
|
113
|
+
color: theme.colors.typography,
|
114
|
+
marginBottom: 16,
|
115
|
+
},
|
116
|
+
errorContainer: {
|
117
|
+
marginBottom: 16,
|
118
|
+
padding: 12,
|
119
|
+
borderRadius: 6,
|
120
|
+
},
|
121
|
+
errorText: {
|
122
|
+
color: theme.colors.destructive,
|
123
|
+
fontSize: 14,
|
124
|
+
},
|
125
|
+
input: {
|
126
|
+
marginBottom: 12,
|
127
|
+
padding: 16,
|
128
|
+
borderRadius: 6,
|
129
|
+
color: theme.colors.typography,
|
130
|
+
borderWidth: 1,
|
131
|
+
borderColor: theme.colors.border,
|
132
|
+
},
|
133
|
+
inputLast: {
|
134
|
+
marginBottom: 16,
|
135
|
+
padding: 16,
|
136
|
+
borderRadius: 6,
|
137
|
+
color: theme.colors.typography,
|
138
|
+
borderWidth: 1,
|
139
|
+
borderColor: theme.colors.border,
|
140
|
+
},
|
141
|
+
button: {
|
142
|
+
backgroundColor: theme.colors.primary,
|
143
|
+
padding: 16,
|
144
|
+
borderRadius: 6,
|
145
|
+
flexDirection: "row",
|
146
|
+
justifyContent: "center",
|
147
|
+
alignItems: "center",
|
148
|
+
},
|
149
|
+
buttonText: {
|
150
|
+
fontWeight: "500",
|
151
|
+
},
|
152
|
+
}));
|
@@ -0,0 +1,141 @@
|
|
1
|
+
{{#if (eq orm "prisma")}}
|
2
|
+
import { betterAuth } from "better-auth";
|
3
|
+
import { prismaAdapter } from "better-auth/adapters/prisma";
|
4
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
5
|
+
import { expo } from "@better-auth/expo";
|
6
|
+
{{/if}}
|
7
|
+
import prisma from "../../prisma";
|
8
|
+
|
9
|
+
export const auth = betterAuth({
|
10
|
+
database: prismaAdapter(prisma, {
|
11
|
+
{{#if (eq database "postgres")}}provider: "postgresql"{{/if}}
|
12
|
+
{{#if (eq database "sqlite")}}provider: "sqlite"{{/if}}
|
13
|
+
{{#if (eq database "mysql")}}provider: "mysql"{{/if}}
|
14
|
+
{{#if (eq database "mongodb")}}provider: "mongodb"{{/if}}
|
15
|
+
}),
|
16
|
+
trustedOrigins: [
|
17
|
+
process.env.CORS_ORIGIN || "",
|
18
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
19
|
+
"my-tvi-app://",
|
20
|
+
{{/if}}
|
21
|
+
],
|
22
|
+
emailAndPassword: {
|
23
|
+
enabled: true,
|
24
|
+
}
|
25
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
26
|
+
, plugins: [expo()]
|
27
|
+
{{/if}}
|
28
|
+
});
|
29
|
+
{{/if}}
|
30
|
+
|
31
|
+
{{#if (eq orm "drizzle")}}
|
32
|
+
{{#if (or (eq runtime "bun") (eq runtime "node"))}}
|
33
|
+
import { betterAuth } from "better-auth";
|
34
|
+
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
35
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
36
|
+
import { expo } from "@better-auth/expo";
|
37
|
+
{{/if}}
|
38
|
+
import { db } from "../db";
|
39
|
+
import * as schema from "../db/schema/auth";
|
40
|
+
|
41
|
+
export const auth = betterAuth({
|
42
|
+
database: drizzleAdapter(db, {
|
43
|
+
{{#if (eq database "postgres")}}provider: "pg",{{/if}}
|
44
|
+
{{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
|
45
|
+
{{#if (eq database "mysql")}}provider: "mysql",{{/if}}
|
46
|
+
schema: schema,
|
47
|
+
}),
|
48
|
+
trustedOrigins: [
|
49
|
+
process.env.CORS_ORIGIN || "",
|
50
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
51
|
+
"my-tvi-app://",
|
52
|
+
{{/if}}
|
53
|
+
],
|
54
|
+
emailAndPassword: {
|
55
|
+
enabled: true,
|
56
|
+
},
|
57
|
+
secret: process.env.BETTER_AUTH_SECRET,
|
58
|
+
baseURL: process.env.BETTER_AUTH_URL,
|
59
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
60
|
+
plugins: [expo()],
|
61
|
+
{{/if}}
|
62
|
+
});
|
63
|
+
{{/if}}
|
64
|
+
|
65
|
+
{{#if (eq runtime "workers")}}
|
66
|
+
import { betterAuth } from "better-auth";
|
67
|
+
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
68
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
69
|
+
import { expo } from "@better-auth/expo";
|
70
|
+
{{/if}}
|
71
|
+
import { db } from "@/db";
|
72
|
+
import * as schema from "../db/schema/auth";
|
73
|
+
import { env } from "cloudflare:workers";
|
74
|
+
|
75
|
+
export const auth = betterAuth({
|
76
|
+
database: drizzleAdapter(db, {
|
77
|
+
{{#if (eq database "postgres")}}provider: "pg",{{/if}}
|
78
|
+
{{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
|
79
|
+
{{#if (eq database "mysql")}}provider: "mysql",{{/if}}
|
80
|
+
schema: schema,
|
81
|
+
}),
|
82
|
+
trustedOrigins: [env.CORS_ORIGIN],
|
83
|
+
emailAndPassword: {
|
84
|
+
enabled: true,
|
85
|
+
},
|
86
|
+
secret: env.BETTER_AUTH_SECRET,
|
87
|
+
baseURL: env.BETTER_AUTH_URL,
|
88
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
89
|
+
plugins: [expo()],
|
90
|
+
{{/if}}
|
91
|
+
});
|
92
|
+
{{/if}}
|
93
|
+
{{/if}}
|
94
|
+
|
95
|
+
{{#if (eq orm "mongoose")}}
|
96
|
+
import { betterAuth } from "better-auth";
|
97
|
+
import { mongodbAdapter } from "better-auth/adapters/mongodb";
|
98
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
99
|
+
import { expo } from "@better-auth/expo";
|
100
|
+
{{/if}}
|
101
|
+
import { client } from "../db";
|
102
|
+
|
103
|
+
export const auth = betterAuth({
|
104
|
+
database: mongodbAdapter(client),
|
105
|
+
trustedOrigins: [
|
106
|
+
process.env.CORS_ORIGIN || "",
|
107
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
108
|
+
"my-tvi-app://",
|
109
|
+
{{/if}}
|
110
|
+
],
|
111
|
+
emailAndPassword: {
|
112
|
+
enabled: true,
|
113
|
+
}
|
114
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
115
|
+
, plugins: [expo()]
|
116
|
+
{{/if}}
|
117
|
+
});
|
118
|
+
{{/if}}
|
119
|
+
|
120
|
+
{{#if (eq orm "none")}}
|
121
|
+
import { betterAuth } from "better-auth";
|
122
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
123
|
+
import { expo } from "@better-auth/expo";
|
124
|
+
{{/if}}
|
125
|
+
|
126
|
+
export const auth = betterAuth({
|
127
|
+
database: "", // Invalid configuration
|
128
|
+
trustedOrigins: [
|
129
|
+
process.env.CORS_ORIGIN || "",
|
130
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
131
|
+
"my-tvi-app://",
|
132
|
+
{{/if}}
|
133
|
+
],
|
134
|
+
emailAndPassword: {
|
135
|
+
enabled: true,
|
136
|
+
}
|
137
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
138
|
+
, plugins: [expo()]
|
139
|
+
{{/if}}
|
140
|
+
});
|
141
|
+
{{/if}}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import {
|
2
|
+
mysqlTable,
|
3
|
+
varchar,
|
4
|
+
text,
|
5
|
+
timestamp,
|
6
|
+
boolean,
|
7
|
+
} from "drizzle-orm/mysql-core";
|
8
|
+
|
9
|
+
export const user = mysqlTable("user", {
|
10
|
+
id: varchar("id", { length: 36 }).primaryKey(),
|
11
|
+
name: text("name").notNull(),
|
12
|
+
email: varchar("email", { length: 255 }).notNull().unique(),
|
13
|
+
emailVerified: boolean("email_verified").notNull(),
|
14
|
+
image: text("image"),
|
15
|
+
createdAt: timestamp("created_at").notNull(),
|
16
|
+
updatedAt: timestamp("updated_at").notNull(),
|
17
|
+
});
|
18
|
+
|
19
|
+
export const session = mysqlTable("session", {
|
20
|
+
id: varchar("id", { length: 36 }).primaryKey(),
|
21
|
+
expiresAt: timestamp("expires_at").notNull(),
|
22
|
+
token: varchar("token", { length: 255 }).notNull().unique(),
|
23
|
+
createdAt: timestamp("created_at").notNull(),
|
24
|
+
updatedAt: timestamp("updated_at").notNull(),
|
25
|
+
ipAddress: text("ip_address"),
|
26
|
+
userAgent: text("user_agent"),
|
27
|
+
userId: varchar("user_id", { length: 36 })
|
28
|
+
.notNull()
|
29
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
30
|
+
});
|
31
|
+
|
32
|
+
export const account = mysqlTable("account", {
|
33
|
+
id: varchar("id", { length: 36 }).primaryKey(),
|
34
|
+
accountId: text("account_id").notNull(),
|
35
|
+
providerId: text("provider_id").notNull(),
|
36
|
+
userId: varchar("user_id", { length: 36 })
|
37
|
+
.notNull()
|
38
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
39
|
+
accessToken: text("access_token"),
|
40
|
+
refreshToken: text("refresh_token"),
|
41
|
+
idToken: text("id_token"),
|
42
|
+
|
43
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
44
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
45
|
+
scope: text("scope"),
|
46
|
+
password: text("password"),
|
47
|
+
createdAt: timestamp("created_at").notNull(),
|
48
|
+
updatedAt: timestamp("updated_at").notNull(),
|
49
|
+
});
|
50
|
+
|
51
|
+
export const verification = mysqlTable("verification", {
|
52
|
+
id: varchar("id", { length: 36 }).primaryKey(),
|
53
|
+
identifier: text("identifier").notNull(),
|
54
|
+
value: text("value").notNull(),
|
55
|
+
expiresAt: timestamp("expires_at").notNull(),
|
56
|
+
createdAt: timestamp("created_at"),
|
57
|
+
updatedAt: timestamp("updated_at"),
|
58
|
+
});
|