create-better-t-stack 1.13.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/dist/index.js +95 -197
  2. package/package.json +72 -69
  3. package/templates/api/orpc/server/base/src/lib/context.ts.hbs +105 -0
  4. package/templates/api/orpc/server/base/src/lib/orpc.ts.hbs +17 -0
  5. package/templates/api/orpc/server/next/src/app/rpc/[...all]/route.ts.hbs +23 -0
  6. package/templates/api/orpc/web/base/src/utils/orpc.ts.hbs +57 -0
  7. package/templates/api/trpc/server/base/src/lib/context.ts.hbs +108 -0
  8. package/{template/with-auth/apps/server/src/lib/trpc.ts → templates/api/trpc/server/base/src/lib/trpc.ts.hbs} +2 -0
  9. package/templates/api/trpc/web/base/src/utils/trpc.ts.hbs +100 -0
  10. package/templates/auth/server/base/src/lib/auth.ts.hbs +30 -0
  11. package/templates/auth/web/base/src/lib/auth-client.ts.hbs +10 -0
  12. package/{template/with-auth/apps/web-next/src/app/dashboard/page.tsx → templates/auth/web/next/src/app/dashboard/page.tsx.hbs} +10 -0
  13. package/{template/with-auth/apps/web-react-router/src/routes/dashboard.tsx → templates/auth/web/react-router/src/routes/dashboard.tsx.hbs} +10 -0
  14. package/{template/with-auth/apps/web-tanstack-router/src/routes/dashboard.tsx → templates/auth/web/tanstack-router/src/routes/dashboard.tsx.hbs} +10 -0
  15. package/{template/with-auth/apps/web-tanstack-start/src/routes/dashboard.tsx → templates/auth/web/tanstack-start/src/routes/dashboard.tsx.hbs} +15 -0
  16. package/{template/with-auth/apps/server/src/with-elysia-index.ts → templates/backend/elysia/src/index.ts.hbs} +38 -3
  17. package/templates/backend/express/src/index.ts.hbs +78 -0
  18. package/templates/backend/hono/src/index.ts.hbs +105 -0
  19. package/{template/with-next/apps/server → templates/backend/next}/package.json +0 -2
  20. package/{template/base/apps/server → templates/backend/server-base}/package.json +0 -1
  21. package/templates/backend/server-base/src/routers/index.ts.hbs +51 -0
  22. package/templates/base/package.json +10 -0
  23. package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +79 -0
  24. package/{template/with-drizzle-sqlite/apps/server → templates/examples/todo/server/drizzle/sqlite}/src/db/schema/todo.ts +2 -2
  25. package/{template/examples/todo/apps/web-react-router/src/routes/todos.tsx → templates/examples/todo/web/react-router/src/routes/todos.tsx.hbs} +28 -0
  26. package/{template/examples/todo/apps/web-tanstack-router/src/routes/todos.tsx → templates/examples/todo/web/tanstack-router/src/routes/todos.tsx.hbs} +28 -0
  27. package/{template/examples/todo/apps/web-tanstack-start/src/routes/todos.tsx → templates/examples/todo/web/tanstack-start/src/routes/todos.tsx.hbs} +33 -0
  28. package/{template/base/apps/web-next → templates/frontend/next}/package.json +0 -2
  29. package/{template/base/apps/web-next/src/app/page.tsx → templates/frontend/next/src/app/page.tsx.hbs} +10 -0
  30. package/{template/base/apps/web-next/src/components/providers.tsx → templates/frontend/next/src/components/providers.tsx.hbs} +12 -0
  31. package/{template/base/apps/web-react-router → templates/frontend/react-router}/package.json +0 -3
  32. package/{template/base/apps/web-react-router/src/root.tsx → templates/frontend/react-router/src/root.tsx.hbs} +28 -1
  33. package/{template/base/apps/web-react-router/src/routes/_index.tsx → templates/frontend/react-router/src/routes/_index.tsx.hbs} +11 -0
  34. package/templates/frontend/react-router/vite.config.ts.hbs +37 -0
  35. package/{template/base/apps/web-tanstack-router → templates/frontend/tanstack-router}/package.json +0 -4
  36. package/{template/base/apps/web-tanstack-router/src/main.tsx → templates/frontend/tanstack-router/src/main.tsx.hbs} +20 -0
  37. package/{template/base/apps/web-tanstack-router/src/routes/__root.tsx → templates/frontend/tanstack-router/src/routes/__root.tsx.hbs} +48 -0
  38. package/{template/base/apps/web-tanstack-router/src/routes/index.tsx → templates/frontend/tanstack-router/src/routes/index.tsx.hbs} +10 -0
  39. package/templates/frontend/tanstack-router/vite.config.ts.hbs +43 -0
  40. package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/package.json +0 -3
  41. package/{template/with-auth/apps/web-tanstack-start/src/router.tsx → templates/frontend/tanstack-start/src/router.tsx.hbs} +29 -3
  42. package/{template/base/apps/web-tanstack-start/src/routes/__root.tsx → templates/frontend/tanstack-start/src/routes/__root.tsx.hbs} +13 -0
  43. package/{template/base/apps/web-tanstack-start/src/routes/index.tsx → templates/frontend/tanstack-start/src/routes/index.tsx.hbs} +11 -0
  44. package/templates/frontend/web-base/src/components/header.tsx.hbs +80 -0
  45. package/template/base/apps/server/src/lib/trpc.ts +0 -8
  46. package/template/base/apps/server/src/routers/index.ts +0 -11
  47. package/template/base/apps/web-base/src/utils/trpc.ts +0 -33
  48. package/template/base/apps/web-next/src/components/header.tsx +0 -30
  49. package/template/base/apps/web-next/src/utils/trpc.ts +0 -33
  50. package/template/base/apps/web-react-router/src/components/header.tsx +0 -31
  51. package/template/base/apps/web-react-router/vite.config.ts +0 -8
  52. package/template/base/apps/web-tanstack-router/src/components/header.tsx +0 -31
  53. package/template/base/apps/web-tanstack-router/vite.config.ts +0 -14
  54. package/template/base/apps/web-tanstack-start/src/components/header.tsx +0 -27
  55. package/template/base/apps/web-tanstack-start/src/router.tsx +0 -70
  56. package/template/base/apps/web-tanstack-start/src/utils/trpc.ts +0 -5
  57. package/template/base/package.json +0 -18
  58. package/template/examples/todo/apps/server/src/routers/with-drizzle-todo.ts +0 -34
  59. package/template/with-auth/apps/server/src/lib/with-elysia-context.ts +0 -18
  60. package/template/with-auth/apps/server/src/lib/with-express-context.ts +0 -14
  61. package/template/with-auth/apps/server/src/lib/with-hono-context.ts +0 -18
  62. package/template/with-auth/apps/server/src/lib/with-next-context.ts +0 -14
  63. package/template/with-auth/apps/server/src/routers/index.ts +0 -17
  64. package/template/with-auth/apps/server/src/with-drizzle-mysql-lib/auth.ts +0 -15
  65. package/template/with-auth/apps/server/src/with-drizzle-postgres-lib/auth.ts +0 -15
  66. package/template/with-auth/apps/server/src/with-drizzle-sqlite-lib/auth.ts +0 -15
  67. package/template/with-auth/apps/server/src/with-express-index.ts +0 -34
  68. package/template/with-auth/apps/server/src/with-hono-index.ts +0 -39
  69. package/template/with-auth/apps/server/src/with-prisma-mongodb-lib/auth.ts +0 -11
  70. package/template/with-auth/apps/server/src/with-prisma-mysql-lib/auth.ts +0 -11
  71. package/template/with-auth/apps/server/src/with-prisma-postgres-lib/auth.ts +0 -11
  72. package/template/with-auth/apps/server/src/with-prisma-sqlite-lib/auth.ts +0 -11
  73. package/template/with-auth/apps/web-base/src/lib/auth-client.ts +0 -5
  74. package/template/with-auth/apps/web-next/src/components/header.tsx +0 -33
  75. package/template/with-auth/apps/web-next/src/lib/auth-client.ts +0 -5
  76. package/template/with-auth/apps/web-next/src/utils/trpc.ts +0 -39
  77. package/template/with-auth/apps/web-react-router/src/components/header.tsx +0 -34
  78. package/template/with-auth/apps/web-react-router/src/utils/trpc.ts +0 -39
  79. package/template/with-auth/apps/web-tanstack-router/src/components/header.tsx +0 -34
  80. package/template/with-auth/apps/web-tanstack-router/src/utils/trpc.ts +0 -39
  81. package/template/with-auth/apps/web-tanstack-start/src/components/header.tsx +0 -32
  82. package/template/with-elysia/apps/server/src/index.ts +0 -27
  83. package/template/with-elysia/apps/server/src/lib/context.ts +0 -13
  84. package/template/with-express/apps/server/src/index.ts +0 -29
  85. package/template/with-express/apps/server/src/lib/context.ts +0 -9
  86. package/template/with-hono/apps/server/src/index.ts +0 -33
  87. package/template/with-hono/apps/server/src/lib/context.ts +0 -13
  88. package/template/with-next/apps/server/src/lib/context.ts +0 -9
  89. /package/{template/with-biome → templates/addons/biome}/biome.json +0 -0
  90. /package/{template/with-husky → templates/addons/husky}/.husky/pre-commit +0 -0
  91. /package/{template/with-pwa → templates/addons/pwa}/apps/web/public/logo.png +0 -0
  92. /package/{template/with-pwa → templates/addons/pwa}/apps/web/pwa-assets.config.ts +0 -0
  93. /package/{template/base → templates/addons/turborepo}/turbo.json +0 -0
  94. /package/{template/with-next/apps/server → templates/api/trpc/server/next}/src/app/trpc/[trpc]/route.ts +0 -0
  95. /package/{template/with-auth/apps → templates/auth}/native/app/(drawer)/index.tsx +0 -0
  96. /package/{template/with-auth/apps → templates/auth}/native/components/sign-in.tsx +0 -0
  97. /package/{template/with-auth/apps → templates/auth}/native/components/sign-up.tsx +0 -0
  98. /package/{template/with-auth/apps → templates/auth}/native/lib/auth-client.ts +0 -0
  99. /package/{template/with-auth/apps → templates/auth}/native/utils/trpc.ts +0 -0
  100. /package/{template/with-drizzle-mysql/apps/server → templates/auth/server/db/drizzle/mysql}/src/db/schema/auth.ts +0 -0
  101. /package/{template/with-drizzle-postgres/apps/server → templates/auth/server/db/drizzle/postgres}/src/db/schema/auth.ts +0 -0
  102. /package/{template/with-drizzle-sqlite/apps/server → templates/auth/server/db/drizzle/sqlite}/src/db/schema/auth.ts +0 -0
  103. /package/{template/with-prisma-sqlite/apps/server → templates/auth/server/db/prisma/mongodb}/prisma/schema/auth.prisma +0 -0
  104. /package/{template/with-prisma-mysql/apps/server → templates/auth/server/db/prisma/mysql}/prisma/schema/auth.prisma +0 -0
  105. /package/{template/with-prisma-postgres/apps/server → templates/auth/server/db/prisma/postgres}/prisma/schema/auth.prisma +0 -0
  106. /package/{template/with-prisma-mongodb/apps/server → templates/auth/server/db/prisma/sqlite}/prisma/schema/auth.prisma +0 -0
  107. /package/{template/with-auth/apps/server/src/with-next-app → templates/auth/server/next/src/app}/api/auth/[...all]/route.ts +0 -0
  108. /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/app/login/page.tsx +0 -0
  109. /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/components/sign-in-form.tsx +0 -0
  110. /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/components/sign-up-form.tsx +0 -0
  111. /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/components/theme-provider.tsx +0 -0
  112. /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/components/user-menu.tsx +0 -0
  113. /package/{template/with-auth/apps/web-react-router → templates/auth/web/react-router}/src/components/sign-in-form.tsx +0 -0
  114. /package/{template/with-auth/apps/web-react-router → templates/auth/web/react-router}/src/components/sign-up-form.tsx +0 -0
  115. /package/{template/with-auth/apps/web-react-router → templates/auth/web/react-router}/src/components/user-menu.tsx +0 -0
  116. /package/{template/with-auth/apps/web-react-router → templates/auth/web/react-router}/src/routes/login.tsx +0 -0
  117. /package/{template/with-auth/apps/web-tanstack-start → templates/auth/web/tanstack-router}/src/components/sign-in-form.tsx +0 -0
  118. /package/{template/with-auth/apps/web-tanstack-start → templates/auth/web/tanstack-router}/src/components/sign-up-form.tsx +0 -0
  119. /package/{template/with-auth/apps/web-tanstack-start → templates/auth/web/tanstack-router}/src/components/user-menu.tsx +0 -0
  120. /package/{template/with-auth/apps/web-tanstack-start → templates/auth/web/tanstack-router}/src/routes/login.tsx +0 -0
  121. /package/{template/with-auth/apps/web-tanstack-router → templates/auth/web/tanstack-start}/src/components/sign-in-form.tsx +0 -0
  122. /package/{template/with-auth/apps/web-tanstack-router → templates/auth/web/tanstack-start}/src/components/sign-up-form.tsx +0 -0
  123. /package/{template/with-auth/apps/web-tanstack-router → templates/auth/web/tanstack-start}/src/components/user-menu.tsx +0 -0
  124. /package/{template/with-auth/apps/web-tanstack-router → templates/auth/web/tanstack-start}/src/routes/login.tsx +0 -0
  125. /package/{template/with-next/apps/server → templates/backend/next}/next-env.d.ts +0 -0
  126. /package/{template/with-next/apps/server → templates/backend/next}/next.config.ts +0 -0
  127. /package/{template/with-next/apps/server → templates/backend/next}/src/app/route.ts +0 -0
  128. /package/{template/with-next/apps/server → templates/backend/next}/src/middleware.ts +0 -0
  129. /package/{template/with-next/apps/server → templates/backend/next}/tsconfig.json +0 -0
  130. /package/{template/base/apps/server → templates/backend/server-base}/_gitignore +0 -0
  131. /package/{template/base/apps/server → templates/backend/server-base}/tsconfig.json +0 -0
  132. /package/{template → templates}/base/_gitignore +0 -0
  133. /package/{template/with-drizzle-mysql/apps/server → templates/db/drizzle/mysql}/drizzle.config.ts +0 -0
  134. /package/{template/with-drizzle-mysql/apps/server → templates/db/drizzle/mysql}/src/db/index.ts +0 -0
  135. /package/{template/with-drizzle-postgres/apps/server → templates/db/drizzle/postgres}/drizzle.config.ts +0 -0
  136. /package/{template/with-drizzle-postgres/apps/server → templates/db/drizzle/postgres}/src/db/index.ts +0 -0
  137. /package/{template/with-drizzle-sqlite/apps/server → templates/db/drizzle/sqlite}/drizzle.config.ts +0 -0
  138. /package/{template/with-drizzle-sqlite/apps/server → templates/db/drizzle/sqlite}/src/db/index.ts +0 -0
  139. /package/{template/with-prisma-sqlite/apps/server → templates/db/prisma/mongodb}/prisma/index.ts +0 -0
  140. /package/{template/with-prisma-mongodb/apps/server → templates/db/prisma/mongodb}/prisma/schema/schema.prisma +0 -0
  141. /package/{template/with-prisma-postgres/apps/server → templates/db/prisma/mysql}/prisma/index.ts +0 -0
  142. /package/{template/with-prisma-mysql/apps/server → templates/db/prisma/mysql}/prisma/schema/schema.prisma +0 -0
  143. /package/{template/with-prisma-mysql/apps/server → templates/db/prisma/postgres}/prisma/index.ts +0 -0
  144. /package/{template/with-prisma-postgres/apps/server → templates/db/prisma/postgres}/prisma/schema/schema.prisma +0 -0
  145. /package/{template/with-prisma-mongodb/apps/server → templates/db/prisma/sqlite}/prisma/index.ts +0 -0
  146. /package/{template/with-prisma-sqlite/apps/server → templates/db/prisma/sqlite}/prisma/schema/schema.prisma +0 -0
  147. /package/{template/examples/ai/apps/web-react-router → templates/examples/ai/apps/react-router}/src/routes/ai.tsx +0 -0
  148. /package/{template/examples/ai/apps/web-tanstack-start → templates/examples/ai/apps/tanstack-router}/src/routes/ai.tsx +0 -0
  149. /package/{template/examples/ai/apps/web-tanstack-router → templates/examples/ai/apps/tanstack-start}/src/routes/ai.tsx +0 -0
  150. /package/{template/with-drizzle-mysql/apps/server → templates/examples/todo/server/drizzle/mysql}/src/db/schema/todo.ts +0 -0
  151. /package/{template/with-drizzle-postgres/apps/server → templates/examples/todo/server/drizzle/postgres}/src/db/schema/todo.ts +0 -0
  152. /package/{template/examples/todo/apps/server/src/routers/with-prisma-todo.ts → templates/examples/todo/server/prisma/base/trpc/src/routers/todo.ts} +0 -0
  153. /package/{template/with-prisma-mongodb/apps/server → templates/examples/todo/server/prisma/mongodb}/prisma/schema/todo.prisma +0 -0
  154. /package/{template/with-prisma-sqlite/apps/server → templates/examples/todo/server/prisma/mysql}/prisma/schema/todo.prisma +0 -0
  155. /package/{template/with-prisma-postgres/apps/server → templates/examples/todo/server/prisma/postgres}/prisma/schema/todo.prisma +0 -0
  156. /package/{template/with-prisma-mysql/apps/server → templates/examples/todo/server/prisma/sqlite}/prisma/schema/todo.prisma +0 -0
  157. /package/{template/with-pnpm → templates/extras}/pnpm-workspace.yaml +0 -0
  158. /package/{template/base/apps → templates/frontend}/native/_gitignore +0 -0
  159. /package/{template/base/apps → templates/frontend}/native/app/(drawer)/(tabs)/_layout.tsx +0 -0
  160. /package/{template/base/apps → templates/frontend}/native/app/(drawer)/(tabs)/index.tsx +0 -0
  161. /package/{template/base/apps → templates/frontend}/native/app/(drawer)/(tabs)/two.tsx +0 -0
  162. /package/{template/base/apps → templates/frontend}/native/app/(drawer)/_layout.tsx +0 -0
  163. /package/{template/base/apps → templates/frontend}/native/app/(drawer)/index.tsx +0 -0
  164. /package/{template/base/apps → templates/frontend}/native/app/+html.tsx +0 -0
  165. /package/{template/base/apps → templates/frontend}/native/app/+not-found.tsx +0 -0
  166. /package/{template/base/apps → templates/frontend}/native/app/_layout.tsx +0 -0
  167. /package/{template/base/apps → templates/frontend}/native/app/modal.tsx +0 -0
  168. /package/{template/base/apps → templates/frontend}/native/app-env.d.ts +0 -0
  169. /package/{template/base/apps → templates/frontend}/native/app.json +0 -0
  170. /package/{template/base/apps → templates/frontend}/native/assets/adaptive-icon.png +0 -0
  171. /package/{template/base/apps → templates/frontend}/native/assets/favicon.png +0 -0
  172. /package/{template/base/apps → templates/frontend}/native/assets/icon.png +0 -0
  173. /package/{template/base/apps → templates/frontend}/native/assets/splash.png +0 -0
  174. /package/{template/base/apps → templates/frontend}/native/babel.config.js +0 -0
  175. /package/{template/base/apps → templates/frontend}/native/components/container.tsx +0 -0
  176. /package/{template/base/apps → templates/frontend}/native/components/header-button.tsx +0 -0
  177. /package/{template/base/apps → templates/frontend}/native/components/tabbar-icon.tsx +0 -0
  178. /package/{template/base/apps → templates/frontend}/native/global.css +0 -0
  179. /package/{template/base/apps → templates/frontend}/native/lib/android-navigation-bar.tsx +0 -0
  180. /package/{template/base/apps → templates/frontend}/native/lib/constants.ts +0 -0
  181. /package/{template/base/apps → templates/frontend}/native/lib/use-color-scheme.ts +0 -0
  182. /package/{template/base/apps → templates/frontend}/native/metro.config.js +0 -0
  183. /package/{template/base/apps → templates/frontend}/native/package.json +0 -0
  184. /package/{template/base/apps → templates/frontend}/native/tailwind.config.js +0 -0
  185. /package/{template/base/apps → templates/frontend}/native/tsconfig.json +0 -0
  186. /package/{template/base/apps → templates/frontend}/native/utils/trpc.ts +0 -0
  187. /package/{template/base/apps/web-next → templates/frontend/next}/next-env.d.ts +0 -0
  188. /package/{template/base/apps/web-next → templates/frontend/next}/next.config.ts +0 -0
  189. /package/{template/base/apps/web-next → templates/frontend/next}/postcss.config.mjs +0 -0
  190. /package/{template/base/apps/web-next → templates/frontend/next}/src/app/favicon.ico +0 -0
  191. /package/{template/base/apps/web-next → templates/frontend/next}/src/app/layout.tsx +0 -0
  192. /package/{template/base/apps/web-next → templates/frontend/next}/src/components/mode-toggle.tsx +0 -0
  193. /package/{template/base/apps/web-next → templates/frontend/next}/src/components/theme-provider.tsx +0 -0
  194. /package/{template/base/apps/web-next → templates/frontend/next}/tsconfig.json +0 -0
  195. /package/{template/base/apps/web-react-router → templates/frontend/react-router}/public/favicon.ico +0 -0
  196. /package/{template/base/apps/web-react-router → templates/frontend/react-router}/react-router.config.ts +0 -0
  197. /package/{template/base/apps/web-tanstack-router → templates/frontend/react-router}/src/components/mode-toggle.tsx +0 -0
  198. /package/{template/base/apps/web-tanstack-router → templates/frontend/react-router}/src/components/theme-provider.tsx +0 -0
  199. /package/{template/base/apps/web-react-router → templates/frontend/react-router}/src/routes.ts +0 -0
  200. /package/{template/base/apps/web-react-router → templates/frontend/react-router}/tsconfig.json +0 -0
  201. /package/{template/base/apps/web-tanstack-router → templates/frontend/tanstack-router}/index.html +0 -0
  202. /package/{template/base/apps/web-react-router → templates/frontend/tanstack-router}/src/components/mode-toggle.tsx +0 -0
  203. /package/{template/base/apps/web-react-router → templates/frontend/tanstack-router}/src/components/theme-provider.tsx +0 -0
  204. /package/{template/base/apps/web-tanstack-router → templates/frontend/tanstack-router}/tsconfig.json +0 -0
  205. /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/app.config.ts +0 -0
  206. /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/public/robots.txt +0 -0
  207. /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/src/api.ts +0 -0
  208. /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/src/client.tsx +0 -0
  209. /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/src/ssr.tsx +0 -0
  210. /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/tsconfig.json +0 -0
  211. /package/{template/base/apps → templates/frontend}/web-base/_gitignore +0 -0
  212. /package/{template/base/apps → templates/frontend}/web-base/components.json +0 -0
  213. /package/{template/base/apps → templates/frontend}/web-base/src/components/loader.tsx +0 -0
  214. /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/button.tsx +0 -0
  215. /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/card.tsx +0 -0
  216. /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/checkbox.tsx +0 -0
  217. /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/dropdown-menu.tsx +0 -0
  218. /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/input.tsx +0 -0
  219. /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/label.tsx +0 -0
  220. /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/skeleton.tsx +0 -0
  221. /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/sonner.tsx +0 -0
  222. /package/{template/base/apps → templates/frontend}/web-base/src/index.css +0 -0
  223. /package/{template/base/apps → templates/frontend}/web-base/src/lib/utils.ts +0 -0
package/package.json CHANGED
@@ -1,71 +1,74 @@
1
1
  {
2
- "name": "create-better-t-stack",
3
- "version": "1.13.2",
4
- "description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
5
- "type": "module",
6
- "license": "MIT",
7
- "author": "Aman Varshney",
8
- "bin": {
9
- "create-better-t-stack": "dist/index.js"
10
- },
11
- "files": [
12
- "template",
13
- "dist"
14
- ],
15
- "keywords": [
16
- "better-t-stack",
17
- "typescript",
18
- "boilerplate",
19
- "starter",
20
- "cli",
21
- "turborepo",
22
- "trpc",
23
- "better-auth",
24
- "monorepo",
25
- "fullstack",
26
- "type-safety",
27
- "react",
28
- "react-native",
29
- "expo",
30
- "hono",
31
- "elysia",
32
- "drizzle",
33
- "prisma",
34
- "tanstack",
35
- "tailwind",
36
- "shadcn",
37
- "pwa",
38
- "tauri",
39
- "biome"
40
- ],
41
- "repository": {
42
- "type": "git",
43
- "url": "git+https://github.com/AmanVarshney01/create-better-t-stack.git",
44
- "directory": "apps/cli"
45
- },
46
- "homepage": "https://better-t-stack.pages.dev/",
47
- "scripts": {
48
- "build": "tsup",
49
- "dev": "tsup --watch",
50
- "check-types": "tsc --noEmit",
51
- "check": "biome check --write .",
52
- "test": "vitest run",
53
- "prepublishOnly": "npm run build"
54
- },
55
- "dependencies": {
56
- "@clack/prompts": "^0.10.1",
57
- "consola": "^3.4.2",
58
- "execa": "^8.0.1",
59
- "fs-extra": "^11.3.0",
60
- "gradient-string": "^3.0.0",
61
- "picocolors": "^1.1.1",
62
- "yargs": "^17.7.2"
63
- },
64
- "devDependencies": {
65
- "@types/fs-extra": "^11.0.4",
66
- "@types/node": "^20.17.30",
67
- "@types/yargs": "^17.0.33",
68
- "tsup": "^8.4.0",
69
- "typescript": "^5.8.3"
70
- }
2
+ "name": "create-better-t-stack",
3
+ "version": "2.0.0",
4
+ "description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Aman Varshney",
8
+ "bin": {
9
+ "create-better-t-stack": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "templates",
13
+ "dist"
14
+ ],
15
+ "keywords": [
16
+ "better-t-stack",
17
+ "typescript",
18
+ "boilerplate",
19
+ "starter",
20
+ "cli",
21
+ "turborepo",
22
+ "trpc",
23
+ "better-auth",
24
+ "monorepo",
25
+ "fullstack",
26
+ "type-safety",
27
+ "react",
28
+ "react-native",
29
+ "expo",
30
+ "hono",
31
+ "elysia",
32
+ "drizzle",
33
+ "prisma",
34
+ "tanstack",
35
+ "tailwind",
36
+ "shadcn",
37
+ "pwa",
38
+ "tauri",
39
+ "biome"
40
+ ],
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/AmanVarshney01/create-better-t-stack.git",
44
+ "directory": "apps/cli"
45
+ },
46
+ "homepage": "https://better-t-stack.pages.dev/",
47
+ "scripts": {
48
+ "build": "tsup",
49
+ "dev": "tsup --watch",
50
+ "check-types": "tsc --noEmit",
51
+ "check": "biome check --write .",
52
+ "test": "vitest run",
53
+ "prepublishOnly": "npm run build"
54
+ },
55
+ "dependencies": {
56
+ "@clack/prompts": "^0.10.1",
57
+ "consola": "^3.4.2",
58
+ "execa": "^8.0.1",
59
+ "fs-extra": "^11.3.0",
60
+ "globby": "^14.1.0",
61
+ "gradient-string": "^3.0.0",
62
+ "handlebars": "^4.7.8",
63
+ "picocolors": "^1.1.1",
64
+ "yargs": "^17.7.2"
65
+ },
66
+ "devDependencies": {
67
+ "@types/fs-extra": "^11.0.4",
68
+ "@types/globby": "^9.1.0",
69
+ "@types/node": "^20.17.30",
70
+ "@types/yargs": "^17.0.33",
71
+ "tsup": "^8.4.0",
72
+ "typescript": "^5.8.3"
73
+ }
71
74
  }
@@ -0,0 +1,105 @@
1
+ {{#if (eq backend 'next')}}
2
+ import type { NextRequest } from "next/server";
3
+ {{#if auth}}
4
+ import { auth } from "./auth";
5
+ {{/if}}
6
+
7
+ export async function createContext(req: NextRequest) {
8
+ {{#if auth}}
9
+ const session = await auth.api.getSession({
10
+ headers: req.headers,
11
+ });
12
+ return {
13
+ session,
14
+ };
15
+ {{else}}
16
+ return {}
17
+ {{/if}}
18
+ }
19
+
20
+ {{else if (eq backend 'hono')}}
21
+ import type { Context as HonoContext } from "hono";
22
+ {{#if auth}}
23
+ import { auth } from "./auth";
24
+ {{/if}}
25
+
26
+ export type CreateContextOptions = {
27
+ context: HonoContext;
28
+ };
29
+
30
+ export async function createContext({ context }: CreateContextOptions) {
31
+ {{#if auth}}
32
+ const session = await auth.api.getSession({
33
+ headers: context.req.raw.headers,
34
+ });
35
+ return {
36
+ session,
37
+ };
38
+ {{else}}
39
+ // No auth configured
40
+ return {
41
+ session: null,
42
+ };
43
+ {{/if}}
44
+ }
45
+
46
+ {{else if (eq backend 'elysia')}}
47
+ import type { Context as ElysiaContext } from "elysia";
48
+ {{#if auth}}
49
+ import { auth } from "./auth";
50
+ {{/if}}
51
+
52
+ export type CreateContextOptions = {
53
+ context: ElysiaContext;
54
+ };
55
+
56
+ export async function createContext({ context }: CreateContextOptions) {
57
+ {{#if auth}}
58
+ const session = await auth.api.getSession({
59
+ headers: context.request.headers,
60
+ });
61
+ return {
62
+ session,
63
+ };
64
+ {{else}}
65
+ // No auth configured
66
+ return {
67
+ session: null,
68
+ };
69
+ {{/if}}
70
+ }
71
+
72
+ {{else if (eq backend 'express')}}
73
+ import type { CreateExpressContextOptions } from "@trpc/server/adapters/express";
74
+ {{#if auth}}
75
+ import { fromNodeHeaders } from "better-auth/node";
76
+ import { auth } from "./auth";
77
+ {{/if}}
78
+
79
+ export async function createContext(opts: CreateExpressContextOptions) {
80
+ {{#if auth}}
81
+ const session = await auth.api.getSession({
82
+ headers: fromNodeHeaders(opts.req.headers),
83
+ });
84
+ return {
85
+ session,
86
+ };
87
+ {{else}}
88
+ // No auth configured
89
+ return {
90
+ session: null,
91
+ };
92
+ {{/if}}
93
+ }
94
+
95
+ {{else}}
96
+ // Default or fallback context if backend is not recognized or none
97
+ // This might need adjustment based on your default behavior
98
+ export async function createContext() {
99
+ return {
100
+ session: null,
101
+ };
102
+ }
103
+ {{/if}}
104
+
105
+ export type Context = Awaited<ReturnType<typeof createContext>>;
@@ -0,0 +1,17 @@
1
+ import { ORPCError, os } from "@orpc/server";
2
+ import type { Context } from "./context";
3
+
4
+ export const o = os.$context<Context>();
5
+
6
+ export const publicProcedure = o;
7
+
8
+ {{#if auth}}
9
+ const requireAuth = o.middleware(async ({ context, next }) => {
10
+ if (!context.session?.user) {
11
+ throw new ORPCError("UNAUTHORIZED");
12
+ }
13
+ return next({ context });
14
+ });
15
+
16
+ export const protectedProcedure = publicProcedure.use(requireAuth);
17
+ {{/if}}
@@ -0,0 +1,23 @@
1
+ {{#if auth}}
2
+ import { createContext } from '@/lib/context'
3
+ {{/if}}
4
+ import { appRouter } from '@/routers'
5
+ import { RPCHandler } from '@orpc/server/fetch'
6
+ import { NextRequest } from 'next/server'
7
+
8
+ const handler = new RPCHandler(appRouter)
9
+
10
+ async function handleRequest(req: NextRequest) {
11
+ const { response } = await handler.handle(req, {
12
+ prefix: '/rpc',
13
+ context: {{#if auth}}await createContext(req){{else}}{}{{/if}},
14
+ })
15
+
16
+ return response ?? new Response('Not found', { status: 404 })
17
+ }
18
+
19
+ export const GET = handleRequest
20
+ export const POST = handleRequest
21
+ export const PUT = handleRequest
22
+ export const PATCH = handleRequest
23
+ export const DELETE = handleRequest
@@ -0,0 +1,57 @@
1
+ import { createORPCClient } from "@orpc/client";
2
+ import { RPCLink } from "@orpc/client/fetch";
3
+ import { createORPCReactQueryUtils } from "@orpc/react-query";
4
+ import { QueryCache, QueryClient } from "@tanstack/react-query";
5
+ import { toast } from "sonner";
6
+ import type { appRouter } from "../../../server/src/routers/index";
7
+ import type { RouterClient } from "@orpc/server";
8
+ import { createContext, use } from 'react'
9
+ import type { RouterUtils } from '@orpc/react-query'
10
+
11
+ type ORPCReactUtils = RouterUtils<RouterClient<typeof appRouter>>
12
+
13
+ export const queryClient = new QueryClient({
14
+ queryCache: new QueryCache({
15
+ onError: (error) => {
16
+ toast.error(`Error: ${error.message}`, {
17
+ action: {
18
+ label: "retry",
19
+ onClick: () => {
20
+ queryClient.invalidateQueries();
21
+ },
22
+ },
23
+ });
24
+ },
25
+ }),
26
+ });
27
+
28
+ export const link = new RPCLink({
29
+ {{#if (includes frontend "next")}}
30
+ url: `${process.env.NEXT_PUBLIC_SERVER_URL}/rpc`,
31
+ {{else}}
32
+ url: `${import.meta.env.VITE_SERVER_URL}/rpc`,
33
+ {{/if}}
34
+ {{#if auth}}
35
+ fetch(url, options) {
36
+ return fetch(url, {
37
+ ...options,
38
+ credentials: "include",
39
+ });
40
+ },
41
+ {{/if}}
42
+ });
43
+
44
+ export const client: RouterClient<typeof appRouter> = createORPCClient(link)
45
+
46
+ export const orpc = createORPCReactQueryUtils(client)
47
+
48
+
49
+ export const ORPCContext = createContext<ORPCReactUtils | undefined>(undefined)
50
+
51
+ export function useORPC(): ORPCReactUtils {
52
+ const orpc = use(ORPCContext)
53
+ if (!orpc) {
54
+ throw new Error('ORPCContext is not set up properly')
55
+ }
56
+ return orpc
57
+ }
@@ -0,0 +1,108 @@
1
+ {{#if (eq backend 'next')}}
2
+ import type { NextRequest } from "next/server";
3
+ {{#if auth}}
4
+ import { auth } from "./auth";
5
+ {{/if}}
6
+
7
+ export async function createContext(req: NextRequest) {
8
+ {{#if auth}}
9
+ const session = await auth.api.getSession({
10
+ headers: req.headers,
11
+ });
12
+ return {
13
+ session,
14
+ };
15
+ {{else}}
16
+ // No auth configured
17
+ return {
18
+ session: null,
19
+ };
20
+ {{/if}}
21
+ }
22
+
23
+ {{else if (eq backend 'hono')}}
24
+ import type { Context as HonoContext } from "hono";
25
+ {{#if auth}}
26
+ import { auth } from "./auth";
27
+ {{/if}}
28
+
29
+ export type CreateContextOptions = {
30
+ context: HonoContext;
31
+ };
32
+
33
+ export async function createContext({ context }: CreateContextOptions) {
34
+ {{#if auth}}
35
+ const session = await auth.api.getSession({
36
+ headers: context.req.raw.headers,
37
+ });
38
+ return {
39
+ session,
40
+ };
41
+ {{else}}
42
+ // No auth configured
43
+ return {
44
+ session: null,
45
+ };
46
+ {{/if}}
47
+ }
48
+
49
+ {{else if (eq backend 'elysia')}}
50
+ import type { Context as ElysiaContext } from "elysia";
51
+ {{#if auth}}
52
+ import { auth } from "./auth";
53
+ {{/if}}
54
+
55
+ export type CreateContextOptions = {
56
+ context: ElysiaContext;
57
+ };
58
+
59
+ export async function createContext({ context }: CreateContextOptions) {
60
+ {{#if auth}}
61
+ const session = await auth.api.getSession({
62
+ headers: context.request.headers,
63
+ });
64
+ return {
65
+ session,
66
+ };
67
+ {{else}}
68
+ // No auth configured
69
+ return {
70
+ session: null,
71
+ };
72
+ {{/if}}
73
+ }
74
+
75
+ {{else if (eq backend 'express')}}
76
+ import type { CreateExpressContextOptions } from "@trpc/server/adapters/express";
77
+ {{#if auth}}
78
+ import { fromNodeHeaders } from "better-auth/node";
79
+ import { auth } from "./auth";
80
+ {{/if}}
81
+
82
+ export async function createContext(opts: CreateExpressContextOptions) {
83
+ {{#if auth}}
84
+ const session = await auth.api.getSession({
85
+ headers: fromNodeHeaders(opts.req.headers),
86
+ });
87
+ return {
88
+ session,
89
+ };
90
+ {{else}}
91
+ // No auth configured
92
+ return {
93
+ session: null,
94
+ };
95
+ {{/if}}
96
+ }
97
+
98
+ {{else}}
99
+ // Default or fallback context if backend is not recognized or none
100
+ // This might need adjustment based on your default behavior
101
+ export async function createContext() {
102
+ return {
103
+ session: null,
104
+ };
105
+ }
106
+ {{/if}}
107
+
108
+ export type Context = Awaited<ReturnType<typeof createContext>>;
@@ -7,6 +7,7 @@ export const router = t.router;
7
7
 
8
8
  export const publicProcedure = t.procedure;
9
9
 
10
+ {{#if auth}}
10
11
  export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
11
12
  if (!ctx.session) {
12
13
  throw new TRPCError({
@@ -22,3 +23,4 @@ export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
22
23
  },
23
24
  });
24
25
  });
26
+ {{/if}}
@@ -0,0 +1,100 @@
1
+ {{#if (includes frontend 'next')}}
2
+ {{!-- Next.js tRPC Client Setup --}}
3
+ import { QueryCache, QueryClient } from '@tanstack/react-query';
4
+ import { createTRPCClient, httpBatchLink } from '@trpc/client';
5
+ import { createTRPCOptionsProxy } from '@trpc/tanstack-react-query';
6
+ import type { AppRouter } from '../../../server/src/routers'; {{! Adjust path if necessary }}
7
+ import { toast } from 'sonner';
8
+
9
+ export const queryClient = new QueryClient({
10
+ queryCache: new QueryCache({
11
+ onError: (error) => {
12
+ toast.error(error.message, {
13
+ action: {
14
+ label: "retry",
15
+ onClick: () => {
16
+ queryClient.invalidateQueries();
17
+ },
18
+ },
19
+ });
20
+ },
21
+ }),
22
+ });
23
+
24
+ const trpcClient = createTRPCClient<AppRouter>({
25
+ links: [
26
+ httpBatchLink({
27
+ {{#if (includes frontend 'next')}}
28
+ url: `${process.env.NEXT_PUBLIC_SERVER_URL}/trpc`,
29
+ {{else}}
30
+ url: `${import.meta.env.VITE_SERVER_URL}/trpc`,
31
+ {{/if}}
32
+ {{#if auth}}
33
+ fetch(url, options) {
34
+ return fetch(url, {
35
+ ...options,
36
+ credentials: "include",
37
+ });
38
+ },
39
+ {{/if}}
40
+ }),
41
+ ],
42
+ })
43
+
44
+ export const trpc = createTRPCOptionsProxy<AppRouter>({
45
+ client: trpcClient,
46
+ queryClient,
47
+ });
48
+
49
+ {{else if (includes frontend 'tanstack-start')}}
50
+ {{!-- TanStack Start tRPC Client Setup --}}
51
+ import { createTRPCContext } from "@trpc/tanstack-react-query";
52
+ import type { AppRouter } from "../../../server/src/routers"; {{! Adjust path if necessary }}
53
+
54
+ export const { TRPCProvider, useTRPC, useTRPCClient } =
55
+ createTRPCContext<AppRouter>();
56
+
57
+ {{else}}
58
+ {{!-- Default Web tRPC Client Setup (TanStack Router, React Router, etc.) --}}
59
+ import type { AppRouter } from "../../../server/src/routers"; {{! Adjust path if necessary }}
60
+ import { QueryCache, QueryClient } from "@tanstack/react-query";
61
+ import { createTRPCClient, httpBatchLink } from "@trpc/client";
62
+ import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
63
+ import { toast } from "sonner";
64
+
65
+ export const queryClient = new QueryClient({
66
+ queryCache: new QueryCache({
67
+ onError: (error) => {
68
+ toast.error(error.message, {
69
+ action: {
70
+ label: "retry",
71
+ onClick: () => {
72
+ queryClient.invalidateQueries();
73
+ },
74
+ },
75
+ });
76
+ },
77
+ }),
78
+ });
79
+
80
+ export const trpcClient = createTRPCClient<AppRouter>({
81
+ links: [
82
+ httpBatchLink({
83
+ url: `${import.meta.env.VITE_SERVER_URL}/trpc`,
84
+ {{#if auth}}
85
+ fetch(url, options) {
86
+ return fetch(url, {
87
+ ...options,
88
+ credentials: "include",
89
+ });
90
+ },
91
+ {{/if}}
92
+ }),
93
+ ],
94
+ });
95
+
96
+ export const trpc = createTRPCOptionsProxy<AppRouter>({
97
+ client: trpcClient,
98
+ queryClient,
99
+ });
100
+ {{/if}}
@@ -0,0 +1,30 @@
1
+ import { betterAuth } from "better-auth";
2
+
3
+ {{#if (eq orm "prisma")}}
4
+ import { prismaAdapter } from "better-auth/adapters/prisma";
5
+ import prisma from "../../prisma";
6
+
7
+ export const auth = betterAuth({
8
+ database: prismaAdapter(prisma, {
9
+ provider: "{{database}}"
10
+ }),
11
+ trustedOrigins: [process.env.CORS_ORIGIN || ""],
12
+ emailAndPassword: { enabled: true }
13
+ });
14
+
15
+ {{else if (eq orm "drizzle")}}
16
+ import { drizzleAdapter } from "better-auth/adapters/drizzle";
17
+ import { db } from "../db";
18
+ import * as schema from "../db/schema/auth";
19
+
20
+ export const auth = betterAuth({
21
+ database: drizzleAdapter(db, {
22
+ {{#if (eq database "postgresql")}}provider: "pg",{{/if}}
23
+ {{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
24
+ {{#if (eq database "mysql")}}provider: "mysql",{{/if}}
25
+ schema: schema
26
+ }),
27
+ trustedOrigins: [process.env.CORS_ORIGIN || ""],
28
+ emailAndPassword: { enabled: true }
29
+ });
30
+ {{/if}}
@@ -0,0 +1,10 @@
1
+ import { createAuthClient } from "better-auth/react";
2
+
3
+ export const authClient = createAuthClient({
4
+ baseURL:
5
+ {{#if (includes frontend "next")}}
6
+ process.env.NEXT_PUBLIC_SERVER_URL,
7
+ {{else}}
8
+ import.meta.env.VITE_SERVER_URL,
9
+ {{/if}}
10
+ });
@@ -1,6 +1,11 @@
1
1
  "use client"
2
2
  import { authClient } from "@/lib/auth-client";
3
+ {{#if (eq api "orpc")}}
4
+ import { orpc } from "@/utils/orpc";
5
+ {{/if}}
6
+ {{#if (eq api "trpc")}}
3
7
  import { trpc } from "@/utils/trpc";
8
+ {{/if}}
4
9
  import { useQuery } from "@tanstack/react-query";
5
10
  import { useRouter } from "next/navigation";
6
11
  import { useEffect } from "react";
@@ -9,7 +14,12 @@ export default function Dashboard() {
9
14
  const router = useRouter()
10
15
  const { data: session, isPending } = authClient.useSession();
11
16
 
17
+ {{#if (eq api "orpc")}}
18
+ const privateData = useQuery(orpc.privateData.queryOptions());
19
+ {{/if}}
20
+ {{#if (eq api "trpc")}}
12
21
  const privateData = useQuery(trpc.privateData.queryOptions());
22
+ {{/if}}
13
23
 
14
24
  useEffect(() => {
15
25
  if (!session && !isPending) {
@@ -1,5 +1,10 @@
1
1
  import { authClient } from "@/lib/auth-client";
2
+ {{#if (eq api "orpc")}}
3
+ import { orpc } from "@/utils/orpc";
4
+ {{/if}}
5
+ {{#if (eq api "trpc")}}
2
6
  import { trpc } from "@/utils/trpc";
7
+ {{/if}}
3
8
  import { useQuery } from "@tanstack/react-query";
4
9
  import { useEffect } from "react";
5
10
  import { useNavigate } from "react-router";
@@ -8,7 +13,12 @@ export default function Dashboard() {
8
13
  const { data: session, isPending } = authClient.useSession();
9
14
  const navigate = useNavigate();
10
15
 
16
+ {{#if (eq api "orpc")}}
17
+ const privateData = useQuery(orpc.privateData.queryOptions());
18
+ {{/if}}
19
+ {{#if (eq api "trpc")}}
11
20
  const privateData = useQuery(trpc.privateData.queryOptions());
21
+ {{/if}}
12
22
 
13
23
  useEffect(() => {
14
24
  if (!session && !isPending) {
@@ -1,5 +1,10 @@
1
1
  import { authClient } from "@/lib/auth-client";
2
+ {{#if (eq api "orpc")}}
3
+ import { orpc } from "@/utils/orpc";
4
+ {{/if}}
5
+ {{#if (eq api "trpc")}}
2
6
  import { trpc } from "@/utils/trpc";
7
+ {{/if}}
3
8
  import { useQuery } from "@tanstack/react-query";
4
9
  import { createFileRoute } from "@tanstack/react-router";
5
10
  import { useEffect } from "react";
@@ -13,7 +18,12 @@ function RouteComponent() {
13
18
 
14
19
  const navigate = Route.useNavigate();
15
20
 
21
+ {{#if (eq api "orpc")}}
22
+ const privateData = useQuery(orpc.privateData.queryOptions());
23
+ {{/if}}
24
+ {{#if (eq api "trpc")}}
16
25
  const privateData = useQuery(trpc.privateData.queryOptions());
26
+ {{/if}}
17
27
 
18
28
  useEffect(() => {
19
29
  if (!session && !isPending) {