create-sidekick-app 0.0.1 → 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 (299) hide show
  1. package/LICENSE.md +202 -0
  2. package/NOTICE +27 -0
  3. package/README.md +29 -2
  4. package/dist/index.js +59 -0
  5. package/package.json +65 -4
  6. package/template/base/ai-chat/.env.example +6 -0
  7. package/template/base/ai-chat/.prettierignore +2 -0
  8. package/template/base/ai-chat/.prettierrc.json +5 -0
  9. package/template/base/ai-chat/README.md +38 -0
  10. package/template/base/ai-chat/_gitignore +41 -0
  11. package/template/base/ai-chat/components.json +23 -0
  12. package/template/base/ai-chat/next.config.ts +5 -0
  13. package/template/base/ai-chat/package.json +61 -0
  14. package/template/base/ai-chat/postcss.config.mjs +5 -0
  15. package/template/base/ai-chat/src/app/api/chat/route.ts +141 -0
  16. package/template/base/ai-chat/src/app/api/instant/route.ts +5 -0
  17. package/template/base/ai-chat/src/app/chat/[id]/page.tsx +20 -0
  18. package/template/base/ai-chat/src/app/globals.css +124 -0
  19. package/template/base/ai-chat/src/app/layout.tsx +34 -0
  20. package/template/base/ai-chat/src/app/page.tsx +6 -0
  21. package/template/base/ai-chat/src/components/AuthGate.tsx +15 -0
  22. package/template/base/ai-chat/src/components/Chat.tsx +228 -0
  23. package/template/base/ai-chat/src/components/InstantProvider.tsx +18 -0
  24. package/template/base/ai-chat/src/components/Login.tsx +163 -0
  25. package/template/base/ai-chat/src/components/Sidebar.tsx +100 -0
  26. package/template/base/ai-chat/src/components/ai-elements/agent.tsx +142 -0
  27. package/template/base/ai-chat/src/components/ai-elements/artifact.tsx +149 -0
  28. package/template/base/ai-chat/src/components/ai-elements/attachments.tsx +427 -0
  29. package/template/base/ai-chat/src/components/ai-elements/audio-player.tsx +229 -0
  30. package/template/base/ai-chat/src/components/ai-elements/canvas.tsx +26 -0
  31. package/template/base/ai-chat/src/components/ai-elements/chain-of-thought.tsx +223 -0
  32. package/template/base/ai-chat/src/components/ai-elements/checkpoint.tsx +72 -0
  33. package/template/base/ai-chat/src/components/ai-elements/code-block.tsx +556 -0
  34. package/template/base/ai-chat/src/components/ai-elements/commit.tsx +449 -0
  35. package/template/base/ai-chat/src/components/ai-elements/confirmation.tsx +173 -0
  36. package/template/base/ai-chat/src/components/ai-elements/connection.tsx +28 -0
  37. package/template/base/ai-chat/src/components/ai-elements/context.tsx +410 -0
  38. package/template/base/ai-chat/src/components/ai-elements/controls.tsx +19 -0
  39. package/template/base/ai-chat/src/components/ai-elements/conversation.tsx +167 -0
  40. package/template/base/ai-chat/src/components/ai-elements/edge.tsx +144 -0
  41. package/template/base/ai-chat/src/components/ai-elements/environment-variables.tsx +325 -0
  42. package/template/base/ai-chat/src/components/ai-elements/file-tree.tsx +298 -0
  43. package/template/base/ai-chat/src/components/ai-elements/image.tsx +25 -0
  44. package/template/base/ai-chat/src/components/ai-elements/inline-citation.tsx +294 -0
  45. package/template/base/ai-chat/src/components/ai-elements/jsx-preview.tsx +250 -0
  46. package/template/base/ai-chat/src/components/ai-elements/message.tsx +356 -0
  47. package/template/base/ai-chat/src/components/ai-elements/mic-selector.tsx +372 -0
  48. package/template/base/ai-chat/src/components/ai-elements/model-selector.tsx +214 -0
  49. package/template/base/ai-chat/src/components/ai-elements/node.tsx +72 -0
  50. package/template/base/ai-chat/src/components/ai-elements/open-in-chat.tsx +367 -0
  51. package/template/base/ai-chat/src/components/ai-elements/package-info.tsx +235 -0
  52. package/template/base/ai-chat/src/components/ai-elements/panel.tsx +16 -0
  53. package/template/base/ai-chat/src/components/ai-elements/persona.tsx +280 -0
  54. package/template/base/ai-chat/src/components/ai-elements/plan.tsx +144 -0
  55. package/template/base/ai-chat/src/components/ai-elements/prompt-input.tsx +1341 -0
  56. package/template/base/ai-chat/src/components/ai-elements/queue.tsx +275 -0
  57. package/template/base/ai-chat/src/components/ai-elements/reasoning.tsx +229 -0
  58. package/template/base/ai-chat/src/components/ai-elements/sandbox.tsx +128 -0
  59. package/template/base/ai-chat/src/components/ai-elements/schema-display.tsx +473 -0
  60. package/template/base/ai-chat/src/components/ai-elements/shimmer.tsx +78 -0
  61. package/template/base/ai-chat/src/components/ai-elements/snippet.tsx +141 -0
  62. package/template/base/ai-chat/src/components/ai-elements/sources.tsx +78 -0
  63. package/template/base/ai-chat/src/components/ai-elements/speech-input.tsx +324 -0
  64. package/template/base/ai-chat/src/components/ai-elements/stack-trace.tsx +531 -0
  65. package/template/base/ai-chat/src/components/ai-elements/suggestion.tsx +55 -0
  66. package/template/base/ai-chat/src/components/ai-elements/task.tsx +88 -0
  67. package/template/base/ai-chat/src/components/ai-elements/terminal.tsx +277 -0
  68. package/template/base/ai-chat/src/components/ai-elements/test-results.tsx +497 -0
  69. package/template/base/ai-chat/src/components/ai-elements/tool.tsx +174 -0
  70. package/template/base/ai-chat/src/components/ai-elements/toolbar.tsx +17 -0
  71. package/template/base/ai-chat/src/components/ai-elements/transcription.tsx +126 -0
  72. package/template/base/ai-chat/src/components/ai-elements/voice-selector.tsx +525 -0
  73. package/template/base/ai-chat/src/components/ai-elements/web-preview.tsx +282 -0
  74. package/template/base/ai-chat/src/components/ui/accordion.tsx +66 -0
  75. package/template/base/ai-chat/src/components/ui/alert.tsx +66 -0
  76. package/template/base/ai-chat/src/components/ui/avatar.tsx +109 -0
  77. package/template/base/ai-chat/src/components/ui/badge.tsx +48 -0
  78. package/template/base/ai-chat/src/components/ui/button-group.tsx +83 -0
  79. package/template/base/ai-chat/src/components/ui/button.tsx +64 -0
  80. package/template/base/ai-chat/src/components/ui/card.tsx +92 -0
  81. package/template/base/ai-chat/src/components/ui/carousel.tsx +241 -0
  82. package/template/base/ai-chat/src/components/ui/collapsible.tsx +33 -0
  83. package/template/base/ai-chat/src/components/ui/command.tsx +184 -0
  84. package/template/base/ai-chat/src/components/ui/dialog.tsx +158 -0
  85. package/template/base/ai-chat/src/components/ui/dropdown-menu.tsx +257 -0
  86. package/template/base/ai-chat/src/components/ui/hover-card.tsx +44 -0
  87. package/template/base/ai-chat/src/components/ui/input-group.tsx +170 -0
  88. package/template/base/ai-chat/src/components/ui/input.tsx +21 -0
  89. package/template/base/ai-chat/src/components/ui/popover.tsx +89 -0
  90. package/template/base/ai-chat/src/components/ui/progress.tsx +31 -0
  91. package/template/base/ai-chat/src/components/ui/scroll-area.tsx +58 -0
  92. package/template/base/ai-chat/src/components/ui/select.tsx +190 -0
  93. package/template/base/ai-chat/src/components/ui/separator.tsx +28 -0
  94. package/template/base/ai-chat/src/components/ui/spinner.tsx +16 -0
  95. package/template/base/ai-chat/src/components/ui/switch.tsx +35 -0
  96. package/template/base/ai-chat/src/components/ui/tabs.tsx +91 -0
  97. package/template/base/ai-chat/src/components/ui/textarea.tsx +18 -0
  98. package/template/base/ai-chat/src/components/ui/tooltip.tsx +57 -0
  99. package/template/base/ai-chat/src/instant.perms.ts +34 -0
  100. package/template/base/ai-chat/src/instant.schema.ts +107 -0
  101. package/template/base/ai-chat/src/lib/adminDb.ts +8 -0
  102. package/template/base/ai-chat/src/lib/db.ts +8 -0
  103. package/template/base/ai-chat/src/lib/mockModel.ts +119 -0
  104. package/template/base/ai-chat/src/lib/utils.ts +6 -0
  105. package/template/base/ai-chat/tsconfig.json +33 -0
  106. package/template/base/bun-react/.env.example +2 -0
  107. package/template/base/bun-react/README.md +12 -0
  108. package/template/base/bun-react/_gitignore +34 -0
  109. package/template/base/bun-react/bun-env.d.ts +17 -0
  110. package/template/base/bun-react/bunfig.toml +4 -0
  111. package/template/base/bun-react/package.json +22 -0
  112. package/template/base/bun-react/src/App.tsx +168 -0
  113. package/template/base/bun-react/src/frontend.tsx +20 -0
  114. package/template/base/bun-react/src/getUnusedPort.ts +32 -0
  115. package/template/base/bun-react/src/index.css +25 -0
  116. package/template/base/bun-react/src/index.html +13 -0
  117. package/template/base/bun-react/src/index.ts +21 -0
  118. package/template/base/bun-react/src/instant.perms.ts +24 -0
  119. package/template/base/bun-react/src/instant.schema.ts +46 -0
  120. package/template/base/bun-react/src/lib/db.ts +8 -0
  121. package/template/base/bun-react/src/logo.svg +1 -0
  122. package/template/base/bun-react/tsconfig.json +36 -0
  123. package/template/base/expo/.env.example +2 -0
  124. package/template/base/expo/README.md +18 -0
  125. package/template/base/expo/_gitignore +41 -0
  126. package/template/base/expo/app/+not-found.tsx +16 -0
  127. package/template/base/expo/app/_layout.tsx +37 -0
  128. package/template/base/expo/app/index.tsx +64 -0
  129. package/template/base/expo/app.json +42 -0
  130. package/template/base/expo/assets/fonts/SpaceMono-Regular.ttf +0 -0
  131. package/template/base/expo/assets/images/adaptive-icon.png +0 -0
  132. package/template/base/expo/assets/images/favicon.png +0 -0
  133. package/template/base/expo/assets/images/icon.png +0 -0
  134. package/template/base/expo/assets/images/partial-react-logo.png +0 -0
  135. package/template/base/expo/assets/images/react-logo.png +0 -0
  136. package/template/base/expo/assets/images/react-logo@2x.png +0 -0
  137. package/template/base/expo/assets/images/react-logo@3x.png +0 -0
  138. package/template/base/expo/assets/images/splash-icon.png +0 -0
  139. package/template/base/expo/babel.config.js +12 -0
  140. package/template/base/expo/constants/Colors.ts +26 -0
  141. package/template/base/expo/eslint.config.js +10 -0
  142. package/template/base/expo/global.css +3 -0
  143. package/template/base/expo/hooks/useColorScheme.ts +1 -0
  144. package/template/base/expo/hooks/useColorScheme.web.ts +21 -0
  145. package/template/base/expo/hooks/useThemeColor.ts +21 -0
  146. package/template/base/expo/instant.perms.ts +24 -0
  147. package/template/base/expo/instant.schema.ts +44 -0
  148. package/template/base/expo/lib/db.ts +7 -0
  149. package/template/base/expo/metro.config.js +6 -0
  150. package/template/base/expo/nativewind-env.d.ts +1 -0
  151. package/template/base/expo/package.json +57 -0
  152. package/template/base/expo/scripts/reset-project.js +112 -0
  153. package/template/base/expo/tailwind.config.js +9 -0
  154. package/template/base/expo/tsconfig.json +18 -0
  155. package/template/base/next-js-app-dir/.env.example +2 -0
  156. package/template/base/next-js-app-dir/README.md +18 -0
  157. package/template/base/next-js-app-dir/_gitignore +41 -0
  158. package/template/base/next-js-app-dir/next.config.ts +7 -0
  159. package/template/base/next-js-app-dir/package.json +27 -0
  160. package/template/base/next-js-app-dir/postcss.config.mjs +5 -0
  161. package/template/base/next-js-app-dir/public/file.svg +1 -0
  162. package/template/base/next-js-app-dir/public/globe.svg +1 -0
  163. package/template/base/next-js-app-dir/public/next.svg +1 -0
  164. package/template/base/next-js-app-dir/public/vercel.svg +1 -0
  165. package/template/base/next-js-app-dir/public/window.svg +1 -0
  166. package/template/base/next-js-app-dir/src/app/favicon.ico +0 -0
  167. package/template/base/next-js-app-dir/src/app/globals.css +26 -0
  168. package/template/base/next-js-app-dir/src/app/layout.tsx +34 -0
  169. package/template/base/next-js-app-dir/src/app/page.tsx +169 -0
  170. package/template/base/next-js-app-dir/src/instant.perms.ts +24 -0
  171. package/template/base/next-js-app-dir/src/instant.schema.ts +50 -0
  172. package/template/base/next-js-app-dir/src/lib/db.ts +8 -0
  173. package/template/base/next-js-app-dir/tsconfig.json +41 -0
  174. package/template/base/solidjs-vite/README.md +15 -0
  175. package/template/base/solidjs-vite/_gitignore +25 -0
  176. package/template/base/solidjs-vite/index.html +15 -0
  177. package/template/base/solidjs-vite/package.json +25 -0
  178. package/template/base/solidjs-vite/src/App.tsx +171 -0
  179. package/template/base/solidjs-vite/src/index.css +25 -0
  180. package/template/base/solidjs-vite/src/index.tsx +16 -0
  181. package/template/base/solidjs-vite/src/instant.perms.ts +24 -0
  182. package/template/base/solidjs-vite/src/instant.schema.ts +46 -0
  183. package/template/base/solidjs-vite/src/lib/db.ts +8 -0
  184. package/template/base/solidjs-vite/tsconfig.json +20 -0
  185. package/template/base/solidjs-vite/vite.config.ts +11 -0
  186. package/template/base/sveltekit/README.md +15 -0
  187. package/template/base/sveltekit/_gitignore +26 -0
  188. package/template/base/sveltekit/package.json +25 -0
  189. package/template/base/sveltekit/src/app.css +25 -0
  190. package/template/base/sveltekit/src/app.html +11 -0
  191. package/template/base/sveltekit/src/instant.perms.ts +24 -0
  192. package/template/base/sveltekit/src/instant.schema.ts +46 -0
  193. package/template/base/sveltekit/src/lib/db.ts +8 -0
  194. package/template/base/sveltekit/src/routes/+layout.svelte +6 -0
  195. package/template/base/sveltekit/src/routes/+page.svelte +236 -0
  196. package/template/base/sveltekit/src/routes/+page.ts +1 -0
  197. package/template/base/sveltekit/svelte.config.js +10 -0
  198. package/template/base/sveltekit/tsconfig.json +14 -0
  199. package/template/base/sveltekit/vite.config.ts +7 -0
  200. package/template/base/tanstack-start/.cta.json +12 -0
  201. package/template/base/tanstack-start/README.md +17 -0
  202. package/template/base/tanstack-start/_gitignore +13 -0
  203. package/template/base/tanstack-start/package.json +43 -0
  204. package/template/base/tanstack-start/public/favicon.ico +0 -0
  205. package/template/base/tanstack-start/public/logo192.png +0 -0
  206. package/template/base/tanstack-start/public/logo512.png +0 -0
  207. package/template/base/tanstack-start/public/manifest.json +25 -0
  208. package/template/base/tanstack-start/public/robots.txt +3 -0
  209. package/template/base/tanstack-start/public/tanstack-circle-logo.png +0 -0
  210. package/template/base/tanstack-start/public/tanstack-word-logo-white.svg +1 -0
  211. package/template/base/tanstack-start/src/components/Header.tsx +21 -0
  212. package/template/base/tanstack-start/src/instant.perms.ts +24 -0
  213. package/template/base/tanstack-start/src/instant.schema.ts +50 -0
  214. package/template/base/tanstack-start/src/lib/adminDb.ts +12 -0
  215. package/template/base/tanstack-start/src/lib/db.ts +9 -0
  216. package/template/base/tanstack-start/src/logo.svg +12 -0
  217. package/template/base/tanstack-start/src/routeTree.gen.ts +104 -0
  218. package/template/base/tanstack-start/src/router.tsx +22 -0
  219. package/template/base/tanstack-start/src/routes/__root.tsx +70 -0
  220. package/template/base/tanstack-start/src/routes/api/instant.ts +18 -0
  221. package/template/base/tanstack-start/src/routes/index.tsx +238 -0
  222. package/template/base/tanstack-start/src/routes/login.tsx +140 -0
  223. package/template/base/tanstack-start/src/styles.css +18 -0
  224. package/template/base/tanstack-start/tsconfig.json +28 -0
  225. package/template/base/tanstack-start/vite.config.ts +33 -0
  226. package/template/base/tanstack-start-with-tanstack-query/.cta.json +12 -0
  227. package/template/base/tanstack-start-with-tanstack-query/README.md +18 -0
  228. package/template/base/tanstack-start-with-tanstack-query/_gitignore +13 -0
  229. package/template/base/tanstack-start-with-tanstack-query/package.json +46 -0
  230. package/template/base/tanstack-start-with-tanstack-query/public/favicon.ico +0 -0
  231. package/template/base/tanstack-start-with-tanstack-query/public/logo192.png +0 -0
  232. package/template/base/tanstack-start-with-tanstack-query/public/logo512.png +0 -0
  233. package/template/base/tanstack-start-with-tanstack-query/public/manifest.json +25 -0
  234. package/template/base/tanstack-start-with-tanstack-query/public/robots.txt +3 -0
  235. package/template/base/tanstack-start-with-tanstack-query/public/tanstack-circle-logo.png +0 -0
  236. package/template/base/tanstack-start-with-tanstack-query/public/tanstack-word-logo-white.svg +1 -0
  237. package/template/base/tanstack-start-with-tanstack-query/src/components/Header.tsx +21 -0
  238. package/template/base/tanstack-start-with-tanstack-query/src/instant.perms.ts +24 -0
  239. package/template/base/tanstack-start-with-tanstack-query/src/instant.schema.ts +50 -0
  240. package/template/base/tanstack-start-with-tanstack-query/src/lib/adminDb.ts +9 -0
  241. package/template/base/tanstack-start-with-tanstack-query/src/lib/db.ts +11 -0
  242. package/template/base/tanstack-start-with-tanstack-query/src/lib/instantQuery.ts +93 -0
  243. package/template/base/tanstack-start-with-tanstack-query/src/logo.svg +12 -0
  244. package/template/base/tanstack-start-with-tanstack-query/src/routeTree.gen.ts +104 -0
  245. package/template/base/tanstack-start-with-tanstack-query/src/router.tsx +108 -0
  246. package/template/base/tanstack-start-with-tanstack-query/src/routes/__root.tsx +76 -0
  247. package/template/base/tanstack-start-with-tanstack-query/src/routes/api/instant.ts +16 -0
  248. package/template/base/tanstack-start-with-tanstack-query/src/routes/index.tsx +231 -0
  249. package/template/base/tanstack-start-with-tanstack-query/src/routes/login.tsx +140 -0
  250. package/template/base/tanstack-start-with-tanstack-query/src/styles.css +17 -0
  251. package/template/base/tanstack-start-with-tanstack-query/tsconfig.json +28 -0
  252. package/template/base/tanstack-start-with-tanstack-query/vite.config.ts +33 -0
  253. package/template/base/vite-react/README.md +16 -0
  254. package/template/base/vite-react/_gitignore +26 -0
  255. package/template/base/vite-react/eslint.config.js +23 -0
  256. package/template/base/vite-react/index.html +13 -0
  257. package/template/base/vite-react/package.json +35 -0
  258. package/template/base/vite-react/public/favicon.svg +1 -0
  259. package/template/base/vite-react/src/App.tsx +167 -0
  260. package/template/base/vite-react/src/index.css +1 -0
  261. package/template/base/vite-react/src/instant.perms.ts +24 -0
  262. package/template/base/vite-react/src/instant.schema.ts +51 -0
  263. package/template/base/vite-react/src/lib/db.ts +8 -0
  264. package/template/base/vite-react/src/main.tsx +10 -0
  265. package/template/base/vite-react/tsconfig.app.json +25 -0
  266. package/template/base/vite-react/tsconfig.json +7 -0
  267. package/template/base/vite-react/tsconfig.node.json +24 -0
  268. package/template/base/vite-react/vite.config.ts +8 -0
  269. package/template/base/vite-vanilla/.env.example +2 -0
  270. package/template/base/vite-vanilla/README.md +17 -0
  271. package/template/base/vite-vanilla/_gitignore +25 -0
  272. package/template/base/vite-vanilla/index.html +13 -0
  273. package/template/base/vite-vanilla/package.json +20 -0
  274. package/template/base/vite-vanilla/pnpm-lock.yaml +707 -0
  275. package/template/base/vite-vanilla/public/vite.svg +1 -0
  276. package/template/base/vite-vanilla/src/instant.perms.ts +24 -0
  277. package/template/base/vite-vanilla/src/instant.schema.ts +50 -0
  278. package/template/base/vite-vanilla/src/lib/db.ts +11 -0
  279. package/template/base/vite-vanilla/src/main.ts +242 -0
  280. package/template/base/vite-vanilla/src/style.css +96 -0
  281. package/template/base/vite-vanilla/src/typescript.svg +1 -0
  282. package/template/base/vite-vanilla/src/vite-env.d.ts +1 -0
  283. package/template/base/vite-vanilla/tsconfig.json +24 -0
  284. package/template/base/vue-vite/README.md +15 -0
  285. package/template/base/vue-vite/_gitignore +43 -0
  286. package/template/base/vue-vite/env.d.ts +1 -0
  287. package/template/base/vue-vite/index.html +12 -0
  288. package/template/base/vue-vite/package.json +34 -0
  289. package/template/base/vue-vite/src/App.vue +238 -0
  290. package/template/base/vue-vite/src/assets/main.css +25 -0
  291. package/template/base/vue-vite/src/instant.perms.ts +24 -0
  292. package/template/base/vue-vite/src/instant.schema.ts +46 -0
  293. package/template/base/vue-vite/src/lib/db.ts +8 -0
  294. package/template/base/vue-vite/src/main.ts +6 -0
  295. package/template/base/vue-vite/tsconfig.app.json +15 -0
  296. package/template/base/vue-vite/tsconfig.json +11 -0
  297. package/template/base/vue-vite/tsconfig.node.json +27 -0
  298. package/template/base/vue-vite/vite.config.ts +16 -0
  299. package/template/rules/AGENTS.md +436 -0
@@ -0,0 +1,104 @@
1
+ /* eslint-disable */
2
+
3
+ // @ts-nocheck
4
+
5
+ // noinspection JSUnusedGlobalSymbols
6
+
7
+ // This file was automatically generated by TanStack Router.
8
+ // You should NOT make any changes in this file as it will be overwritten.
9
+ // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
+
11
+ import { Route as rootRouteImport } from './routes/__root'
12
+ import { Route as LoginRouteImport } from './routes/login'
13
+ import { Route as IndexRouteImport } from './routes/index'
14
+ import { Route as ApiInstantRouteImport } from './routes/api/instant'
15
+
16
+ const LoginRoute = LoginRouteImport.update({
17
+ id: '/login',
18
+ path: '/login',
19
+ getParentRoute: () => rootRouteImport,
20
+ } as any)
21
+ const IndexRoute = IndexRouteImport.update({
22
+ id: '/',
23
+ path: '/',
24
+ getParentRoute: () => rootRouteImport,
25
+ } as any)
26
+ const ApiInstantRoute = ApiInstantRouteImport.update({
27
+ id: '/api/instant',
28
+ path: '/api/instant',
29
+ getParentRoute: () => rootRouteImport,
30
+ } as any)
31
+
32
+ export interface FileRoutesByFullPath {
33
+ '/': typeof IndexRoute
34
+ '/login': typeof LoginRoute
35
+ '/api/instant': typeof ApiInstantRoute
36
+ }
37
+ export interface FileRoutesByTo {
38
+ '/': typeof IndexRoute
39
+ '/login': typeof LoginRoute
40
+ '/api/instant': typeof ApiInstantRoute
41
+ }
42
+ export interface FileRoutesById {
43
+ __root__: typeof rootRouteImport
44
+ '/': typeof IndexRoute
45
+ '/login': typeof LoginRoute
46
+ '/api/instant': typeof ApiInstantRoute
47
+ }
48
+ export interface FileRouteTypes {
49
+ fileRoutesByFullPath: FileRoutesByFullPath
50
+ fullPaths: '/' | '/login' | '/api/instant'
51
+ fileRoutesByTo: FileRoutesByTo
52
+ to: '/' | '/login' | '/api/instant'
53
+ id: '__root__' | '/' | '/login' | '/api/instant'
54
+ fileRoutesById: FileRoutesById
55
+ }
56
+ export interface RootRouteChildren {
57
+ IndexRoute: typeof IndexRoute
58
+ LoginRoute: typeof LoginRoute
59
+ ApiInstantRoute: typeof ApiInstantRoute
60
+ }
61
+
62
+ declare module '@tanstack/react-router' {
63
+ interface FileRoutesByPath {
64
+ '/login': {
65
+ id: '/login'
66
+ path: '/login'
67
+ fullPath: '/login'
68
+ preLoaderRoute: typeof LoginRouteImport
69
+ parentRoute: typeof rootRouteImport
70
+ }
71
+ '/': {
72
+ id: '/'
73
+ path: '/'
74
+ fullPath: '/'
75
+ preLoaderRoute: typeof IndexRouteImport
76
+ parentRoute: typeof rootRouteImport
77
+ }
78
+ '/api/instant': {
79
+ id: '/api/instant'
80
+ path: '/api/instant'
81
+ fullPath: '/api/instant'
82
+ preLoaderRoute: typeof ApiInstantRouteImport
83
+ parentRoute: typeof rootRouteImport
84
+ }
85
+ }
86
+ }
87
+
88
+ const rootRouteChildren: RootRouteChildren = {
89
+ IndexRoute: IndexRoute,
90
+ LoginRoute: LoginRoute,
91
+ ApiInstantRoute: ApiInstantRoute,
92
+ }
93
+ export const routeTree = rootRouteImport
94
+ ._addFileChildren(rootRouteChildren)
95
+ ._addFileTypes<FileRouteTypes>()
96
+
97
+ import type { getRouter } from './router.tsx'
98
+ import type { createStart } from '@tanstack/react-start'
99
+ declare module '@tanstack/react-start' {
100
+ interface Register {
101
+ ssr: true
102
+ router: Awaited<ReturnType<typeof getRouter>>
103
+ }
104
+ }
@@ -0,0 +1,22 @@
1
+ import {
2
+ createRouter,
3
+ DefaultGlobalNotFound,
4
+ ErrorComponent,
5
+ } from "@tanstack/react-router";
6
+
7
+ // Import the generated route tree
8
+ import { routeTree } from "./routeTree.gen";
9
+
10
+ // Create a new router instance
11
+ export const getRouter = () => {
12
+ const router = createRouter({
13
+ routeTree,
14
+ context: {},
15
+ defaultNotFoundComponent: DefaultGlobalNotFound,
16
+ defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,
17
+ scrollRestoration: true,
18
+ defaultPreloadStaleTime: 0,
19
+ });
20
+
21
+ return router;
22
+ };
@@ -0,0 +1,70 @@
1
+ import {
2
+ ErrorComponent,
3
+ HeadContent,
4
+ Scripts,
5
+ createRootRoute,
6
+ } from "@tanstack/react-router";
7
+ import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";
8
+ import { TanStackDevtools } from "@tanstack/react-devtools";
9
+
10
+ import Header from "../components/Header";
11
+
12
+ import appCss from "../styles.css?url";
13
+
14
+ export const Route = createRootRoute({
15
+ beforeLoad: () => {
16
+ if (!import.meta.env.VITE_INSTANT_APP_ID) {
17
+ throw new Error(
18
+ "VITE_INSTANT_APP_ID is not defined. Make sure to include it in your environment variables. In dev, `npx @sidekickdb/cli init` can do this for you.",
19
+ );
20
+ }
21
+ },
22
+ head: () => ({
23
+ meta: [
24
+ {
25
+ charSet: "utf-8",
26
+ },
27
+ {
28
+ name: "viewport",
29
+ content: "width=device-width, initial-scale=1",
30
+ },
31
+ {
32
+ title: "SidekickDB TanStack Start Starter",
33
+ },
34
+ ],
35
+ links: [
36
+ {
37
+ rel: "stylesheet",
38
+ href: appCss,
39
+ },
40
+ ],
41
+ }),
42
+ errorComponent: (err) => <ErrorComponent error={err.error} />,
43
+ shellComponent: RootDocument,
44
+ });
45
+
46
+ function RootDocument({ children }: { children: React.ReactNode }) {
47
+ return (
48
+ <html lang="en">
49
+ <head>
50
+ <HeadContent />
51
+ </head>
52
+ <body>
53
+ <Header />
54
+ {children}
55
+ <TanStackDevtools
56
+ config={{
57
+ position: "bottom-right",
58
+ }}
59
+ plugins={[
60
+ {
61
+ name: "Tanstack Router",
62
+ render: <TanStackRouterDevtoolsPanel />,
63
+ },
64
+ ]}
65
+ />
66
+ <Scripts />
67
+ </body>
68
+ </html>
69
+ );
70
+ }
@@ -0,0 +1,18 @@
1
+ import { createFileRoute } from "@tanstack/react-router";
2
+ import { createInstantRouteHandler } from "@sidekickdb/react";
3
+
4
+ const appId = process.env.VITE_INSTANT_APP_ID!;
5
+
6
+ const handler = createInstantRouteHandler({
7
+ appId,
8
+ });
9
+
10
+ export const Route = createFileRoute("/api/instant")({
11
+ server: {
12
+ handlers: {
13
+ POST: async ({ request }) => {
14
+ return handler.POST(request);
15
+ },
16
+ },
17
+ },
18
+ });
@@ -0,0 +1,238 @@
1
+ import { AppSchema } from "@/instant.schema";
2
+ import { clientDb } from "@/lib/db";
3
+ import { id, InstaQLEntity } from "@sidekickdb/react";
4
+ import { getRequest } from "@tanstack/react-start/server";
5
+
6
+ import { createFileRoute, redirect } from "@tanstack/react-router";
7
+ import {
8
+ createMiddleware,
9
+ createServerFn,
10
+ useServerFn,
11
+ } from "@tanstack/react-start";
12
+ import { adminDb } from "@/lib/adminDb";
13
+ import { useEffect, useState } from "react";
14
+
15
+ const instantUserMiddleware = createMiddleware().server(async ({ next }) => {
16
+ const request = getRequest();
17
+
18
+ // /api/instant keeps your user's cookie in sync
19
+ // this reads the cookie from the request to see who made it
20
+ const user = await adminDb.auth.getUserFromRequest(request);
21
+ return next({
22
+ context: { user },
23
+ });
24
+ });
25
+
26
+ // Here, we're going to make a little fake "getSecretData" function,
27
+ // but you could make special queries, or changes, or anything you want
28
+ const getSecretData = createServerFn()
29
+ .middleware([instantUserMiddleware])
30
+ .handler(async ({ context }) => {
31
+ if (!context.user) {
32
+ throw new Error("Unauthorized");
33
+ }
34
+
35
+ return {
36
+ secretMessage: `This is a secret message returned from createServerFn.
37
+ Only signed-in users can see this.
38
+ This is useful when you need to run server-side only code such as interacting with a 3rd party API.
39
+ You are signed in as ${context.user.isGuest ? "guest" : context.user.email}.`,
40
+ };
41
+ });
42
+
43
+ export const Route = createFileRoute("/")({
44
+ component: App,
45
+ loader: async () => {
46
+ const auth = await clientDb.getAuth();
47
+ if (!auth) {
48
+ throw redirect({
49
+ to: "/login",
50
+ });
51
+ }
52
+ },
53
+ ssr: false,
54
+ });
55
+
56
+ type Todo = InstaQLEntity<AppSchema, "todos">;
57
+
58
+ function App() {
59
+ // Read Data
60
+ const { isLoading, error, data } = clientDb.useQuery({ todos: {} });
61
+
62
+ if (isLoading) {
63
+ return null;
64
+ }
65
+ if (error) {
66
+ return <div className="text-red-500 p-4">Error: {error.message}</div>;
67
+ }
68
+
69
+ const { todos } = data;
70
+ return (
71
+ <div className="p-8 sm:grid-cols-2 items-start gap-2 grid-cols-1 grid">
72
+ <div className="flex flex-col gap-2">
73
+ <Welcome />
74
+ <SecretData />
75
+ </div>
76
+ <div className="bg-white rounded-lg p-6 border border-neutral-200 shadow flex flex-col">
77
+ <h2 className="tracking-wide text-[#F54A00] pb-2 text-2xl">Todos</h2>
78
+ <div className="text-xs pb-4">
79
+ Open another tab to see todos update in realtime!
80
+ </div>
81
+ <div className="border rounded border-neutral-300">
82
+ <TodoForm />
83
+ <TodoList todos={todos} />
84
+ <ActionBar todos={todos} />
85
+ </div>
86
+ </div>
87
+ </div>
88
+ );
89
+ }
90
+
91
+ // Write Data
92
+ // ---------
93
+ function addTodo(text: string) {
94
+ clientDb.transact(
95
+ clientDb.tx.todos[id()].update({
96
+ text,
97
+ done: false,
98
+ createdAt: Date.now(),
99
+ }),
100
+ );
101
+ }
102
+
103
+ function deleteTodo(todo: Todo) {
104
+ clientDb.transact(clientDb.tx.todos[todo.id].delete());
105
+ }
106
+
107
+ function toggleDone(todo: Todo) {
108
+ clientDb.transact(clientDb.tx.todos[todo.id].update({ done: !todo.done }));
109
+ }
110
+
111
+ function deleteCompleted(todos: Todo[]) {
112
+ const completed = todos.filter((todo) => todo.done);
113
+ if (completed.length === 0) return;
114
+ const txs = completed.map((todo) => clientDb.tx.todos[todo.id].delete());
115
+ clientDb.transact(txs);
116
+ }
117
+
118
+ function TodoForm() {
119
+ return (
120
+ <div className="flex items-center h-10 border-neutral-300">
121
+ <form
122
+ className="flex-1 h-full"
123
+ onSubmit={(e) => {
124
+ e.preventDefault();
125
+ const input = e.currentTarget.input as HTMLInputElement;
126
+ addTodo(input.value);
127
+ input.value = "";
128
+ }}
129
+ >
130
+ <input
131
+ className="w-full h-full px-2 outline-none bg-transparent"
132
+ autoFocus
133
+ placeholder="What needs to be done?"
134
+ type="text"
135
+ name="input"
136
+ />
137
+ </form>
138
+ </div>
139
+ );
140
+ }
141
+
142
+ function TodoList({ todos }: { todos: Todo[] }) {
143
+ return (
144
+ <div className="divide-y divide-neutral-300">
145
+ {todos.map((todo) => (
146
+ <div key={todo.id} className="flex items-center h-10">
147
+ <div className="h-full px-2 flex items-center justify-center">
148
+ <div className="w-5 h-5 flex items-center justify-center">
149
+ <input
150
+ type="checkbox"
151
+ className="cursor-pointer"
152
+ checked={todo.done}
153
+ onChange={() => toggleDone(todo)}
154
+ />
155
+ </div>
156
+ </div>
157
+ <div className="flex-1 px-2 overflow-hidden flex items-center">
158
+ {todo.done ? (
159
+ <span className="line-through">{todo.text}</span>
160
+ ) : (
161
+ <span>{todo.text}</span>
162
+ )}
163
+ </div>
164
+ <button
165
+ className="h-full px-2 flex items-center justify-center text-neutral-300 hover:text-neutral-500"
166
+ onClick={() => deleteTodo(todo)}
167
+ >
168
+ X
169
+ </button>
170
+ </div>
171
+ ))}
172
+ </div>
173
+ );
174
+ }
175
+
176
+ function ActionBar({ todos }: { todos: Todo[] }) {
177
+ return (
178
+ <div className="flex justify-between items-center h-10 px-2 text-xs border-t border-neutral-300">
179
+ <div>Remaining todos: {todos.filter((todo) => !todo.done).length}</div>
180
+ <button
181
+ className=" text-neutral-300 hover:text-neutral-500"
182
+ onClick={() => deleteCompleted(todos)}
183
+ >
184
+ Delete Completed
185
+ </button>
186
+ </div>
187
+ );
188
+ }
189
+
190
+ export function Welcome() {
191
+ return (
192
+ <div className="bg-white p-6 rounded-lg border border-neutral-200 shadow flex justify-center flex-col gap-2">
193
+ <h2 className="tracking-wide text-[#F54A00] pb-4 text-2xl text-center">
194
+ Tanstack Start + SidekickDB
195
+ </h2>
196
+ <div className="grid grid-cols-1 md:grid-cols-2 grow gap-2">
197
+ <a
198
+ href="https://tanstack.com/start/latest/docs/framework/react/overview"
199
+ target="_blank"
200
+ rel="noopener noreferrer"
201
+ className="border p-2 hover:bg-neutral-100 py-8 shadow flex flex-col gap-2 items-center justify-center font-semibold border-neutral-200 rounded"
202
+ >
203
+ <img
204
+ src="https://tanstack.com/images/logos/logo-color-600.png"
205
+ width={34}
206
+ ></img>
207
+ Tanstack Start Docs
208
+ </a>
209
+ <a
210
+ target="_blank"
211
+ href="https://sidekickdb.co/docs"
212
+ rel="noopener noreferrer"
213
+ className="border p-2 shadow flex py-8 flex-col gap-2 hover:bg-neutral-100 items-center justify-center font-semibold border-neutral-200 rounded"
214
+ >
215
+ SidekickDB Docs
216
+ </a>
217
+ </div>
218
+ </div>
219
+ );
220
+ }
221
+
222
+ const SecretData = () => {
223
+ const secretDataFetch = useServerFn(getSecretData);
224
+ const [secretData, setSecretData] = useState<Awaited<
225
+ ReturnType<typeof secretDataFetch>
226
+ > | null>(null);
227
+
228
+ useEffect(() => {
229
+ secretDataFetch().then(setSecretData);
230
+ }, [secretDataFetch]);
231
+
232
+ return (
233
+ <div className="bg-white p-6 rounded-lg border border-neutral-200 shadow flex justify-center flex-col gap-2">
234
+ <div>Secret Message:</div>
235
+ <div>{secretData?.secretMessage}</div>
236
+ </div>
237
+ );
238
+ };
@@ -0,0 +1,140 @@
1
+ import { clientDb } from "@/lib/db";
2
+ import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
3
+ import { useState } from "react";
4
+ import { Welcome } from ".";
5
+
6
+ export const Route = createFileRoute("/login")({
7
+ component: RouteComponent,
8
+ ssr: false,
9
+ loader: async () => {
10
+ const auth = await clientDb.getAuth();
11
+ if (auth) {
12
+ throw redirect({
13
+ to: "/",
14
+ });
15
+ }
16
+ },
17
+ });
18
+
19
+ function RouteComponent() {
20
+ const [stage, setStage] = useState<"email" | "code">("email");
21
+ const [emailInput, setEmailInput] = useState("");
22
+ const [codeInput, setCodeInput] = useState("");
23
+ const navigate = useNavigate();
24
+
25
+ const sendEmail = async () => {
26
+ await clientDb.auth.sendMagicCode({ email: emailInput });
27
+ setStage("code");
28
+ };
29
+
30
+ const loginWithCode = async () => {
31
+ const verifyResponse = await clientDb.auth.signInWithMagicCode({
32
+ email: emailInput,
33
+ code: codeInput,
34
+ });
35
+ if (verifyResponse.user) {
36
+ navigate({ to: "/" });
37
+ }
38
+ };
39
+
40
+ const loginAsGuest = async () => {
41
+ const verifyResponse = await clientDb.auth.signInAsGuest();
42
+ if (verifyResponse.user) {
43
+ navigate({ to: "/" });
44
+ }
45
+ };
46
+
47
+ const goBack = () => {
48
+ setStage("email");
49
+ setCodeInput("");
50
+ };
51
+
52
+ return (
53
+ <div className="p-8 sm:grid-cols-2 items-start gap-2 grid-cols-1 grid">
54
+ <Welcome />
55
+ <div className="bg-white rounded-lg p-6 border border-neutral-200 shadow flex flex-col gap-4">
56
+ <h2 className="tracking-wide text-[#F54A00] text-2xl">
57
+ {stage === "email" ? "Sign In" : "Enter Code"}
58
+ </h2>
59
+ <p className="text-xs text-neutral-600">
60
+ {stage === "email"
61
+ ? "Enter your email to receive a magic code"
62
+ : `We sent a code to ${emailInput}`}
63
+ </p>
64
+ <div className="rounded">
65
+ {stage === "email" ? (
66
+ <>
67
+ <form
68
+ className="flex items-center border border-neutral-300 h-10"
69
+ onSubmit={(e) => {
70
+ e.preventDefault();
71
+ sendEmail();
72
+ }}
73
+ >
74
+ <input
75
+ type="email"
76
+ value={emailInput}
77
+ onChange={(e) => setEmailInput(e.target.value)}
78
+ placeholder="you@example.com"
79
+ required
80
+ autoFocus
81
+ className="flex-1 h-full px-2 outline-none bg-transparent"
82
+ />
83
+ <button
84
+ type="submit"
85
+ disabled={!emailInput}
86
+ className="h-full cursor-pointer px-2 border-l border-0 border-neutral-300 text-neutral-600 hover:text-neutral-500 disabled:hover:text-neutral-300"
87
+ >
88
+ Send
89
+ </button>
90
+ </form>
91
+ <div className="h-7" />
92
+ </>
93
+ ) : (
94
+ <>
95
+ <form
96
+ className="flex items-center h-10 border border-neutral-300"
97
+ onSubmit={(e) => {
98
+ e.preventDefault();
99
+ loginWithCode();
100
+ }}
101
+ >
102
+ <input
103
+ type="text"
104
+ value={codeInput}
105
+ onChange={(e) => setCodeInput(e.target.value)}
106
+ placeholder="Enter your code"
107
+ required
108
+ autoFocus
109
+ className="flex-1 h-full px-2 outline-none bg-transparent"
110
+ />
111
+ <button
112
+ type="submit"
113
+ disabled={!codeInput}
114
+ className="h-full px-2 cursor-pointer border-l border-neutral-300 text-neutral-600 hover:text-neutral-500 disabled:hover:text-neutral-300"
115
+ >
116
+ Submit
117
+ </button>
118
+ </form>
119
+ <div className="flex justify-center items-center h-10 px-2 text-xs">
120
+ <button
121
+ type="button"
122
+ onClick={goBack}
123
+ className="text-neutral-600 hover:text-neutral-500"
124
+ >
125
+ Use a different email
126
+ </button>
127
+ </div>
128
+ </>
129
+ )}
130
+ <button
131
+ onClick={loginAsGuest}
132
+ className="bg-neutral-50 border border-neutral-100 hover:bg-neutral-100 cursor-pointer shadow p-2"
133
+ >
134
+ Sign In as Guest
135
+ </button>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ );
140
+ }
@@ -0,0 +1,18 @@
1
+ @import "tailwindcss";
2
+
3
+ body {
4
+ @apply m-0;
5
+ font-family:
6
+ -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
7
+ "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
8
+ sans-serif;
9
+ -webkit-font-smoothing: antialiased;
10
+ -moz-osx-font-smoothing: grayscale;
11
+ min-height: 100dvh;
12
+ background: linear-gradient(120deg, #e7e7e7 40%, #fee7de 70%, #e4e4e4 100%);
13
+ }
14
+
15
+ code {
16
+ font-family:
17
+ source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
18
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "include": ["**/*.ts", "**/*.tsx"],
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "jsx": "react-jsx",
6
+ "module": "ESNext",
7
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
8
+ "types": ["vite/client"],
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": false,
14
+ "noEmit": true,
15
+
16
+ /* Linting */
17
+ "skipLibCheck": true,
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+ "noUncheckedSideEffectImports": true,
23
+ "baseUrl": ".",
24
+ "paths": {
25
+ "@/*": ["./src/*"]
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,33 @@
1
+ import { defineConfig } from "vite";
2
+ import { devtools } from "@tanstack/devtools-vite";
3
+ import { tanstackStart } from "@tanstack/react-start/plugin/vite";
4
+ import viteReact from "@vitejs/plugin-react";
5
+ import viteTsConfigPaths from "vite-tsconfig-paths";
6
+ import { fileURLToPath, URL } from "url";
7
+
8
+ import tailwindcss from "@tailwindcss/vite";
9
+ import { nitro } from "nitro/vite";
10
+
11
+ const config = defineConfig({
12
+ resolve: {
13
+ alias: {
14
+ "@": fileURLToPath(new URL("./src", import.meta.url)),
15
+ },
16
+ },
17
+ server: {
18
+ host: "::",
19
+ },
20
+ plugins: [
21
+ devtools(),
22
+ nitro(),
23
+ // this is the plugin that enables path aliases
24
+ viteTsConfigPaths({
25
+ projects: ["./tsconfig.json"],
26
+ }),
27
+ tailwindcss(),
28
+ tanstackStart(),
29
+ viteReact(),
30
+ ],
31
+ });
32
+
33
+ export default config;
@@ -0,0 +1,12 @@
1
+ {
2
+ "projectName": "tanstack-start-with-tanstack-query",
3
+ "mode": "file-router",
4
+ "typescript": true,
5
+ "packageManager": "pnpm",
6
+ "tailwind": true,
7
+ "addOnOptions": {},
8
+ "git": true,
9
+ "version": 1,
10
+ "framework": "react-cra",
11
+ "chosenAddOns": ["nitro", "start"]
12
+ }