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.
Files changed (306) hide show
  1. package/README.md +147 -0
  2. package/dist/index.js +4315 -0
  3. package/package.json +75 -0
  4. package/templates/addons/biome/biome.json.hbs +83 -0
  5. package/templates/addons/husky/.husky/pre-commit +1 -0
  6. package/templates/addons/pwa/apps/web/next/public/favicon/apple-touch-icon.png +0 -0
  7. package/templates/addons/pwa/apps/web/next/public/favicon/favicon-96x96.png +0 -0
  8. package/templates/addons/pwa/apps/web/next/public/favicon/favicon.svg +6 -0
  9. package/templates/addons/pwa/apps/web/next/public/favicon/site.webmanifest.hbs +21 -0
  10. package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-192x192.png +0 -0
  11. package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-512x512.png +0 -0
  12. package/templates/addons/pwa/apps/web/next/src/app/manifest.ts.hbs +26 -0
  13. package/templates/addons/pwa/apps/web/vite/public/logo.png +0 -0
  14. package/templates/addons/pwa/apps/web/vite/pwa-assets.config.ts.hbs +12 -0
  15. package/templates/addons/turborepo/turbo.json.hbs +43 -0
  16. package/templates/api/orpc/native/utils/orpc.ts.hbs +35 -0
  17. package/templates/api/orpc/server/base/src/lib/context.ts.hbs +125 -0
  18. package/templates/api/orpc/server/base/src/lib/orpc.ts.hbs +21 -0
  19. package/templates/api/orpc/server/next/src/app/rpc/[...all]/route.ts.hbs +23 -0
  20. package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +35 -0
  21. package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +42 -0
  22. package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +30 -0
  23. package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +31 -0
  24. package/templates/api/trpc/native/utils/trpc.ts.hbs +32 -0
  25. package/templates/api/trpc/server/base/src/lib/context.ts.hbs +127 -0
  26. package/templates/api/trpc/server/base/src/lib/trpc.ts.hbs +26 -0
  27. package/templates/api/trpc/server/next/src/app/trpc/[trpc]/route.ts +14 -0
  28. package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +97 -0
  29. package/templates/auth/native/native-base/lib/auth-client.ts.hbs +13 -0
  30. package/templates/auth/native/nativewind/app/(drawer)/index.tsx.hbs +95 -0
  31. package/templates/auth/native/nativewind/components/sign-in.tsx.hbs +93 -0
  32. package/templates/auth/native/nativewind/components/sign-up.tsx.hbs +104 -0
  33. package/templates/auth/native/unistyles/app/(drawer)/index.tsx.hbs +179 -0
  34. package/templates/auth/native/unistyles/components/sign-in.tsx.hbs +134 -0
  35. package/templates/auth/native/unistyles/components/sign-up.tsx.hbs +152 -0
  36. package/templates/auth/server/base/src/lib/auth.ts.hbs +141 -0
  37. package/templates/auth/server/db/drizzle/mysql/src/db/schema/auth.ts +58 -0
  38. package/templates/auth/server/db/drizzle/postgres/src/db/schema/auth.ts +47 -0
  39. package/templates/auth/server/db/drizzle/sqlite/src/db/schema/auth.ts +55 -0
  40. package/templates/auth/server/db/mongoose/mongodb/src/db/models/auth.model.ts +68 -0
  41. package/templates/auth/server/db/prisma/mongodb/prisma/schema/auth.prisma +59 -0
  42. package/templates/auth/server/db/prisma/mysql/prisma/schema/auth.prisma +59 -0
  43. package/templates/auth/server/db/prisma/postgres/prisma/schema/auth.prisma +59 -0
  44. package/templates/auth/server/db/prisma/sqlite/prisma/schema/auth.prisma +59 -0
  45. package/templates/auth/server/next/src/app/api/auth/[...all]/route.ts +4 -0
  46. package/templates/auth/web/nuxt/app/components/SignInForm.vue +77 -0
  47. package/templates/auth/web/nuxt/app/components/SignUpForm.vue +84 -0
  48. package/templates/auth/web/nuxt/app/components/UserMenu.vue +42 -0
  49. package/templates/auth/web/nuxt/app/middleware/auth.ts +12 -0
  50. package/templates/auth/web/nuxt/app/pages/dashboard.vue +27 -0
  51. package/templates/auth/web/nuxt/app/pages/login.vue +24 -0
  52. package/templates/auth/web/nuxt/app/plugins/auth-client.ts +16 -0
  53. package/templates/auth/web/react/base/src/lib/auth-client.ts.hbs +10 -0
  54. package/templates/auth/web/react/next/src/app/dashboard/page.tsx.hbs +47 -0
  55. package/templates/auth/web/react/next/src/app/login/page.tsx +16 -0
  56. package/templates/auth/web/react/next/src/components/sign-in-form.tsx +135 -0
  57. package/templates/auth/web/react/next/src/components/sign-up-form.tsx +160 -0
  58. package/templates/auth/web/react/next/src/components/theme-provider.tsx +11 -0
  59. package/templates/auth/web/react/next/src/components/user-menu.tsx +60 -0
  60. package/templates/auth/web/react/react-router/src/components/sign-in-form.tsx +135 -0
  61. package/templates/auth/web/react/react-router/src/components/sign-up-form.tsx +160 -0
  62. package/templates/auth/web/react/react-router/src/components/user-menu.tsx +60 -0
  63. package/templates/auth/web/react/react-router/src/routes/dashboard.tsx.hbs +40 -0
  64. package/templates/auth/web/react/react-router/src/routes/login.tsx +13 -0
  65. package/templates/auth/web/react/tanstack-router/src/components/sign-in-form.tsx +139 -0
  66. package/templates/auth/web/react/tanstack-router/src/components/sign-up-form.tsx +164 -0
  67. package/templates/auth/web/react/tanstack-router/src/components/user-menu.tsx +62 -0
  68. package/templates/auth/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +47 -0
  69. package/templates/auth/web/react/tanstack-router/src/routes/login.tsx +18 -0
  70. package/templates/auth/web/react/tanstack-start/src/components/sign-in-form.tsx +139 -0
  71. package/templates/auth/web/react/tanstack-start/src/components/sign-up-form.tsx +164 -0
  72. package/templates/auth/web/react/tanstack-start/src/components/user-menu.tsx +62 -0
  73. package/templates/auth/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +51 -0
  74. package/templates/auth/web/react/tanstack-start/src/routes/login.tsx +18 -0
  75. package/templates/auth/web/solid/src/components/sign-in-form.tsx +132 -0
  76. package/templates/auth/web/solid/src/components/sign-up-form.tsx +158 -0
  77. package/templates/auth/web/solid/src/components/user-menu.tsx.hbs +55 -0
  78. package/templates/auth/web/solid/src/lib/auth-client.ts +5 -0
  79. package/templates/auth/web/solid/src/routes/dashboard.tsx +38 -0
  80. package/templates/auth/web/solid/src/routes/login.tsx +23 -0
  81. package/templates/auth/web/svelte/src/components/SignInForm.svelte +108 -0
  82. package/templates/auth/web/svelte/src/components/SignUpForm.svelte +142 -0
  83. package/templates/auth/web/svelte/src/components/UserMenu.svelte +54 -0
  84. package/templates/auth/web/svelte/src/lib/auth-client.ts +6 -0
  85. package/templates/auth/web/svelte/src/routes/dashboard/+page.svelte +31 -0
  86. package/templates/auth/web/svelte/src/routes/login/+page.svelte +12 -0
  87. package/templates/backend/convex/packages/backend/_gitignore +2 -0
  88. package/templates/backend/convex/packages/backend/convex/README.md +90 -0
  89. package/templates/backend/convex/packages/backend/convex/healthCheck.ts +7 -0
  90. package/templates/backend/convex/packages/backend/convex/schema.ts +9 -0
  91. package/templates/backend/convex/packages/backend/convex/todos.ts +42 -0
  92. package/templates/backend/convex/packages/backend/convex/tsconfig.json +25 -0
  93. package/templates/backend/convex/packages/backend/package.json.hbs +17 -0
  94. package/templates/backend/server/elysia/src/index.ts.hbs +72 -0
  95. package/templates/backend/server/express/src/index.ts.hbs +88 -0
  96. package/templates/backend/server/fastify/src/index.ts.hbs +155 -0
  97. package/templates/backend/server/hono/src/index.ts.hbs +133 -0
  98. package/templates/backend/server/next/next-env.d.ts +5 -0
  99. package/templates/backend/server/next/next.config.ts +7 -0
  100. package/templates/backend/server/next/package.json.hbs +24 -0
  101. package/templates/backend/server/next/src/app/route.ts +5 -0
  102. package/templates/backend/server/next/src/middleware.ts +19 -0
  103. package/templates/backend/server/next/tsconfig.json.hbs +33 -0
  104. package/templates/backend/server/server-base/_gitignore +52 -0
  105. package/templates/backend/server/server-base/package.json.hbs +28 -0
  106. package/templates/backend/server/server-base/src/routers/index.ts.hbs +53 -0
  107. package/templates/backend/server/server-base/tsconfig.json.hbs +39 -0
  108. package/templates/base/_gitignore +2 -0
  109. package/templates/base/package.json.hbs +11 -0
  110. package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +10 -0
  111. package/templates/db/drizzle/mysql/src/db/index.ts.hbs +20 -0
  112. package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +10 -0
  113. package/templates/db/drizzle/postgres/src/db/index.ts.hbs +12 -0
  114. package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +24 -0
  115. package/templates/db/drizzle/sqlite/src/db/index.ts.hbs +35 -0
  116. package/templates/db/mongoose/mongodb/src/db/index.ts.hbs +9 -0
  117. package/templates/db/prisma/mongodb/prisma/index.ts.hbs +5 -0
  118. package/templates/db/prisma/mongodb/prisma/schema/schema.prisma +10 -0
  119. package/templates/db/prisma/mongodb/prisma.config.ts.hbs +8 -0
  120. package/templates/db/prisma/mysql/prisma/index.ts +5 -0
  121. package/templates/db/prisma/mysql/prisma/schema/schema.prisma +10 -0
  122. package/templates/db/prisma/mysql/prisma.config.ts +8 -0
  123. package/templates/db/prisma/postgres/prisma/index.ts +5 -0
  124. package/templates/db/prisma/postgres/prisma/schema/schema.prisma.hbs +13 -0
  125. package/templates/db/prisma/postgres/prisma.config.ts.hbs +12 -0
  126. package/templates/db/prisma/sqlite/prisma/index.ts +5 -0
  127. package/templates/db/prisma/sqlite/prisma/schema/schema.prisma +10 -0
  128. package/templates/db/prisma/sqlite/prisma.config.ts +8 -0
  129. package/templates/examples/ai/native/nativewind/app/(drawer)/ai.tsx.hbs +155 -0
  130. package/templates/examples/ai/native/nativewind/polyfills.js +25 -0
  131. package/templates/examples/ai/native/unistyles/app/(drawer)/ai.tsx.hbs +279 -0
  132. package/templates/examples/ai/native/unistyles/polyfills.js +25 -0
  133. package/templates/examples/ai/server/next/src/app/ai/route.ts +15 -0
  134. package/templates/examples/ai/web/nuxt/app/pages/ai.vue +63 -0
  135. package/templates/examples/ai/web/react/next/src/app/ai/page.tsx +67 -0
  136. package/templates/examples/ai/web/react/react-router/src/routes/ai.tsx +64 -0
  137. package/templates/examples/ai/web/react/tanstack-router/src/routes/ai.tsx +69 -0
  138. package/templates/examples/ai/web/react/tanstack-start/src/routes/ai.tsx +69 -0
  139. package/templates/examples/ai/web/svelte/src/routes/ai/+page.svelte +98 -0
  140. package/templates/examples/todo/native/nativewind/app/(drawer)/todos.tsx.hbs +295 -0
  141. package/templates/examples/todo/native/unistyles/app/(drawer)/todos.tsx.hbs +340 -0
  142. package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +79 -0
  143. package/templates/examples/todo/server/drizzle/mysql/src/db/schema/todo.ts +7 -0
  144. package/templates/examples/todo/server/drizzle/postgres/src/db/schema/todo.ts +7 -0
  145. package/templates/examples/todo/server/drizzle/sqlite/src/db/schema/todo.ts +7 -0
  146. package/templates/examples/todo/server/mongoose/base/src/routers/todo.ts.hbs +66 -0
  147. package/templates/examples/todo/server/mongoose/mongodb/src/db/models/todo.model.ts +24 -0
  148. package/templates/examples/todo/server/prisma/base/src/routers/todo.ts.hbs +118 -0
  149. package/templates/examples/todo/server/prisma/mongodb/prisma/schema/todo.prisma +7 -0
  150. package/templates/examples/todo/server/prisma/mysql/prisma/schema/todo.prisma +7 -0
  151. package/templates/examples/todo/server/prisma/postgres/prisma/schema/todo.prisma +7 -0
  152. package/templates/examples/todo/server/prisma/sqlite/prisma/schema/todo.prisma +7 -0
  153. package/templates/examples/todo/web/nuxt/app/pages/todos.vue +108 -0
  154. package/templates/examples/todo/web/react/next/src/app/todos/page.tsx.hbs +245 -0
  155. package/templates/examples/todo/web/react/react-router/src/routes/todos.tsx.hbs +242 -0
  156. package/templates/examples/todo/web/react/tanstack-router/src/routes/todos.tsx.hbs +247 -0
  157. package/templates/examples/todo/web/react/tanstack-start/src/routes/todos.tsx.hbs +268 -0
  158. package/templates/examples/todo/web/solid/src/routes/todos.tsx.hbs +132 -0
  159. package/templates/examples/todo/web/svelte/src/routes/todos/+page.svelte.hbs +317 -0
  160. package/templates/extras/_npmrc.hbs +5 -0
  161. package/templates/extras/pnpm-workspace.yaml +3 -0
  162. package/templates/frontend/native/native-base/assets/adaptive-icon.png +0 -0
  163. package/templates/frontend/native/native-base/assets/favicon.png +0 -0
  164. package/templates/frontend/native/native-base/assets/icon.png +0 -0
  165. package/templates/frontend/native/native-base/assets/splash.png +0 -0
  166. package/templates/frontend/native/nativewind/_gitignore +25 -0
  167. package/templates/frontend/native/nativewind/app/(drawer)/(tabs)/_layout.tsx +46 -0
  168. package/templates/frontend/native/nativewind/app/(drawer)/(tabs)/index.tsx +19 -0
  169. package/templates/frontend/native/nativewind/app/(drawer)/(tabs)/two.tsx +19 -0
  170. package/templates/frontend/native/nativewind/app/(drawer)/_layout.tsx.hbs +67 -0
  171. package/templates/frontend/native/nativewind/app/(drawer)/index.tsx.hbs +95 -0
  172. package/templates/frontend/native/nativewind/app/+html.tsx +47 -0
  173. package/templates/frontend/native/nativewind/app/+not-found.tsx +29 -0
  174. package/templates/frontend/native/nativewind/app/_layout.tsx.hbs +126 -0
  175. package/templates/frontend/native/nativewind/app/modal.tsx +14 -0
  176. package/templates/frontend/native/nativewind/app-env.d.ts +2 -0
  177. package/templates/frontend/native/nativewind/app.json +46 -0
  178. package/templates/frontend/native/nativewind/babel.config.js +11 -0
  179. package/templates/frontend/native/nativewind/components/container.tsx +8 -0
  180. package/templates/frontend/native/nativewind/components/header-button.tsx +26 -0
  181. package/templates/frontend/native/nativewind/components/tabbar-icon.tsx +8 -0
  182. package/templates/frontend/native/nativewind/global.css +50 -0
  183. package/templates/frontend/native/nativewind/lib/android-navigation-bar.tsx +11 -0
  184. package/templates/frontend/native/nativewind/lib/constants.ts +18 -0
  185. package/templates/frontend/native/nativewind/lib/use-color-scheme.ts +12 -0
  186. package/templates/frontend/native/nativewind/metro.config.js +59 -0
  187. package/templates/frontend/native/nativewind/package.json.hbs +49 -0
  188. package/templates/frontend/native/nativewind/tailwind.config.js +59 -0
  189. package/templates/frontend/native/nativewind/tsconfig.json.hbs +23 -0
  190. package/templates/frontend/native/unistyles/_gitignore +24 -0
  191. package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/_layout.tsx +39 -0
  192. package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/index.tsx +37 -0
  193. package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/two.tsx +37 -0
  194. package/templates/frontend/native/unistyles/app/(drawer)/_layout.tsx.hbs +87 -0
  195. package/templates/frontend/native/unistyles/app/(drawer)/index.tsx.hbs +194 -0
  196. package/templates/frontend/native/unistyles/app/+html.tsx +48 -0
  197. package/templates/frontend/native/unistyles/app/+not-found.tsx +65 -0
  198. package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +104 -0
  199. package/templates/frontend/native/unistyles/app/modal.tsx +33 -0
  200. package/templates/frontend/native/unistyles/app.json +44 -0
  201. package/templates/frontend/native/unistyles/babel.config.js +20 -0
  202. package/templates/frontend/native/unistyles/breakpoints.ts +9 -0
  203. package/templates/frontend/native/unistyles/components/container.tsx +15 -0
  204. package/templates/frontend/native/unistyles/components/header-button.tsx +36 -0
  205. package/templates/frontend/native/unistyles/components/tabbar-icon.tsx +8 -0
  206. package/templates/frontend/native/unistyles/expo-env.d.ts +3 -0
  207. package/templates/frontend/native/unistyles/index.js +2 -0
  208. package/templates/frontend/native/unistyles/metro.config.js +20 -0
  209. package/templates/frontend/native/unistyles/package.json.hbs +50 -0
  210. package/templates/frontend/native/unistyles/theme.ts +98 -0
  211. package/templates/frontend/native/unistyles/tsconfig.json.hbs +17 -0
  212. package/templates/frontend/native/unistyles/unistyles.ts +27 -0
  213. package/templates/frontend/nuxt/_gitignore +24 -0
  214. package/templates/frontend/nuxt/app/app.config.ts +15 -0
  215. package/templates/frontend/nuxt/app/app.vue +13 -0
  216. package/templates/frontend/nuxt/app/assets/css/main.css +2 -0
  217. package/templates/frontend/nuxt/app/components/Header.vue.hbs +45 -0
  218. package/templates/frontend/nuxt/app/components/Loader.vue +5 -0
  219. package/templates/frontend/nuxt/app/components/ModeToggle.vue +23 -0
  220. package/templates/frontend/nuxt/app/layouts/default.vue.hbs +11 -0
  221. package/templates/frontend/nuxt/app/pages/index.vue.hbs +57 -0
  222. package/templates/frontend/nuxt/app/plugins/vue-query.ts.hbs +44 -0
  223. package/templates/frontend/nuxt/nuxt.config.ts.hbs +19 -0
  224. package/templates/frontend/nuxt/package.json.hbs +25 -0
  225. package/templates/frontend/nuxt/public/favicon.ico +0 -0
  226. package/templates/frontend/nuxt/public/robots.txt +2 -0
  227. package/templates/frontend/nuxt/server/tsconfig.json +3 -0
  228. package/templates/frontend/nuxt/tsconfig.json.hbs +9 -0
  229. package/templates/frontend/react/next/next-env.d.ts.hbs +5 -0
  230. package/templates/frontend/react/next/next.config.ts.hbs +5 -0
  231. package/templates/frontend/react/next/package.json.hbs +34 -0
  232. package/templates/frontend/react/next/postcss.config.mjs.hbs +5 -0
  233. package/templates/frontend/react/next/src/app/favicon.ico +0 -0
  234. package/templates/frontend/react/next/src/app/layout.tsx.hbs +41 -0
  235. package/templates/frontend/react/next/src/app/page.tsx.hbs +68 -0
  236. package/templates/frontend/react/next/src/components/mode-toggle.tsx.hbs +39 -0
  237. package/templates/frontend/react/next/src/components/providers.tsx.hbs +56 -0
  238. package/templates/frontend/react/next/src/components/theme-provider.tsx.hbs +11 -0
  239. package/templates/frontend/react/next/tsconfig.json.hbs +33 -0
  240. package/templates/frontend/react/react-router/package.json.hbs +42 -0
  241. package/templates/frontend/react/react-router/public/favicon.ico +0 -0
  242. package/templates/frontend/react/react-router/react-router.config.ts +6 -0
  243. package/templates/frontend/react/react-router/src/components/mode-toggle.tsx +37 -0
  244. package/templates/frontend/react/react-router/src/components/theme-provider.tsx +73 -0
  245. package/templates/frontend/react/react-router/src/root.tsx.hbs +152 -0
  246. package/templates/frontend/react/react-router/src/routes/_index.tsx.hbs +74 -0
  247. package/templates/frontend/react/react-router/src/routes.ts +4 -0
  248. package/templates/frontend/react/react-router/tsconfig.json.hbs +32 -0
  249. package/templates/frontend/react/react-router/vite.config.ts.hbs +33 -0
  250. package/templates/frontend/react/tanstack-router/index.html +12 -0
  251. package/templates/frontend/react/tanstack-router/package.json.hbs +41 -0
  252. package/templates/frontend/react/tanstack-router/src/components/mode-toggle.tsx +37 -0
  253. package/templates/frontend/react/tanstack-router/src/components/theme-provider.tsx +73 -0
  254. package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +66 -0
  255. package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +100 -0
  256. package/templates/frontend/react/tanstack-router/src/routes/index.tsx.hbs +74 -0
  257. package/templates/frontend/react/tanstack-router/tsconfig.json.hbs +23 -0
  258. package/templates/frontend/react/tanstack-router/vite.config.ts.hbs +39 -0
  259. package/templates/frontend/react/tanstack-start/package.json.hbs +44 -0
  260. package/templates/frontend/react/tanstack-start/public/robots.txt +3 -0
  261. package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +144 -0
  262. package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +97 -0
  263. package/templates/frontend/react/tanstack-start/src/routes/index.tsx.hbs +74 -0
  264. package/templates/frontend/react/tanstack-start/tsconfig.json.hbs +33 -0
  265. package/templates/frontend/react/tanstack-start/vite.config.ts +8 -0
  266. package/templates/frontend/react/web-base/_gitignore +52 -0
  267. package/templates/frontend/react/web-base/components.json +21 -0
  268. package/templates/frontend/react/web-base/src/components/header.tsx.hbs +79 -0
  269. package/templates/frontend/react/web-base/src/components/loader.tsx +9 -0
  270. package/templates/frontend/react/web-base/src/components/ui/button.tsx +59 -0
  271. package/templates/frontend/react/web-base/src/components/ui/card.tsx +92 -0
  272. package/templates/frontend/react/web-base/src/components/ui/checkbox.tsx +30 -0
  273. package/templates/frontend/react/web-base/src/components/ui/dropdown-menu.tsx +257 -0
  274. package/templates/frontend/react/web-base/src/components/ui/input.tsx +21 -0
  275. package/templates/frontend/react/web-base/src/components/ui/label.tsx +22 -0
  276. package/templates/frontend/react/web-base/src/components/ui/skeleton.tsx +13 -0
  277. package/templates/frontend/react/web-base/src/components/ui/sonner.tsx +25 -0
  278. package/templates/frontend/react/web-base/src/index.css +134 -0
  279. package/templates/frontend/react/web-base/src/lib/utils.ts +6 -0
  280. package/templates/frontend/solid/_gitignore +7 -0
  281. package/templates/frontend/solid/index.html +13 -0
  282. package/templates/frontend/solid/package.json.hbs +27 -0
  283. package/templates/frontend/solid/public/robots.txt +3 -0
  284. package/templates/frontend/solid/src/components/header.tsx.hbs +38 -0
  285. package/templates/frontend/solid/src/components/loader.tsx +9 -0
  286. package/templates/frontend/solid/src/main.tsx.hbs +38 -0
  287. package/templates/frontend/solid/src/routes/__root.tsx.hbs +34 -0
  288. package/templates/frontend/solid/src/routes/index.tsx.hbs +61 -0
  289. package/templates/frontend/solid/src/styles.css +5 -0
  290. package/templates/frontend/solid/tsconfig.json.hbs +34 -0
  291. package/templates/frontend/solid/vite.config.js.hbs +39 -0
  292. package/templates/frontend/svelte/_gitignore +23 -0
  293. package/templates/frontend/svelte/_npmrc +1 -0
  294. package/templates/frontend/svelte/package.json.hbs +31 -0
  295. package/templates/frontend/svelte/src/app.css +5 -0
  296. package/templates/frontend/svelte/src/app.d.ts +13 -0
  297. package/templates/frontend/svelte/src/app.html +12 -0
  298. package/templates/frontend/svelte/src/components/Header.svelte.hbs +40 -0
  299. package/templates/frontend/svelte/src/lib/index.ts +1 -0
  300. package/templates/frontend/svelte/src/routes/+layout.svelte.hbs +54 -0
  301. package/templates/frontend/svelte/src/routes/+page.svelte.hbs +72 -0
  302. package/templates/frontend/svelte/static/favicon.png +0 -0
  303. package/templates/frontend/svelte/svelte.config.js +18 -0
  304. package/templates/frontend/svelte/tsconfig.json.hbs +24 -0
  305. package/templates/frontend/svelte/vite.config.ts +7 -0
  306. package/templates/runtime/workers/apps/server/wrangler.jsonc.hbs +34 -0
@@ -0,0 +1,98 @@
1
+ <script lang="ts">
2
+ import { PUBLIC_SERVER_URL } from '$env/static/public';
3
+ import { Chat } from '@ai-sdk/svelte';
4
+
5
+ const chat = new Chat({
6
+ api: `${PUBLIC_SERVER_URL}/ai`,
7
+ });
8
+
9
+ let messagesEndElement: HTMLDivElement | null = null;
10
+
11
+ $effect(() => {
12
+ const messageCount = chat.messages.length;
13
+ if (messageCount > 0) {
14
+ setTimeout(() => {
15
+ messagesEndElement?.scrollIntoView({ behavior: 'smooth' });
16
+ }, 0);
17
+ }
18
+ });
19
+
20
+ </script>
21
+
22
+ <div class="mx-auto grid h-full w-full max-w-2xl grid-rows-[1fr_auto] overflow-hidden p-4">
23
+ <div class="mb-4 space-y-4 overflow-y-auto pb-4">
24
+ {#if chat.messages.length === 0}
25
+ <div class="mt-8 text-center text-neutral-500">Ask the AI anything to get started!</div>
26
+ {/if}
27
+
28
+ {#each chat.messages as message (message.id)}
29
+ <div
30
+ class="w-fit max-w-[85%] rounded-lg p-3 text-sm md:text-base"
31
+ class:ml-auto={message.role === 'user'}
32
+ class:bg-indigo-600={message.role === 'user'}
33
+ class:text-white={message.role === 'user'}
34
+ class:bg-neutral-700={message.role === 'assistant'}
35
+ class:text-neutral-100={message.role === 'assistant'}
36
+ >
37
+ <p
38
+ class="mb-1 text-xs font-semibold uppercase tracking-wide"
39
+ class:text-indigo-200={message.role === 'user'}
40
+ class:text-neutral-400={message.role === 'assistant'}
41
+ >
42
+ {message.role === 'user' ? 'You' : 'AI Assistant'}
43
+ </p>
44
+ <div class="whitespace-pre-wrap break-words">
45
+ {#each message.parts as part, partIndex (partIndex)}
46
+ {#if part.type === 'text'}
47
+ {part.text}
48
+ {:else if part.type === 'tool-invocation'}
49
+ <pre class="mt-2 rounded bg-neutral-800 p-2 text-xs text-neutral-300"
50
+ >{JSON.stringify(part.toolInvocation, null, 2)}</pre
51
+ >
52
+ {/if}
53
+ {/each}
54
+ </div>
55
+ </div>
56
+ {/each}
57
+ <div bind:this={messagesEndElement}></div>
58
+ </div>
59
+
60
+ <form
61
+ onsubmit={chat.handleSubmit}
62
+ class="flex w-full items-center space-x-2 border-t border-neutral-700 pt-4"
63
+ >
64
+ <input
65
+ name="prompt"
66
+ bind:value={chat.input}
67
+ placeholder="Type your message..."
68
+ class="flex-1 rounded border border-neutral-600 bg-neutral-800 px-3 py-2 text-neutral-100 placeholder-neutral-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 disabled:opacity-50"
69
+ autocomplete="off"
70
+ onkeydown={(e) => {
71
+ if (e.key === 'Enter' && !e.shiftKey) {
72
+ e.preventDefault();
73
+ chat.handleSubmit(e);
74
+ }
75
+ }}
76
+ />
77
+ <button
78
+ type="submit"
79
+ disabled={!chat.input.trim()}
80
+ class="inline-flex h-10 w-10 items-center justify-center rounded bg-indigo-600 text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:ring-offset-neutral-900 disabled:cursor-not-allowed disabled:opacity-50"
81
+ aria-label="Send message"
82
+ >
83
+ <svg
84
+ xmlns="http://www.w3.org/2000/svg"
85
+ width="18"
86
+ height="18"
87
+ viewBox="0 0 24 24"
88
+ fill="none"
89
+ stroke="currentColor"
90
+ stroke-width="2"
91
+ stroke-linecap="round"
92
+ stroke-linejoin="round"
93
+ >
94
+ <path d="m22 2-7 20-4-9-9-4Z" /><path d="M22 2 11 13" />
95
+ </svg>
96
+ </button>
97
+ </form>
98
+ </div>
@@ -0,0 +1,295 @@
1
+ import { useState } from "react";
2
+ import {
3
+ View,
4
+ Text,
5
+ TextInput,
6
+ TouchableOpacity,
7
+ ScrollView,
8
+ ActivityIndicator,
9
+ Alert,
10
+ } from "react-native";
11
+ import { Ionicons } from "@expo/vector-icons";
12
+ {{#if (eq backend "convex")}}
13
+ import { useMutation, useQuery } from "convex/react";
14
+ import { api } from "@{{projectName}}/backend/convex/_generated/api";
15
+ import type { Id } from "@{{projectName}}/backend/convex/_generated/dataModel";
16
+ {{else}}
17
+ import { useMutation, useQuery } from "@tanstack/react-query";
18
+ {{/if}}
19
+
20
+ import { Container } from "@/components/container";
21
+ {{#unless (eq backend "convex")}}
22
+ {{#if (eq api "orpc")}}
23
+ import { orpc } from "@/utils/orpc";
24
+ {{/if}}
25
+ {{#if (eq api "trpc")}}
26
+ import { trpc } from "@/utils/trpc";
27
+ {{/if}}
28
+ {{/unless}}
29
+
30
+ export default function TodosScreen() {
31
+ const [newTodoText, setNewTodoText] = useState("");
32
+
33
+ {{#if (eq backend "convex")}}
34
+ const todos = useQuery(api.todos.getAll);
35
+ const createTodoMutation = useMutation(api.todos.create);
36
+ const toggleTodoMutation = useMutation(api.todos.toggle);
37
+ const deleteTodoMutation = useMutation(api.todos.deleteTodo);
38
+
39
+ const handleAddTodo = async () => {
40
+ const text = newTodoText.trim();
41
+ if (!text) return;
42
+ await createTodoMutation({ text });
43
+ setNewTodoText("");
44
+ };
45
+
46
+ const handleToggleTodo = (id: Id<"todos">, currentCompleted: boolean) => {
47
+ toggleTodoMutation({ id, completed: !currentCompleted });
48
+ };
49
+
50
+ const handleDeleteTodo = (id: Id<"todos">) => {
51
+ Alert.alert("Delete Todo", "Are you sure you want to delete this todo?", [
52
+ { text: "Cancel", style: "cancel" },
53
+ {
54
+ text: "Delete",
55
+ style: "destructive",
56
+ onPress: () => deleteTodoMutation({ id }),
57
+ },
58
+ ]);
59
+ };
60
+ {{else}}
61
+ {{#if (eq api "orpc")}}
62
+ const todos = useQuery(orpc.todo.getAll.queryOptions());
63
+ const createMutation = useMutation(
64
+ orpc.todo.create.mutationOptions({
65
+ onSuccess: () => {
66
+ todos.refetch();
67
+ setNewTodoText("");
68
+ },
69
+ }),
70
+ );
71
+ const toggleMutation = useMutation(
72
+ orpc.todo.toggle.mutationOptions({
73
+ onSuccess: () => { todos.refetch() },
74
+ }),
75
+ );
76
+ const deleteMutation = useMutation(
77
+ orpc.todo.delete.mutationOptions({
78
+ onSuccess: () => { todos.refetch() },
79
+ }),
80
+ );
81
+ {{/if}}
82
+ {{#if (eq api "trpc")}}
83
+ const todos = useQuery(trpc.todo.getAll.queryOptions());
84
+ const createMutation = useMutation(
85
+ trpc.todo.create.mutationOptions({
86
+ onSuccess: () => {
87
+ todos.refetch();
88
+ setNewTodoText("");
89
+ },
90
+ }),
91
+ );
92
+ const toggleMutation = useMutation(
93
+ trpc.todo.toggle.mutationOptions({
94
+ onSuccess: () => { todos.refetch() },
95
+ }),
96
+ );
97
+ const deleteMutation = useMutation(
98
+ trpc.todo.delete.mutationOptions({
99
+ onSuccess: () => { todos.refetch() },
100
+ }),
101
+ );
102
+ {{/if}}
103
+
104
+ const handleAddTodo = () => {
105
+ if (newTodoText.trim()) {
106
+ createMutation.mutate({ text: newTodoText });
107
+ }
108
+ };
109
+
110
+ const handleToggleTodo = (id: number, completed: boolean) => {
111
+ toggleMutation.mutate({ id, completed: !completed });
112
+ };
113
+
114
+ const handleDeleteTodo = (id: number) => {
115
+ Alert.alert("Delete Todo", "Are you sure you want to delete this todo?", [
116
+ { text: "Cancel", style: "cancel" },
117
+ {
118
+ text: "Delete",
119
+ style: "destructive",
120
+ onPress: () => deleteMutation.mutate({ id }),
121
+ },
122
+ ]);
123
+ };
124
+ {{/if}}
125
+
126
+ return (
127
+ <Container>
128
+ <ScrollView className="flex-1">
129
+ <View className="px-4 py-6">
130
+ <View className="mb-6 rounded-lg border border-border p-4 bg-card">
131
+ <Text className="text-foreground text-2xl font-bold mb-2">
132
+ Todo List
133
+ </Text>
134
+ <Text className="text-muted-foreground mb-4">
135
+ Manage your tasks efficiently
136
+ </Text>
137
+
138
+ <View className="mb-6">
139
+ <View className="flex-row items-center space-x-2 mb-2">
140
+ <TextInput
141
+ value={newTodoText}
142
+ onChangeText={setNewTodoText}
143
+ placeholder="Add a new task..."
144
+ placeholderTextColor="#6b7280"
145
+ {{#if (eq backend "convex")}}
146
+ {{else}}
147
+ editable={!createMutation.isPending}
148
+ {{/if}}
149
+ className="flex-1 border border-border rounded-md px-3 py-2 text-foreground bg-background"
150
+ onSubmitEditing={handleAddTodo}
151
+ returnKeyType="done"
152
+ />
153
+ <TouchableOpacity
154
+ onPress={handleAddTodo}
155
+ {{#if (eq backend "convex")}}
156
+ disabled={!newTodoText.trim()}
157
+ {{else}}
158
+ disabled={createMutation.isPending || !newTodoText.trim()}
159
+ {{/if}}
160
+ className={`px-4 py-2 rounded-md ${
161
+ {{#if (eq backend "convex")}}
162
+ !newTodoText.trim()
163
+ {{else}}
164
+ createMutation.isPending || !newTodoText.trim()
165
+ {{/if}}
166
+ ? "bg-muted"
167
+ : "bg-primary"
168
+ }`}
169
+ >
170
+ {{#if (eq backend "convex")}}
171
+ <Text className="text-white font-medium">Add</Text>
172
+ {{else}}
173
+ {createMutation.isPending ? (
174
+ <ActivityIndicator size="small" color="white" />
175
+ ) : (
176
+ <Text className="text-white font-medium">Add</Text>
177
+ )}
178
+ {{/if}}
179
+ </TouchableOpacity>
180
+ </View>
181
+ </View>
182
+
183
+ {{#if (eq backend "convex")}}
184
+ {todos === undefined ? (
185
+ <View className="flex justify-center py-8">
186
+ <ActivityIndicator size="large" color="#3b82f6" />
187
+ </View>
188
+ ) : todos.length === 0 ? (
189
+ <Text className="py-8 text-center text-muted-foreground">
190
+ No todos yet. Add one above!
191
+ </Text>
192
+ ) : (
193
+ <View className="space-y-2">
194
+ {todos.map((todo) => (
195
+ <View
196
+ key={todo._id}
197
+ className="flex-row items-center justify-between rounded-md border border-border p-3 bg-background"
198
+ >
199
+ <View className="flex-row items-center flex-1">
200
+ <TouchableOpacity
201
+ onPress={() =>
202
+ handleToggleTodo(todo._id, todo.completed)
203
+ }
204
+ className="mr-3"
205
+ >
206
+ <Ionicons
207
+ name={todo.completed ? "checkbox" : "square-outline"}
208
+ size={24}
209
+ color={todo.completed ? "#22c55e" : "#6b7280"}
210
+ />
211
+ </TouchableOpacity>
212
+ <Text
213
+ className={`flex-1 ${
214
+ todo.completed
215
+ ? "line-through text-muted-foreground"
216
+ : "text-foreground"
217
+ }`}
218
+ >
219
+ {todo.text}
220
+ </Text>
221
+ </View>
222
+ <TouchableOpacity
223
+ onPress={() => handleDeleteTodo(todo._id)}
224
+ className="ml-2 p-1"
225
+ >
226
+ <Ionicons
227
+ name="trash-outline"
228
+ size={20}
229
+ color="#ef4444"
230
+ />
231
+ </TouchableOpacity>
232
+ </View>
233
+ ))}
234
+ </View>
235
+ )}
236
+ {{else}}
237
+ {todos.isLoading ? (
238
+ <View className="flex justify-center py-8">
239
+ <ActivityIndicator size="large" color="#3b82f6" />
240
+ </View>
241
+ ) : todos.data?.length === 0 ? (
242
+ <Text className="py-8 text-center text-muted-foreground">
243
+ No todos yet. Add one above!
244
+ </Text>
245
+ ) : (
246
+ <View className="space-y-2">
247
+ {todos.data?.map((todo) => (
248
+ <View
249
+ key={todo.id}
250
+ className="flex-row items-center justify-between rounded-md border border-border p-3 bg-background"
251
+ >
252
+ <View className="flex-row items-center flex-1">
253
+ <TouchableOpacity
254
+ onPress={() =>
255
+ handleToggleTodo(todo.id, todo.completed)
256
+ }
257
+ className="mr-3"
258
+ >
259
+ <Ionicons
260
+ name={todo.completed ? "checkbox" : "square-outline"}
261
+ size={24}
262
+ color={todo.completed ? "#22c55e" : "#6b7280"}
263
+ />
264
+ </TouchableOpacity>
265
+ <Text
266
+ className={`flex-1 ${
267
+ todo.completed
268
+ ? "line-through text-muted-foreground"
269
+ : "text-foreground"
270
+ }`}
271
+ >
272
+ {todo.text}
273
+ </Text>
274
+ </View>
275
+ <TouchableOpacity
276
+ onPress={() => handleDeleteTodo(todo.id)}
277
+ className="ml-2 p-1"
278
+ >
279
+ <Ionicons
280
+ name="trash-outline"
281
+ size={20}
282
+ color="#ef4444"
283
+ />
284
+ </TouchableOpacity>
285
+ </View>
286
+ ))}
287
+ </View>
288
+ )}
289
+ {{/if}}
290
+ </View>
291
+ </View>
292
+ </ScrollView>
293
+ </Container>
294
+ );
295
+ }