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,19 @@
|
|
1
|
+
import { NextResponse } from "next/server";
|
2
|
+
|
3
|
+
export function middleware() {
|
4
|
+
const res = NextResponse.next()
|
5
|
+
|
6
|
+
res.headers.append('Access-Control-Allow-Credentials', "true")
|
7
|
+
res.headers.append('Access-Control-Allow-Origin', process.env.CORS_ORIGIN || "")
|
8
|
+
res.headers.append('Access-Control-Allow-Methods', 'GET,POST,OPTIONS')
|
9
|
+
res.headers.append(
|
10
|
+
'Access-Control-Allow-Headers',
|
11
|
+
'Content-Type, Authorization'
|
12
|
+
)
|
13
|
+
|
14
|
+
return res
|
15
|
+
}
|
16
|
+
|
17
|
+
export const config = {
|
18
|
+
matcher: '/:path*',
|
19
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"target": "ES2017",
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
5
|
+
"allowJs": true,
|
6
|
+
"skipLibCheck": true,
|
7
|
+
"strict": true,
|
8
|
+
"noEmit": true,
|
9
|
+
"esModuleInterop": true,
|
10
|
+
"module": "esnext",
|
11
|
+
"moduleResolution": "bundler",
|
12
|
+
"resolveJsonModule": true,
|
13
|
+
"isolatedModules": true,
|
14
|
+
"jsx": "preserve",
|
15
|
+
{{#unless (or (eq backend "convex") (eq backend "none"))}}
|
16
|
+
"composite": true,
|
17
|
+
{{/unless}}
|
18
|
+
"incremental": true,
|
19
|
+
"plugins": [
|
20
|
+
{
|
21
|
+
"name": "next"
|
22
|
+
}
|
23
|
+
],
|
24
|
+
"paths": {
|
25
|
+
"@/*": ["./src/*"]
|
26
|
+
{{#if (eq orm 'prisma')}},
|
27
|
+
"prisma": ["node_modules/prisma"]
|
28
|
+
{{/if}}
|
29
|
+
},
|
30
|
+
},
|
31
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
32
|
+
"exclude": ["node_modules"]
|
33
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# prod
|
2
|
+
dist/
|
3
|
+
/build
|
4
|
+
/out/
|
5
|
+
|
6
|
+
# dev
|
7
|
+
.yarn/
|
8
|
+
!.yarn/patches
|
9
|
+
!.yarn/plugins
|
10
|
+
!.yarn/releases
|
11
|
+
!.yarn/versions
|
12
|
+
.vscode/*
|
13
|
+
!.vscode/launch.json
|
14
|
+
!.vscode/*.code-snippets
|
15
|
+
.idea/workspace.xml
|
16
|
+
.idea/usage.statistics.xml
|
17
|
+
.idea/shelf
|
18
|
+
.wrangler
|
19
|
+
/.next/
|
20
|
+
.vercel
|
21
|
+
|
22
|
+
# deps
|
23
|
+
node_modules/
|
24
|
+
/node_modules
|
25
|
+
/.pnp
|
26
|
+
.pnp.*
|
27
|
+
|
28
|
+
# env
|
29
|
+
.env*
|
30
|
+
.env.production
|
31
|
+
!.env.example
|
32
|
+
.dev.vars
|
33
|
+
|
34
|
+
# logs
|
35
|
+
logs/
|
36
|
+
*.log
|
37
|
+
npm-debug.log*
|
38
|
+
yarn-debug.log*
|
39
|
+
yarn-error.log*
|
40
|
+
pnpm-debug.log*
|
41
|
+
lerna-debug.log*
|
42
|
+
|
43
|
+
# misc
|
44
|
+
.DS_Store
|
45
|
+
*.pem
|
46
|
+
|
47
|
+
# local db
|
48
|
+
*.db*
|
49
|
+
|
50
|
+
# typescript
|
51
|
+
*.tsbuildinfo
|
52
|
+
next-env.d.ts
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"name": "server",
|
3
|
+
"main": "src/index.ts",
|
4
|
+
"type": "module",
|
5
|
+
"scripts": {
|
6
|
+
"build": "tsc && tsc-alias",
|
7
|
+
"check-types": "tsc --noEmit",
|
8
|
+
"compile": "bun build --compile --minify --sourcemap --bytecode ./src/index.ts --outfile server"
|
9
|
+
},
|
10
|
+
{{#if (eq orm 'prisma')}}
|
11
|
+
"prisma": {
|
12
|
+
"schema": "./schema"
|
13
|
+
},
|
14
|
+
{{/if}}
|
15
|
+
"dependencies": {
|
16
|
+
"dotenv": "^16.4.7",
|
17
|
+
"zod": "^3.25.16"
|
18
|
+
},
|
19
|
+
{{#if (eq dbSetup 'supabase')}}
|
20
|
+
"trustedDependencies": [
|
21
|
+
"supabase"
|
22
|
+
],
|
23
|
+
{{/if}}
|
24
|
+
"devDependencies": {
|
25
|
+
"tsc-alias": "^1.8.11",
|
26
|
+
"typescript": "^5.8.2"
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
{{#if (eq api "orpc")}}
|
2
|
+
import { {{#if auth}}protectedProcedure, {{/if}}publicProcedure } from "../lib/orpc";
|
3
|
+
{{#if (includes examples "todo")}}
|
4
|
+
import { todoRouter } from "./todo";
|
5
|
+
{{/if}}
|
6
|
+
|
7
|
+
export const appRouter = {
|
8
|
+
healthCheck: publicProcedure.handler(() => {
|
9
|
+
return "OK";
|
10
|
+
}),
|
11
|
+
{{#if auth}}
|
12
|
+
privateData: protectedProcedure.handler(({ context }) => {
|
13
|
+
return {
|
14
|
+
message: "This is private",
|
15
|
+
user: context.session?.user,
|
16
|
+
};
|
17
|
+
}),
|
18
|
+
{{/if}}
|
19
|
+
{{#if (includes examples "todo")}}
|
20
|
+
todo: todoRouter,
|
21
|
+
{{/if}}
|
22
|
+
};
|
23
|
+
export type AppRouter = typeof appRouter;
|
24
|
+
{{else if (eq api "trpc")}}
|
25
|
+
import {
|
26
|
+
{{#if auth}}protectedProcedure, {{/if}}publicProcedure,
|
27
|
+
router,
|
28
|
+
} from "../lib/trpc";
|
29
|
+
{{#if (includes examples "todo")}}
|
30
|
+
import { todoRouter } from "./todo";
|
31
|
+
{{/if}}
|
32
|
+
|
33
|
+
export const appRouter = router({
|
34
|
+
healthCheck: publicProcedure.query(() => {
|
35
|
+
return "OK";
|
36
|
+
}),
|
37
|
+
{{#if auth}}
|
38
|
+
privateData: protectedProcedure.query(({ ctx }) => {
|
39
|
+
return {
|
40
|
+
message: "This is private",
|
41
|
+
user: ctx.session.user,
|
42
|
+
};
|
43
|
+
}),
|
44
|
+
{{/if}}
|
45
|
+
{{#if (includes examples "todo")}}
|
46
|
+
todo: todoRouter,
|
47
|
+
{{/if}}
|
48
|
+
});
|
49
|
+
export type AppRouter = typeof appRouter;
|
50
|
+
{{else}}
|
51
|
+
export const appRouter = {};
|
52
|
+
export type AppRouter = typeof appRouter;
|
53
|
+
{{/if}}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"target": "ESNext",
|
4
|
+
"module": "ESNext",
|
5
|
+
"moduleResolution": "bundler",
|
6
|
+
"verbatimModuleSyntax": true,
|
7
|
+
"strict": true,
|
8
|
+
"skipLibCheck": true,
|
9
|
+
"baseUrl": "./",
|
10
|
+
"paths": {
|
11
|
+
"@/*": ["./src/*"]
|
12
|
+
{{#if (eq orm "prisma")}},
|
13
|
+
"prisma": ["node_modules/prisma"]
|
14
|
+
{{/if}}
|
15
|
+
},
|
16
|
+
"outDir": "./dist",
|
17
|
+
"types": [
|
18
|
+
{{#if (eq runtime "node")}}
|
19
|
+
"node"
|
20
|
+
{{else if (eq runtime "bun")}}
|
21
|
+
"bun"
|
22
|
+
{{else if (eq runtime "workers")}}
|
23
|
+
"./worker-configuration",
|
24
|
+
"node"
|
25
|
+
{{else}}
|
26
|
+
"node",
|
27
|
+
"bun"
|
28
|
+
{{/if}}
|
29
|
+
],
|
30
|
+
{{#unless (or (eq backend "convex") (eq backend "none"))}}
|
31
|
+
"composite": true,
|
32
|
+
{{/unless}}
|
33
|
+
"jsx": "react-jsx"{{#if (eq backend "hono")}},
|
34
|
+
"jsxImportSource": "hono/jsx"{{/if}}
|
35
|
+
},
|
36
|
+
"tsc-alias": {
|
37
|
+
"resolveFullPaths": true
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{{#if (or (eq runtime "bun") (eq runtime "node"))}}
|
2
|
+
import { drizzle } from "drizzle-orm/mysql2";
|
3
|
+
|
4
|
+
export const db = drizzle({
|
5
|
+
connection: {
|
6
|
+
uri: process.env.DATABASE_URL,
|
7
|
+
},
|
8
|
+
});
|
9
|
+
{{/if}}
|
10
|
+
|
11
|
+
{{#if (eq runtime "workers")}}
|
12
|
+
import { drizzle } from "drizzle-orm/mysql2";
|
13
|
+
import { env } from "cloudflare:workers";
|
14
|
+
|
15
|
+
export const db = drizzle({
|
16
|
+
connection: {
|
17
|
+
uri: env.DATABASE_URL,
|
18
|
+
},
|
19
|
+
});
|
20
|
+
{{/if}}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{{#if (or (eq runtime "bun") (eq runtime "node"))}}
|
2
|
+
import { drizzle } from "drizzle-orm/node-postgres";
|
3
|
+
|
4
|
+
export const db = drizzle(process.env.DATABASE_URL || "");
|
5
|
+
{{/if}}
|
6
|
+
|
7
|
+
{{#if (eq runtime "workers")}}
|
8
|
+
import { drizzle } from "drizzle-orm/node-postgres";
|
9
|
+
import { env } from "cloudflare:workers";
|
10
|
+
|
11
|
+
export const db = drizzle(env.DATABASE_URL || "");
|
12
|
+
{{/if}}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { defineConfig } from "drizzle-kit";
|
2
|
+
|
3
|
+
export default defineConfig({
|
4
|
+
schema: "./src/db/schema",
|
5
|
+
out: "./src/db/migrations",
|
6
|
+
{{#if (eq dbSetup "d1")}}
|
7
|
+
// DOCS: https://orm.drizzle.team/docs/guides/d1-http-with-drizzle-kit
|
8
|
+
dialect: "sqlite",
|
9
|
+
driver: "d1-http",
|
10
|
+
dbCredentials: {
|
11
|
+
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
|
12
|
+
databaseId: process.env.CLOUDFLARE_DATABASE_ID!,
|
13
|
+
token: process.env.CLOUDFLARE_D1_TOKEN!,
|
14
|
+
},
|
15
|
+
{{else}}
|
16
|
+
dialect: "turso",
|
17
|
+
dbCredentials: {
|
18
|
+
url: process.env.DATABASE_URL || "",
|
19
|
+
{{#if (eq dbSetup "turso")}}
|
20
|
+
authToken: process.env.DATABASE_AUTH_TOKEN,
|
21
|
+
{{/if}}
|
22
|
+
},
|
23
|
+
{{/if}}
|
24
|
+
});
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{{#if (or (eq runtime "bun") (eq runtime "node"))}}
|
2
|
+
import { drizzle } from "drizzle-orm/libsql";
|
3
|
+
import { createClient } from "@libsql/client";
|
4
|
+
|
5
|
+
const client = createClient({
|
6
|
+
url: process.env.DATABASE_URL || "",
|
7
|
+
{{#if (eq dbSetup "turso")}}
|
8
|
+
authToken: process.env.DATABASE_AUTH_TOKEN,
|
9
|
+
{{/if}}
|
10
|
+
});
|
11
|
+
|
12
|
+
export const db = drizzle({ client });
|
13
|
+
{{/if}}
|
14
|
+
|
15
|
+
{{#if (eq runtime "workers")}}
|
16
|
+
{{#if (eq dbSetup "d1")}}
|
17
|
+
import { drizzle } from "drizzle-orm/d1";
|
18
|
+
import { env } from "cloudflare:workers";
|
19
|
+
|
20
|
+
export const db = drizzle(env.DB);
|
21
|
+
{{else}}
|
22
|
+
import { drizzle } from "drizzle-orm/libsql";
|
23
|
+
import { env } from "cloudflare:workers";
|
24
|
+
import { createClient } from "@libsql/client";
|
25
|
+
|
26
|
+
const client = createClient({
|
27
|
+
url: env.DATABASE_URL || "",
|
28
|
+
{{#if (eq dbSetup "turso")}}
|
29
|
+
authToken: env.DATABASE_AUTH_TOKEN,
|
30
|
+
{{/if}}
|
31
|
+
});
|
32
|
+
|
33
|
+
export const db = drizzle({ client });
|
34
|
+
{{/if}}
|
35
|
+
{{/if}}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
generator client {
|
2
|
+
provider = "prisma-client"
|
3
|
+
output = "../generated"
|
4
|
+
moduleFormat = "esm"
|
5
|
+
}
|
6
|
+
|
7
|
+
datasource db {
|
8
|
+
provider = "postgres"
|
9
|
+
url = env("DATABASE_URL")
|
10
|
+
{{#if (eq dbSetup "supabase")}}
|
11
|
+
directUrl = env("DIRECT_URL")
|
12
|
+
{{/if}}
|
13
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{{#if (eq dbSetup "prisma-postgres")}}
|
2
|
+
// import "dotenv/config"; uncomment this to load .env
|
3
|
+
{{else}}
|
4
|
+
import "dotenv/config";
|
5
|
+
{{/if}}
|
6
|
+
import path from "node:path";
|
7
|
+
import type { PrismaConfig } from "prisma";
|
8
|
+
|
9
|
+
export default {
|
10
|
+
earlyAccess: true,
|
11
|
+
schema: path.join("prisma", "schema"),
|
12
|
+
} satisfies PrismaConfig;
|
@@ -0,0 +1,155 @@
|
|
1
|
+
import { useRef, useEffect } from "react";
|
2
|
+
import {
|
3
|
+
View,
|
4
|
+
Text,
|
5
|
+
TextInput,
|
6
|
+
TouchableOpacity,
|
7
|
+
ScrollView,
|
8
|
+
KeyboardAvoidingView,
|
9
|
+
Platform,
|
10
|
+
} from "react-native";
|
11
|
+
import { useChat } from "@ai-sdk/react";
|
12
|
+
import { fetch as expoFetch } from "expo/fetch";
|
13
|
+
import { Ionicons } from "@expo/vector-icons";
|
14
|
+
import { Container } from "@/components/container";
|
15
|
+
|
16
|
+
// Utility function to generate API URLs
|
17
|
+
const generateAPIUrl = (relativePath: string) => {
|
18
|
+
const serverUrl = process.env.EXPO_PUBLIC_SERVER_URL;
|
19
|
+
if (!serverUrl) {
|
20
|
+
throw new Error("EXPO_PUBLIC_SERVER_URL environment variable is not defined");
|
21
|
+
}
|
22
|
+
|
23
|
+
const path = relativePath.startsWith('/') ? relativePath : `/${relativePath}`;
|
24
|
+
return serverUrl.concat(path);
|
25
|
+
};
|
26
|
+
|
27
|
+
export default function AIScreen() {
|
28
|
+
const { messages, input, handleInputChange, handleSubmit, error } = useChat({
|
29
|
+
fetch: expoFetch as unknown as typeof globalThis.fetch,
|
30
|
+
api: generateAPIUrl('/ai'),
|
31
|
+
onError: error => console.error(error, 'AI Chat Error'),
|
32
|
+
maxSteps: 5,
|
33
|
+
});
|
34
|
+
|
35
|
+
const scrollViewRef = useRef<ScrollView>(null);
|
36
|
+
|
37
|
+
useEffect(() => {
|
38
|
+
scrollViewRef.current?.scrollToEnd({ animated: true });
|
39
|
+
}, [messages]);
|
40
|
+
|
41
|
+
const onSubmit = () => {
|
42
|
+
if (input.trim()) {
|
43
|
+
handleSubmit();
|
44
|
+
}
|
45
|
+
};
|
46
|
+
|
47
|
+
if (error) {
|
48
|
+
return (
|
49
|
+
<Container>
|
50
|
+
<View className="flex-1 justify-center items-center px-4">
|
51
|
+
<Text className="text-destructive text-center text-lg mb-4">
|
52
|
+
Error: {error.message}
|
53
|
+
</Text>
|
54
|
+
<Text className="text-muted-foreground text-center">
|
55
|
+
Please check your connection and try again.
|
56
|
+
</Text>
|
57
|
+
</View>
|
58
|
+
</Container>
|
59
|
+
);
|
60
|
+
}
|
61
|
+
|
62
|
+
return (
|
63
|
+
<Container>
|
64
|
+
<KeyboardAvoidingView
|
65
|
+
className="flex-1"
|
66
|
+
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
67
|
+
>
|
68
|
+
<View className="flex-1 px-4 py-6">
|
69
|
+
<View className="mb-6">
|
70
|
+
<Text className="text-foreground text-2xl font-bold mb-2">
|
71
|
+
AI Chat
|
72
|
+
</Text>
|
73
|
+
<Text className="text-muted-foreground">
|
74
|
+
Chat with our AI assistant
|
75
|
+
</Text>
|
76
|
+
</View>
|
77
|
+
|
78
|
+
<ScrollView
|
79
|
+
ref={scrollViewRef}
|
80
|
+
className="flex-1 mb-4"
|
81
|
+
showsVerticalScrollIndicator={false}
|
82
|
+
>
|
83
|
+
{messages.length === 0 ? (
|
84
|
+
<View className="flex-1 justify-center items-center">
|
85
|
+
<Text className="text-center text-muted-foreground text-lg">
|
86
|
+
Ask me anything to get started!
|
87
|
+
</Text>
|
88
|
+
</View>
|
89
|
+
) : (
|
90
|
+
<View className="space-y-4">
|
91
|
+
{messages.map((message) => (
|
92
|
+
<View
|
93
|
+
key={message.id}
|
94
|
+
className={`p-3 rounded-lg ${
|
95
|
+
message.role === "user"
|
96
|
+
? "bg-primary/10 ml-8"
|
97
|
+
: "bg-card mr-8 border border-border"
|
98
|
+
}`}
|
99
|
+
>
|
100
|
+
<Text className="text-sm font-semibold mb-1 text-foreground">
|
101
|
+
{message.role === "user" ? "You" : "AI Assistant"}
|
102
|
+
</Text>
|
103
|
+
<Text className="text-foreground leading-relaxed">
|
104
|
+
{message.content}
|
105
|
+
</Text>
|
106
|
+
</View>
|
107
|
+
))}
|
108
|
+
</View>
|
109
|
+
)}
|
110
|
+
</ScrollView>
|
111
|
+
|
112
|
+
<View className="border-t border-border pt-4">
|
113
|
+
<View className="flex-row items-end space-x-2">
|
114
|
+
<TextInput
|
115
|
+
value={input}
|
116
|
+
onChange={(e) =>
|
117
|
+
handleInputChange({
|
118
|
+
...e,
|
119
|
+
target: {
|
120
|
+
...e.target,
|
121
|
+
value: e.nativeEvent.text,
|
122
|
+
},
|
123
|
+
} as unknown as React.ChangeEvent<HTMLInputElement>)
|
124
|
+
}
|
125
|
+
placeholder="Type your message..."
|
126
|
+
placeholderTextColor="#6b7280"
|
127
|
+
className="flex-1 border border-border rounded-md px-3 py-2 text-foreground bg-background min-h-[40px] max-h-[120px]"
|
128
|
+
onSubmitEditing={(e) => {
|
129
|
+
handleSubmit(e);
|
130
|
+
e.preventDefault();
|
131
|
+
}}
|
132
|
+
autoFocus={true}
|
133
|
+
/>
|
134
|
+
<TouchableOpacity
|
135
|
+
onPress={onSubmit}
|
136
|
+
disabled={!input.trim()}
|
137
|
+
className={`p-2 rounded-md ${
|
138
|
+
input.trim()
|
139
|
+
? "bg-primary"
|
140
|
+
: "bg-muted"
|
141
|
+
}`}
|
142
|
+
>
|
143
|
+
<Ionicons
|
144
|
+
name="send"
|
145
|
+
size={20}
|
146
|
+
color={input.trim() ? "#ffffff" : "#6b7280"}
|
147
|
+
/>
|
148
|
+
</TouchableOpacity>
|
149
|
+
</View>
|
150
|
+
</View>
|
151
|
+
</View>
|
152
|
+
</KeyboardAvoidingView>
|
153
|
+
</Container>
|
154
|
+
);
|
155
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import structuredClone from "@ungap/structured-clone";
|
2
|
+
import { Platform } from "react-native";
|
3
|
+
|
4
|
+
if (Platform.OS !== "web") {
|
5
|
+
const setupPolyfills = async () => {
|
6
|
+
const { polyfillGlobal } = await import(
|
7
|
+
"react-native/Libraries/Utilities/PolyfillFunctions"
|
8
|
+
);
|
9
|
+
|
10
|
+
const { TextEncoderStream, TextDecoderStream } = await import(
|
11
|
+
"@stardazed/streams-text-encoding"
|
12
|
+
);
|
13
|
+
|
14
|
+
if (!("structuredClone" in global)) {
|
15
|
+
polyfillGlobal("structuredClone", () => structuredClone);
|
16
|
+
}
|
17
|
+
|
18
|
+
polyfillGlobal("TextEncoderStream", () => TextEncoderStream);
|
19
|
+
polyfillGlobal("TextDecoderStream", () => TextDecoderStream);
|
20
|
+
};
|
21
|
+
|
22
|
+
setupPolyfills();
|
23
|
+
}
|
24
|
+
|
25
|
+
export {};
|