create-better-t-stack 1.13.2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +95 -197
- package/package.json +72 -69
- package/templates/api/orpc/server/base/src/lib/context.ts.hbs +104 -0
- package/templates/api/orpc/server/base/src/lib/orpc.ts.hbs +17 -0
- package/templates/api/orpc/server/next/src/app/rpc/[...all]/route.ts.hbs +23 -0
- package/templates/api/orpc/web/base/src/utils/orpc.ts.hbs +57 -0
- package/templates/api/trpc/server/base/src/lib/context.ts.hbs +108 -0
- package/{template/with-auth/apps/server/src/lib/trpc.ts → templates/api/trpc/server/base/src/lib/trpc.ts.hbs} +2 -0
- package/templates/api/trpc/web/base/src/utils/trpc.ts.hbs +100 -0
- package/templates/auth/server/base/src/lib/auth.ts.hbs +30 -0
- package/templates/auth/web/base/src/lib/auth-client.ts.hbs +10 -0
- package/{template/with-auth/apps/web-next/src/app/dashboard/page.tsx → templates/auth/web/next/src/app/dashboard/page.tsx.hbs} +10 -0
- package/{template/with-auth/apps/web-react-router/src/routes/dashboard.tsx → templates/auth/web/react-router/src/routes/dashboard.tsx.hbs} +10 -0
- package/{template/with-auth/apps/web-tanstack-router/src/routes/dashboard.tsx → templates/auth/web/tanstack-router/src/routes/dashboard.tsx.hbs} +10 -0
- package/{template/with-auth/apps/web-tanstack-start/src/routes/dashboard.tsx → templates/auth/web/tanstack-start/src/routes/dashboard.tsx.hbs} +15 -0
- package/{template/with-auth/apps/server/src/with-elysia-index.ts → templates/backend/elysia/src/index.ts.hbs} +38 -3
- package/templates/backend/express/src/index.ts.hbs +86 -0
- package/templates/backend/hono/src/index.ts.hbs +105 -0
- package/{template/with-next/apps/server → templates/backend/next}/package.json +0 -2
- package/{template/base/apps/server → templates/backend/server-base}/package.json +0 -1
- package/templates/backend/server-base/src/routers/index.ts.hbs +51 -0
- package/templates/base/package.json +10 -0
- package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +79 -0
- package/{template/with-drizzle-sqlite/apps/server → templates/examples/todo/server/drizzle/sqlite}/src/db/schema/todo.ts +2 -2
- 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
- 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
- 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
- package/{template/base/apps/web-next → templates/frontend/next}/package.json +0 -2
- package/{template/base/apps/web-next/src/app/page.tsx → templates/frontend/next/src/app/page.tsx.hbs} +10 -0
- package/{template/base/apps/web-next/src/components/providers.tsx → templates/frontend/next/src/components/providers.tsx.hbs} +12 -0
- package/{template/base/apps/web-react-router → templates/frontend/react-router}/package.json +0 -3
- package/{template/base/apps/web-react-router/src/root.tsx → templates/frontend/react-router/src/root.tsx.hbs} +28 -1
- package/{template/base/apps/web-react-router/src/routes/_index.tsx → templates/frontend/react-router/src/routes/_index.tsx.hbs} +11 -0
- package/templates/frontend/react-router/vite.config.ts.hbs +37 -0
- package/{template/base/apps/web-tanstack-router → templates/frontend/tanstack-router}/package.json +0 -4
- package/{template/base/apps/web-tanstack-router/src/main.tsx → templates/frontend/tanstack-router/src/main.tsx.hbs} +20 -0
- package/{template/base/apps/web-tanstack-router/src/routes/__root.tsx → templates/frontend/tanstack-router/src/routes/__root.tsx.hbs} +48 -0
- package/{template/base/apps/web-tanstack-router/src/routes/index.tsx → templates/frontend/tanstack-router/src/routes/index.tsx.hbs} +10 -0
- package/templates/frontend/tanstack-router/vite.config.ts.hbs +43 -0
- package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/package.json +0 -3
- package/{template/with-auth/apps/web-tanstack-start/src/router.tsx → templates/frontend/tanstack-start/src/router.tsx.hbs} +29 -3
- package/{template/base/apps/web-tanstack-start/src/routes/__root.tsx → templates/frontend/tanstack-start/src/routes/__root.tsx.hbs} +13 -0
- package/{template/base/apps/web-tanstack-start/src/routes/index.tsx → templates/frontend/tanstack-start/src/routes/index.tsx.hbs} +11 -0
- package/templates/frontend/web-base/src/components/header.tsx.hbs +80 -0
- package/template/base/apps/server/src/lib/trpc.ts +0 -8
- package/template/base/apps/server/src/routers/index.ts +0 -11
- package/template/base/apps/web-base/src/utils/trpc.ts +0 -33
- package/template/base/apps/web-next/src/components/header.tsx +0 -30
- package/template/base/apps/web-next/src/utils/trpc.ts +0 -33
- package/template/base/apps/web-react-router/src/components/header.tsx +0 -31
- package/template/base/apps/web-react-router/vite.config.ts +0 -8
- package/template/base/apps/web-tanstack-router/src/components/header.tsx +0 -31
- package/template/base/apps/web-tanstack-router/vite.config.ts +0 -14
- package/template/base/apps/web-tanstack-start/src/components/header.tsx +0 -27
- package/template/base/apps/web-tanstack-start/src/router.tsx +0 -70
- package/template/base/apps/web-tanstack-start/src/utils/trpc.ts +0 -5
- package/template/base/package.json +0 -18
- package/template/examples/todo/apps/server/src/routers/with-drizzle-todo.ts +0 -34
- package/template/with-auth/apps/server/src/lib/with-elysia-context.ts +0 -18
- package/template/with-auth/apps/server/src/lib/with-express-context.ts +0 -14
- package/template/with-auth/apps/server/src/lib/with-hono-context.ts +0 -18
- package/template/with-auth/apps/server/src/lib/with-next-context.ts +0 -14
- package/template/with-auth/apps/server/src/routers/index.ts +0 -17
- package/template/with-auth/apps/server/src/with-drizzle-mysql-lib/auth.ts +0 -15
- package/template/with-auth/apps/server/src/with-drizzle-postgres-lib/auth.ts +0 -15
- package/template/with-auth/apps/server/src/with-drizzle-sqlite-lib/auth.ts +0 -15
- package/template/with-auth/apps/server/src/with-express-index.ts +0 -34
- package/template/with-auth/apps/server/src/with-hono-index.ts +0 -39
- package/template/with-auth/apps/server/src/with-prisma-mongodb-lib/auth.ts +0 -11
- package/template/with-auth/apps/server/src/with-prisma-mysql-lib/auth.ts +0 -11
- package/template/with-auth/apps/server/src/with-prisma-postgres-lib/auth.ts +0 -11
- package/template/with-auth/apps/server/src/with-prisma-sqlite-lib/auth.ts +0 -11
- package/template/with-auth/apps/web-base/src/lib/auth-client.ts +0 -5
- package/template/with-auth/apps/web-next/src/components/header.tsx +0 -33
- package/template/with-auth/apps/web-next/src/lib/auth-client.ts +0 -5
- package/template/with-auth/apps/web-next/src/utils/trpc.ts +0 -39
- package/template/with-auth/apps/web-react-router/src/components/header.tsx +0 -34
- package/template/with-auth/apps/web-react-router/src/utils/trpc.ts +0 -39
- package/template/with-auth/apps/web-tanstack-router/src/components/header.tsx +0 -34
- package/template/with-auth/apps/web-tanstack-router/src/utils/trpc.ts +0 -39
- package/template/with-auth/apps/web-tanstack-start/src/components/header.tsx +0 -32
- package/template/with-elysia/apps/server/src/index.ts +0 -27
- package/template/with-elysia/apps/server/src/lib/context.ts +0 -13
- package/template/with-express/apps/server/src/index.ts +0 -29
- package/template/with-express/apps/server/src/lib/context.ts +0 -9
- package/template/with-hono/apps/server/src/index.ts +0 -33
- package/template/with-hono/apps/server/src/lib/context.ts +0 -13
- package/template/with-next/apps/server/src/lib/context.ts +0 -9
- /package/{template/with-biome → templates/addons/biome}/biome.json +0 -0
- /package/{template/with-husky → templates/addons/husky}/.husky/pre-commit +0 -0
- /package/{template/with-pwa → templates/addons/pwa}/apps/web/public/logo.png +0 -0
- /package/{template/with-pwa → templates/addons/pwa}/apps/web/pwa-assets.config.ts +0 -0
- /package/{template/base → templates/addons/turborepo}/turbo.json +0 -0
- /package/{template/with-next/apps/server → templates/api/trpc/server/next}/src/app/trpc/[trpc]/route.ts +0 -0
- /package/{template/with-auth/apps → templates/auth}/native/app/(drawer)/index.tsx +0 -0
- /package/{template/with-auth/apps → templates/auth}/native/components/sign-in.tsx +0 -0
- /package/{template/with-auth/apps → templates/auth}/native/components/sign-up.tsx +0 -0
- /package/{template/with-auth/apps → templates/auth}/native/lib/auth-client.ts +0 -0
- /package/{template/with-auth/apps → templates/auth}/native/utils/trpc.ts +0 -0
- /package/{template/with-drizzle-mysql/apps/server → templates/auth/server/db/drizzle/mysql}/src/db/schema/auth.ts +0 -0
- /package/{template/with-drizzle-postgres/apps/server → templates/auth/server/db/drizzle/postgres}/src/db/schema/auth.ts +0 -0
- /package/{template/with-drizzle-sqlite/apps/server → templates/auth/server/db/drizzle/sqlite}/src/db/schema/auth.ts +0 -0
- /package/{template/with-prisma-sqlite/apps/server → templates/auth/server/db/prisma/mongodb}/prisma/schema/auth.prisma +0 -0
- /package/{template/with-prisma-mysql/apps/server → templates/auth/server/db/prisma/mysql}/prisma/schema/auth.prisma +0 -0
- /package/{template/with-prisma-postgres/apps/server → templates/auth/server/db/prisma/postgres}/prisma/schema/auth.prisma +0 -0
- /package/{template/with-prisma-mongodb/apps/server → templates/auth/server/db/prisma/sqlite}/prisma/schema/auth.prisma +0 -0
- /package/{template/with-auth/apps/server/src/with-next-app → templates/auth/server/next/src/app}/api/auth/[...all]/route.ts +0 -0
- /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/app/login/page.tsx +0 -0
- /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/components/sign-in-form.tsx +0 -0
- /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/components/sign-up-form.tsx +0 -0
- /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/components/theme-provider.tsx +0 -0
- /package/{template/with-auth/apps/web-next → templates/auth/web/next}/src/components/user-menu.tsx +0 -0
- /package/{template/with-auth/apps/web-react-router → templates/auth/web/react-router}/src/components/sign-in-form.tsx +0 -0
- /package/{template/with-auth/apps/web-react-router → templates/auth/web/react-router}/src/components/sign-up-form.tsx +0 -0
- /package/{template/with-auth/apps/web-react-router → templates/auth/web/react-router}/src/components/user-menu.tsx +0 -0
- /package/{template/with-auth/apps/web-react-router → templates/auth/web/react-router}/src/routes/login.tsx +0 -0
- /package/{template/with-auth/apps/web-tanstack-start → templates/auth/web/tanstack-router}/src/components/sign-in-form.tsx +0 -0
- /package/{template/with-auth/apps/web-tanstack-start → templates/auth/web/tanstack-router}/src/components/sign-up-form.tsx +0 -0
- /package/{template/with-auth/apps/web-tanstack-start → templates/auth/web/tanstack-router}/src/components/user-menu.tsx +0 -0
- /package/{template/with-auth/apps/web-tanstack-start → templates/auth/web/tanstack-router}/src/routes/login.tsx +0 -0
- /package/{template/with-auth/apps/web-tanstack-router → templates/auth/web/tanstack-start}/src/components/sign-in-form.tsx +0 -0
- /package/{template/with-auth/apps/web-tanstack-router → templates/auth/web/tanstack-start}/src/components/sign-up-form.tsx +0 -0
- /package/{template/with-auth/apps/web-tanstack-router → templates/auth/web/tanstack-start}/src/components/user-menu.tsx +0 -0
- /package/{template/with-auth/apps/web-tanstack-router → templates/auth/web/tanstack-start}/src/routes/login.tsx +0 -0
- /package/{template/with-next/apps/server → templates/backend/next}/next-env.d.ts +0 -0
- /package/{template/with-next/apps/server → templates/backend/next}/next.config.ts +0 -0
- /package/{template/with-next/apps/server → templates/backend/next}/src/app/route.ts +0 -0
- /package/{template/with-next/apps/server → templates/backend/next}/src/middleware.ts +0 -0
- /package/{template/with-next/apps/server → templates/backend/next}/tsconfig.json +0 -0
- /package/{template/base/apps/server → templates/backend/server-base}/_gitignore +0 -0
- /package/{template/base/apps/server → templates/backend/server-base}/tsconfig.json +0 -0
- /package/{template → templates}/base/_gitignore +0 -0
- /package/{template/with-drizzle-mysql/apps/server → templates/db/drizzle/mysql}/drizzle.config.ts +0 -0
- /package/{template/with-drizzle-mysql/apps/server → templates/db/drizzle/mysql}/src/db/index.ts +0 -0
- /package/{template/with-drizzle-postgres/apps/server → templates/db/drizzle/postgres}/drizzle.config.ts +0 -0
- /package/{template/with-drizzle-postgres/apps/server → templates/db/drizzle/postgres}/src/db/index.ts +0 -0
- /package/{template/with-drizzle-sqlite/apps/server → templates/db/drizzle/sqlite}/drizzle.config.ts +0 -0
- /package/{template/with-drizzle-sqlite/apps/server → templates/db/drizzle/sqlite}/src/db/index.ts +0 -0
- /package/{template/with-prisma-sqlite/apps/server → templates/db/prisma/mongodb}/prisma/index.ts +0 -0
- /package/{template/with-prisma-mongodb/apps/server → templates/db/prisma/mongodb}/prisma/schema/schema.prisma +0 -0
- /package/{template/with-prisma-postgres/apps/server → templates/db/prisma/mysql}/prisma/index.ts +0 -0
- /package/{template/with-prisma-mysql/apps/server → templates/db/prisma/mysql}/prisma/schema/schema.prisma +0 -0
- /package/{template/with-prisma-mysql/apps/server → templates/db/prisma/postgres}/prisma/index.ts +0 -0
- /package/{template/with-prisma-postgres/apps/server → templates/db/prisma/postgres}/prisma/schema/schema.prisma +0 -0
- /package/{template/with-prisma-mongodb/apps/server → templates/db/prisma/sqlite}/prisma/index.ts +0 -0
- /package/{template/with-prisma-sqlite/apps/server → templates/db/prisma/sqlite}/prisma/schema/schema.prisma +0 -0
- /package/{template/examples/ai/apps/web-react-router → templates/examples/ai/apps/react-router}/src/routes/ai.tsx +0 -0
- /package/{template/examples/ai/apps/web-tanstack-start → templates/examples/ai/apps/tanstack-router}/src/routes/ai.tsx +0 -0
- /package/{template/examples/ai/apps/web-tanstack-router → templates/examples/ai/apps/tanstack-start}/src/routes/ai.tsx +0 -0
- /package/{template/with-drizzle-mysql/apps/server → templates/examples/todo/server/drizzle/mysql}/src/db/schema/todo.ts +0 -0
- /package/{template/with-drizzle-postgres/apps/server → templates/examples/todo/server/drizzle/postgres}/src/db/schema/todo.ts +0 -0
- /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
- /package/{template/with-prisma-mongodb/apps/server → templates/examples/todo/server/prisma/mongodb}/prisma/schema/todo.prisma +0 -0
- /package/{template/with-prisma-sqlite/apps/server → templates/examples/todo/server/prisma/mysql}/prisma/schema/todo.prisma +0 -0
- /package/{template/with-prisma-postgres/apps/server → templates/examples/todo/server/prisma/postgres}/prisma/schema/todo.prisma +0 -0
- /package/{template/with-prisma-mysql/apps/server → templates/examples/todo/server/prisma/sqlite}/prisma/schema/todo.prisma +0 -0
- /package/{template/with-pnpm → templates/extras}/pnpm-workspace.yaml +0 -0
- /package/{template/base/apps → templates/frontend}/native/_gitignore +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/(drawer)/(tabs)/_layout.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/(drawer)/(tabs)/index.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/(drawer)/(tabs)/two.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/(drawer)/_layout.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/(drawer)/index.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/+html.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/+not-found.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/_layout.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app/modal.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/app-env.d.ts +0 -0
- /package/{template/base/apps → templates/frontend}/native/app.json +0 -0
- /package/{template/base/apps → templates/frontend}/native/assets/adaptive-icon.png +0 -0
- /package/{template/base/apps → templates/frontend}/native/assets/favicon.png +0 -0
- /package/{template/base/apps → templates/frontend}/native/assets/icon.png +0 -0
- /package/{template/base/apps → templates/frontend}/native/assets/splash.png +0 -0
- /package/{template/base/apps → templates/frontend}/native/babel.config.js +0 -0
- /package/{template/base/apps → templates/frontend}/native/components/container.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/components/header-button.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/components/tabbar-icon.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/global.css +0 -0
- /package/{template/base/apps → templates/frontend}/native/lib/android-navigation-bar.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/native/lib/constants.ts +0 -0
- /package/{template/base/apps → templates/frontend}/native/lib/use-color-scheme.ts +0 -0
- /package/{template/base/apps → templates/frontend}/native/metro.config.js +0 -0
- /package/{template/base/apps → templates/frontend}/native/package.json +0 -0
- /package/{template/base/apps → templates/frontend}/native/tailwind.config.js +0 -0
- /package/{template/base/apps → templates/frontend}/native/tsconfig.json +0 -0
- /package/{template/base/apps → templates/frontend}/native/utils/trpc.ts +0 -0
- /package/{template/base/apps/web-next → templates/frontend/next}/next-env.d.ts +0 -0
- /package/{template/base/apps/web-next → templates/frontend/next}/next.config.ts +0 -0
- /package/{template/base/apps/web-next → templates/frontend/next}/postcss.config.mjs +0 -0
- /package/{template/base/apps/web-next → templates/frontend/next}/src/app/favicon.ico +0 -0
- /package/{template/base/apps/web-next → templates/frontend/next}/src/app/layout.tsx +0 -0
- /package/{template/base/apps/web-next → templates/frontend/next}/src/components/mode-toggle.tsx +0 -0
- /package/{template/base/apps/web-next → templates/frontend/next}/src/components/theme-provider.tsx +0 -0
- /package/{template/base/apps/web-next → templates/frontend/next}/tsconfig.json +0 -0
- /package/{template/base/apps/web-react-router → templates/frontend/react-router}/public/favicon.ico +0 -0
- /package/{template/base/apps/web-react-router → templates/frontend/react-router}/react-router.config.ts +0 -0
- /package/{template/base/apps/web-tanstack-router → templates/frontend/react-router}/src/components/mode-toggle.tsx +0 -0
- /package/{template/base/apps/web-tanstack-router → templates/frontend/react-router}/src/components/theme-provider.tsx +0 -0
- /package/{template/base/apps/web-react-router → templates/frontend/react-router}/src/routes.ts +0 -0
- /package/{template/base/apps/web-react-router → templates/frontend/react-router}/tsconfig.json +0 -0
- /package/{template/base/apps/web-tanstack-router → templates/frontend/tanstack-router}/index.html +0 -0
- /package/{template/base/apps/web-react-router → templates/frontend/tanstack-router}/src/components/mode-toggle.tsx +0 -0
- /package/{template/base/apps/web-react-router → templates/frontend/tanstack-router}/src/components/theme-provider.tsx +0 -0
- /package/{template/base/apps/web-tanstack-router → templates/frontend/tanstack-router}/tsconfig.json +0 -0
- /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/app.config.ts +0 -0
- /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/public/robots.txt +0 -0
- /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/src/api.ts +0 -0
- /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/src/client.tsx +0 -0
- /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/src/ssr.tsx +0 -0
- /package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/tsconfig.json +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/_gitignore +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/components.json +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/loader.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/button.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/card.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/checkbox.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/dropdown-menu.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/input.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/label.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/skeleton.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/components/ui/sonner.tsx +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/index.css +0 -0
- /package/{template/base/apps → templates/frontend}/web-base/src/lib/utils.ts +0 -0
package/{template/base/apps/web-react-router → templates/frontend/react-router}/package.json
RENAMED
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
"@react-router/serve": "^7.4.1",
|
|
19
19
|
"@tanstack/react-form": "^1.2.3",
|
|
20
20
|
"@tanstack/react-query": "^5.71.3",
|
|
21
|
-
"@trpc/client": "^11.0.1",
|
|
22
|
-
"@trpc/server": "^11.0.1",
|
|
23
|
-
"@trpc/tanstack-react-query": "^11.0.1",
|
|
24
21
|
"class-variance-authority": "^0.7.1",
|
|
25
22
|
"clsx": "^2.1.1",
|
|
26
23
|
"isbot": "^5.1.17",
|
|
@@ -12,9 +12,15 @@ import type { Route } from "./+types/root";
|
|
|
12
12
|
import "./index.css";
|
|
13
13
|
import Header from "./components/header";
|
|
14
14
|
import { ThemeProvider } from "./components/theme-provider";
|
|
15
|
-
import { queryClient } from "./utils/trpc";
|
|
16
15
|
import { Toaster } from "./components/ui/sonner";
|
|
17
16
|
|
|
17
|
+
{{#if (eq api "orpc")}}
|
|
18
|
+
import { orpc, ORPCContext, queryClient } from "./utils/orpc";
|
|
19
|
+
{{/if}}
|
|
20
|
+
{{#if (eq api "trpc")}}
|
|
21
|
+
import { queryClient } from "./utils/trpc";
|
|
22
|
+
{{/if}}
|
|
23
|
+
|
|
18
24
|
export const links: Route.LinksFunction = () => [
|
|
19
25
|
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
|
|
20
26
|
{
|
|
@@ -46,6 +52,26 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
46
52
|
);
|
|
47
53
|
}
|
|
48
54
|
|
|
55
|
+
{{#if (eq api "orpc")}}
|
|
56
|
+
export default function App() {
|
|
57
|
+
return (
|
|
58
|
+
<QueryClientProvider client={queryClient}>
|
|
59
|
+
<ORPCContext.Provider value={orpc}>
|
|
60
|
+
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
61
|
+
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
62
|
+
<Header />
|
|
63
|
+
<Outlet />
|
|
64
|
+
</div>
|
|
65
|
+
<Toaster richColors />
|
|
66
|
+
</ThemeProvider>
|
|
67
|
+
</ORPCContext.Provider>
|
|
68
|
+
<ReactQueryDevtools position="bottom" buttonPosition="bottom-right" />
|
|
69
|
+
</QueryClientProvider>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
{{/if}}
|
|
73
|
+
|
|
74
|
+
{{#if (eq api "trpc")}}
|
|
49
75
|
export default function App() {
|
|
50
76
|
return (
|
|
51
77
|
<QueryClientProvider client={queryClient}>
|
|
@@ -60,6 +86,7 @@ export default function App() {
|
|
|
60
86
|
</QueryClientProvider>
|
|
61
87
|
);
|
|
62
88
|
}
|
|
89
|
+
{{/if}}
|
|
63
90
|
|
|
64
91
|
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
65
92
|
let message = "Oops!";
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Route } from "./+types/_index";
|
|
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
|
|
|
5
10
|
const TITLE_TEXT = `
|
|
@@ -23,7 +28,13 @@ export function meta({}: Route.MetaArgs) {
|
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
export default function Home() {
|
|
31
|
+
|
|
32
|
+
{{#if (eq api "orpc")}}
|
|
33
|
+
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
34
|
+
{{/if}}
|
|
35
|
+
{{#if (eq api "trpc")}}
|
|
26
36
|
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
37
|
+
{{/if}}
|
|
27
38
|
|
|
28
39
|
return (
|
|
29
40
|
<div className="container mx-auto max-w-3xl px-4 py-2">
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{{! Import VitePWA only if 'pwa' addon is selected }}
|
|
2
|
+
{{#if (includes addons "pwa")}}
|
|
3
|
+
import { VitePWA } from "vite-plugin-pwa";
|
|
4
|
+
{{/if}}
|
|
5
|
+
import { reactRouter } from "@react-router/dev/vite";
|
|
6
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
7
|
+
import { defineConfig } from "vite";
|
|
8
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
plugins: [
|
|
12
|
+
tailwindcss(),
|
|
13
|
+
reactRouter(),
|
|
14
|
+
tsconfigPaths(),
|
|
15
|
+
{{! Add VitePWA plugin config only if 'pwa' addon is selected }}
|
|
16
|
+
{{#if (includes addons "pwa")}}
|
|
17
|
+
VitePWA({
|
|
18
|
+
registerType: "autoUpdate",
|
|
19
|
+
manifest: {
|
|
20
|
+
// Use context variables for better naming
|
|
21
|
+
name: "{{projectName}}",
|
|
22
|
+
short_name: "{{projectName}}",
|
|
23
|
+
description: "{{projectName}} - PWA Application",
|
|
24
|
+
theme_color: "#0c0c0c",
|
|
25
|
+
// Add more manifest options as needed
|
|
26
|
+
},
|
|
27
|
+
pwaAssets: {
|
|
28
|
+
disabled: false, // Set to false to enable asset generation
|
|
29
|
+
config: true, // Use pwa-assets.config.ts
|
|
30
|
+
},
|
|
31
|
+
devOptions: {
|
|
32
|
+
enabled: true, // Enable PWA features in dev mode
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
{{/if}}
|
|
36
|
+
],
|
|
37
|
+
});
|
package/{template/base/apps/web-tanstack-router → templates/frontend/tanstack-router}/package.json
RENAMED
|
@@ -32,10 +32,6 @@
|
|
|
32
32
|
"@tailwindcss/vite": "^4.0.15",
|
|
33
33
|
"@tanstack/react-query": "^5.69.0",
|
|
34
34
|
"@tanstack/react-router": "^1.114.25",
|
|
35
|
-
"@trpc/client": "^11.0.0",
|
|
36
|
-
"@trpc/react-query": "^11.0.0",
|
|
37
|
-
"@trpc/tanstack-react-query": "^11.0.0",
|
|
38
|
-
"@trpc/server": "^11.0.0",
|
|
39
35
|
"class-variance-authority": "^0.7.1",
|
|
40
36
|
"clsx": "^2.1.1",
|
|
41
37
|
"lucide-react": "^0.473.0",
|
|
@@ -3,8 +3,27 @@ import { RouterProvider, createRouter } from "@tanstack/react-router";
|
|
|
3
3
|
import ReactDOM from "react-dom/client";
|
|
4
4
|
import Loader from "./components/loader";
|
|
5
5
|
import { routeTree } from "./routeTree.gen";
|
|
6
|
+
{{#if (eq api "orpc")}}
|
|
7
|
+
import { orpc, queryClient } from "./utils/orpc";
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#if (eq api "trpc")}}
|
|
6
10
|
import { queryClient, trpc } from "./utils/trpc";
|
|
11
|
+
{{/if}}
|
|
7
12
|
|
|
13
|
+
{{#if (eq api "orpc")}}
|
|
14
|
+
const router = createRouter({
|
|
15
|
+
routeTree,
|
|
16
|
+
defaultPreload: "intent",
|
|
17
|
+
defaultPendingComponent: () => <Loader />,
|
|
18
|
+
context: { orpc, queryClient },
|
|
19
|
+
Wrap: function WrapComponent({ children }) {
|
|
20
|
+
return (
|
|
21
|
+
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{#if (eq api "trpc")}}
|
|
8
27
|
const router = createRouter({
|
|
9
28
|
routeTree,
|
|
10
29
|
defaultPreload: "intent",
|
|
@@ -16,6 +35,7 @@ const router = createRouter({
|
|
|
16
35
|
);
|
|
17
36
|
},
|
|
18
37
|
});
|
|
38
|
+
{{/if}}
|
|
19
39
|
|
|
20
40
|
// Register things for typesafety
|
|
21
41
|
declare module "@tanstack/react-router" {
|
|
@@ -2,9 +2,21 @@ import Header from "@/components/header";
|
|
|
2
2
|
import Loader from "@/components/loader";
|
|
3
3
|
import { ThemeProvider } from "@/components/theme-provider";
|
|
4
4
|
import { Toaster } from "@/components/ui/sonner";
|
|
5
|
+
{{#if (eq api "orpc")}}
|
|
6
|
+
import { link, orpc, ORPCContext } from "@/utils/orpc";
|
|
7
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
8
|
+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
import type { RouterClient } from "@orpc/server";
|
|
11
|
+
import { createORPCReactQueryUtils } from "@orpc/react-query";
|
|
12
|
+
import type { appRouter } from "../../../server/src/routers";
|
|
13
|
+
import { createORPCClient } from "@orpc/client";
|
|
14
|
+
{{/if}}
|
|
15
|
+
{{#if (eq api "trpc")}}
|
|
5
16
|
import type { trpc } from "@/utils/trpc";
|
|
6
17
|
import type { QueryClient } from "@tanstack/react-query";
|
|
7
18
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
19
|
+
{{/if}}
|
|
8
20
|
import {
|
|
9
21
|
HeadContent,
|
|
10
22
|
Outlet,
|
|
@@ -14,10 +26,18 @@ import {
|
|
|
14
26
|
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
|
15
27
|
import "../index.css";
|
|
16
28
|
|
|
29
|
+
{{#if (eq api "orpc")}}
|
|
30
|
+
export interface RouterAppContext {
|
|
31
|
+
orpc: typeof orpc;
|
|
32
|
+
queryClient: QueryClient;
|
|
33
|
+
}
|
|
34
|
+
{{/if}}
|
|
35
|
+
{{#if (eq api "trpc")}}
|
|
17
36
|
export interface RouterAppContext {
|
|
18
37
|
trpc: typeof trpc;
|
|
19
38
|
queryClient: QueryClient;
|
|
20
39
|
}
|
|
40
|
+
{{/if}}
|
|
21
41
|
|
|
22
42
|
export const Route = createRootRouteWithContext<RouterAppContext>()({
|
|
23
43
|
component: RootComponent,
|
|
@@ -40,6 +60,33 @@ export const Route = createRootRouteWithContext<RouterAppContext>()({
|
|
|
40
60
|
}),
|
|
41
61
|
});
|
|
42
62
|
|
|
63
|
+
{{#if (eq api "orpc")}}
|
|
64
|
+
function RootComponent() {
|
|
65
|
+
const [client] = useState<RouterClient<typeof appRouter>>(() => createORPCClient(link))
|
|
66
|
+
const [orpc] = useState(() => createORPCReactQueryUtils(client))
|
|
67
|
+
|
|
68
|
+
const isFetching = useRouterState({
|
|
69
|
+
select: (s) => s.isLoading,
|
|
70
|
+
});
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<HeadContent />
|
|
74
|
+
<ORPCContext.Provider value={orpc}>
|
|
75
|
+
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
76
|
+
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
77
|
+
<Header />
|
|
78
|
+
{isFetching ? <Loader /> : <Outlet />}
|
|
79
|
+
</div>
|
|
80
|
+
<Toaster richColors />
|
|
81
|
+
</ThemeProvider>
|
|
82
|
+
</ORPCContext.Provider>
|
|
83
|
+
<TanStackRouterDevtools position="bottom-left" />
|
|
84
|
+
<ReactQueryDevtools position="bottom" buttonPosition="bottom-right" />
|
|
85
|
+
</>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
{{/if}}
|
|
89
|
+
{{#if (eq api "trpc")}}
|
|
43
90
|
function RootComponent() {
|
|
44
91
|
const isFetching = useRouterState({
|
|
45
92
|
select: (s) => s.isLoading,
|
|
@@ -59,3 +106,4 @@ function RootComponent() {
|
|
|
59
106
|
</>
|
|
60
107
|
);
|
|
61
108
|
}
|
|
109
|
+
{{/if}}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
{{#if (eq api "orpc")}}
|
|
2
|
+
import { orpc } from "@/utils/orpc";
|
|
3
|
+
{{/if}}
|
|
4
|
+
{{#if (eq api "trpc")}}
|
|
1
5
|
import { trpc } from "@/utils/trpc";
|
|
6
|
+
{{/if}}
|
|
2
7
|
import { useQuery } from "@tanstack/react-query";
|
|
3
8
|
import { createFileRoute } from "@tanstack/react-router";
|
|
4
9
|
|
|
@@ -23,7 +28,12 @@ const TITLE_TEXT = `
|
|
|
23
28
|
`;
|
|
24
29
|
|
|
25
30
|
function HomeComponent() {
|
|
31
|
+
{{#if (eq api "orpc")}}
|
|
32
|
+
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
33
|
+
{{/if}}
|
|
34
|
+
{{#if (eq api "trpc")}}
|
|
26
35
|
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
36
|
+
{{/if}}
|
|
27
37
|
|
|
28
38
|
return (
|
|
29
39
|
<div className="container mx-auto max-w-3xl px-4 py-2">
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{{! Import VitePWA only if 'pwa' addon is selected }}
|
|
2
|
+
{{#if (includes addons "pwa")}}
|
|
3
|
+
import { VitePWA } from "vite-plugin-pwa";
|
|
4
|
+
{{/if}}
|
|
5
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
6
|
+
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
|
7
|
+
import react from "@vitejs/plugin-react";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { defineConfig } from "vite";
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
plugins: [
|
|
13
|
+
tailwindcss(),
|
|
14
|
+
TanStackRouterVite({}),
|
|
15
|
+
react(),
|
|
16
|
+
{{! Add VitePWA plugin config only if 'pwa' addon is selected }}
|
|
17
|
+
{{#if (includes addons "pwa")}}
|
|
18
|
+
VitePWA({
|
|
19
|
+
registerType: "autoUpdate",
|
|
20
|
+
manifest: {
|
|
21
|
+
// Use context variables for better naming
|
|
22
|
+
name: "{{projectName}}",
|
|
23
|
+
short_name: "{{projectName}}",
|
|
24
|
+
description: "{{projectName}} - PWA Application",
|
|
25
|
+
theme_color: "#0c0c0c",
|
|
26
|
+
// Add more manifest options as needed
|
|
27
|
+
},
|
|
28
|
+
pwaAssets: {
|
|
29
|
+
disabled: false, // Set to false to enable asset generation
|
|
30
|
+
config: true, // Use pwa-assets.config.ts
|
|
31
|
+
},
|
|
32
|
+
devOptions: {
|
|
33
|
+
enabled: true, // Enable PWA features in dev mode
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
{{/if}}
|
|
37
|
+
],
|
|
38
|
+
resolve: {
|
|
39
|
+
alias: {
|
|
40
|
+
"@": path.resolve(__dirname, "./src"),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
});
|
package/{template/base/apps/web-tanstack-start → templates/frontend/tanstack-start}/package.json
RENAMED
|
@@ -20,9 +20,6 @@
|
|
|
20
20
|
"@tanstack/react-router-with-query": "^1.114.3",
|
|
21
21
|
"@tanstack/react-start": "^1.114.3",
|
|
22
22
|
"@tanstack/router-plugin": "^1.114.3",
|
|
23
|
-
"@trpc/client": "^11.0.2",
|
|
24
|
-
"@trpc/server": "^11.0.2",
|
|
25
|
-
"@trpc/tanstack-react-query": "^11.0.2",
|
|
26
23
|
"class-variance-authority": "^0.7.1",
|
|
27
24
|
"clsx": "^2.1.1",
|
|
28
25
|
"lucide-react": "^0.473.0",
|
|
@@ -4,15 +4,21 @@ import {
|
|
|
4
4
|
QueryClientProvider,
|
|
5
5
|
} from "@tanstack/react-query";
|
|
6
6
|
import { createRouter as createTanstackRouter } from "@tanstack/react-router";
|
|
7
|
+
import Loader from "./components/loader";
|
|
8
|
+
import "./index.css";
|
|
9
|
+
import { routeTree } from "./routeTree.gen";
|
|
10
|
+
{{#if (eq api "trpc")}}
|
|
7
11
|
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
8
12
|
import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
|
|
9
13
|
import { toast } from "sonner";
|
|
10
14
|
import type { AppRouter } from "../../server/src/routers";
|
|
11
|
-
import Loader from "./components/loader";
|
|
12
|
-
import "./index.css";
|
|
13
|
-
import { routeTree } from "./routeTree.gen";
|
|
14
15
|
import { TRPCProvider } from "./utils/trpc";
|
|
16
|
+
{{/if}}
|
|
17
|
+
{{#if (eq api "orpc")}}
|
|
18
|
+
import { orpc, ORPCContext, queryClient } from "./utils/orpc";
|
|
19
|
+
{{/if}}
|
|
15
20
|
|
|
21
|
+
{{#if (eq api "trpc")}}
|
|
16
22
|
export const queryClient = new QueryClient({
|
|
17
23
|
queryCache: new QueryCache({
|
|
18
24
|
onError: (error) => {
|
|
@@ -32,13 +38,19 @@ export const queryClient = new QueryClient({
|
|
|
32
38
|
const trpcClient = createTRPCClient<AppRouter>({
|
|
33
39
|
links: [
|
|
34
40
|
httpBatchLink({
|
|
41
|
+
{{#if (includes frontend 'next')}}
|
|
42
|
+
url: `${process.env.NEXT_PUBLIC_SERVER_URL}/trpc`,
|
|
43
|
+
{{else}}
|
|
35
44
|
url: `${import.meta.env.VITE_SERVER_URL}/trpc`,
|
|
45
|
+
{{/if}}
|
|
46
|
+
{{#if auth}}
|
|
36
47
|
fetch(url, options) {
|
|
37
48
|
return fetch(url, {
|
|
38
49
|
...options,
|
|
39
50
|
credentials: "include",
|
|
40
51
|
});
|
|
41
52
|
},
|
|
53
|
+
{{/if}}
|
|
42
54
|
}),
|
|
43
55
|
],
|
|
44
56
|
});
|
|
@@ -47,20 +59,34 @@ const trpc = createTRPCOptionsProxy({
|
|
|
47
59
|
client: trpcClient,
|
|
48
60
|
queryClient: queryClient,
|
|
49
61
|
});
|
|
62
|
+
{{/if}}
|
|
63
|
+
|
|
50
64
|
|
|
51
65
|
export const createRouter = () => {
|
|
52
66
|
const router = createTanstackRouter({
|
|
53
67
|
routeTree,
|
|
54
68
|
scrollRestoration: true,
|
|
55
69
|
defaultPreloadStaleTime: 0,
|
|
70
|
+
{{#if (eq api "trpc")}}
|
|
56
71
|
context: { trpc, queryClient },
|
|
72
|
+
{{/if}}
|
|
73
|
+
{{#if (eq api "orpc")}}
|
|
74
|
+
context: { orpc, queryClient },
|
|
75
|
+
{{/if}}
|
|
57
76
|
defaultPendingComponent: () => <Loader />,
|
|
58
77
|
defaultNotFoundComponent: () => <div>Not Found</div>,
|
|
59
78
|
Wrap: ({ children }) => (
|
|
60
79
|
<QueryClientProvider client={queryClient}>
|
|
80
|
+
{{#if (eq api "trpc")}}
|
|
61
81
|
<TRPCProvider trpcClient={trpcClient} queryClient={queryClient}>
|
|
62
82
|
{children}
|
|
63
83
|
</TRPCProvider>
|
|
84
|
+
{{/if}}
|
|
85
|
+
{{#if (eq api "orpc")}}
|
|
86
|
+
<ORPCContext.Provider value={orpc}>
|
|
87
|
+
{children}
|
|
88
|
+
</ORPCContext.Provider>
|
|
89
|
+
{{/if}}
|
|
64
90
|
</QueryClientProvider>
|
|
65
91
|
),
|
|
66
92
|
});
|
|
@@ -11,14 +11,27 @@ import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
|
|
11
11
|
import Header from "../components/header";
|
|
12
12
|
import appCss from "../index.css?url";
|
|
13
13
|
import type { QueryClient } from "@tanstack/react-query";
|
|
14
|
+
{{#if (eq api "trpc")}}
|
|
14
15
|
import type { TRPCOptionsProxy } from "@trpc/tanstack-react-query";
|
|
15
16
|
import type { AppRouter } from "../../../server/src/routers";
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{#if (eq api "orpc")}}
|
|
19
|
+
import type { orpc } from "@/utils/orpc";
|
|
20
|
+
{{/if}}
|
|
16
21
|
import Loader from "@/components/loader";
|
|
17
22
|
|
|
23
|
+
{{#if (eq api "trpc")}}
|
|
18
24
|
export interface RouterAppContext {
|
|
19
25
|
trpc: TRPCOptionsProxy<AppRouter>;
|
|
20
26
|
queryClient: QueryClient;
|
|
21
27
|
}
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{#if (eq api "orpc")}}
|
|
30
|
+
export interface RouterAppContext {
|
|
31
|
+
orpc: typeof orpc;
|
|
32
|
+
queryClient: QueryClient;
|
|
33
|
+
}
|
|
34
|
+
{{/if}}
|
|
22
35
|
|
|
23
36
|
export const Route = createRootRouteWithContext<RouterAppContext>()({
|
|
24
37
|
head: () => ({
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
{{#if (eq api "trpc")}}
|
|
1
2
|
import { useTRPC } from "@/utils/trpc";
|
|
3
|
+
{{/if}}
|
|
4
|
+
{{#if (eq api "orpc")}}
|
|
5
|
+
import { useORPC } from "@/utils/orpc";
|
|
6
|
+
{{/if}}
|
|
2
7
|
import { useQuery } from "@tanstack/react-query";
|
|
3
8
|
import { createFileRoute } from "@tanstack/react-router";
|
|
4
9
|
|
|
@@ -23,8 +28,14 @@ const TITLE_TEXT = `
|
|
|
23
28
|
`;
|
|
24
29
|
|
|
25
30
|
function HomeComponent() {
|
|
31
|
+
{{#if (eq api "trpc")}}
|
|
26
32
|
const trpc = useTRPC();
|
|
27
33
|
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
34
|
+
{{/if}}
|
|
35
|
+
{{#if (eq api "orpc")}}
|
|
36
|
+
const orpc = useORPC();
|
|
37
|
+
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
38
|
+
{{/if}}
|
|
28
39
|
|
|
29
40
|
return (
|
|
30
41
|
<div className="container mx-auto max-w-3xl px-4 py-2">
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{{#if (includes frontend "next")}}
|
|
2
|
+
"use client";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
{{else if (includes frontend "react-router")}}
|
|
5
|
+
import { NavLink } from "react-router";
|
|
6
|
+
{{else if (or (includes frontend "tanstack-router") (includes frontend "tanstack-start"))}}
|
|
7
|
+
import { Link } from "@tanstack/react-router";
|
|
8
|
+
{{/if}}
|
|
9
|
+
|
|
10
|
+
{{#unless (includes frontend "tanstack-start")}}
|
|
11
|
+
import { ModeToggle } from "./mode-toggle";
|
|
12
|
+
{{/unless}}
|
|
13
|
+
{{#if auth}}
|
|
14
|
+
import UserMenu from "./user-menu";
|
|
15
|
+
{{/if}}
|
|
16
|
+
|
|
17
|
+
export default function Header() {
|
|
18
|
+
const links = [
|
|
19
|
+
{ to: "/", label: "Home" },
|
|
20
|
+
{{#if auth}}
|
|
21
|
+
{ to: "/dashboard", label: "Dashboard" },
|
|
22
|
+
{{/if}}
|
|
23
|
+
{{#if (includes examples "todo")}}
|
|
24
|
+
{ to: "/todos", label: "Todos" },
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{#if (includes examples "ai")}}
|
|
27
|
+
{ to: "/ai", label: "AI Chat" },
|
|
28
|
+
{{/if}}
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div>
|
|
33
|
+
<div className="flex flex-row items-center justify-between px-2 py-1">
|
|
34
|
+
<nav className="flex gap-4 text-lg">
|
|
35
|
+
{links.map(({ to, label }) => {
|
|
36
|
+
{{#if (includes frontend "next")}}
|
|
37
|
+
return (
|
|
38
|
+
<Link key={to} href={to}>
|
|
39
|
+
{label}
|
|
40
|
+
</Link>
|
|
41
|
+
);
|
|
42
|
+
{{else if (includes frontend "react-router")}}
|
|
43
|
+
return (
|
|
44
|
+
<NavLink
|
|
45
|
+
key={to}
|
|
46
|
+
to={to}
|
|
47
|
+
className={({ isActive }) => isActive ? "font-bold" : ""}
|
|
48
|
+
end
|
|
49
|
+
>
|
|
50
|
+
{label}
|
|
51
|
+
</NavLink>
|
|
52
|
+
);
|
|
53
|
+
{{else if (or (includes frontend "tanstack-router") (includes frontend "tanstack-start"))}}
|
|
54
|
+
return (
|
|
55
|
+
<Link
|
|
56
|
+
key={to}
|
|
57
|
+
to={to}
|
|
58
|
+
>
|
|
59
|
+
{label}
|
|
60
|
+
</Link>
|
|
61
|
+
);
|
|
62
|
+
{{else}}
|
|
63
|
+
// Fallback case (shouldn't happen with valid frontend selection)
|
|
64
|
+
return null;
|
|
65
|
+
{{/if}}
|
|
66
|
+
})}
|
|
67
|
+
</nav>
|
|
68
|
+
<div className="flex items-center gap-2">
|
|
69
|
+
{{#unless (includes frontend "tanstack-start")}}
|
|
70
|
+
<ModeToggle />
|
|
71
|
+
{{/unless}}
|
|
72
|
+
{{#if auth}}
|
|
73
|
+
<UserMenu />
|
|
74
|
+
{{/if}}
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<hr />
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { router, publicProcedure } from "../lib/trpc";
|
|
2
|
-
import { todoRouter } from "./todo";
|
|
3
|
-
|
|
4
|
-
export const appRouter = router({
|
|
5
|
-
healthCheck: publicProcedure.query(() => {
|
|
6
|
-
return "OK";
|
|
7
|
-
}),
|
|
8
|
-
todo: todoRouter,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export type AppRouter = typeof appRouter;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { AppRouter } from "../../../server/src/routers";
|
|
2
|
-
import { QueryCache, QueryClient } from "@tanstack/react-query";
|
|
3
|
-
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
4
|
-
import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
|
|
5
|
-
import { toast } from "sonner";
|
|
6
|
-
|
|
7
|
-
export const queryClient = new QueryClient({
|
|
8
|
-
queryCache: new QueryCache({
|
|
9
|
-
onError: (error) => {
|
|
10
|
-
toast.error(error.message, {
|
|
11
|
-
action: {
|
|
12
|
-
label: "retry",
|
|
13
|
-
onClick: () => {
|
|
14
|
-
queryClient.invalidateQueries();
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
}),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export const trpcClient = createTRPCClient<AppRouter>({
|
|
23
|
-
links: [
|
|
24
|
-
httpBatchLink({
|
|
25
|
-
url: `${import.meta.env.VITE_SERVER_URL}/trpc`,
|
|
26
|
-
}),
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export const trpc = createTRPCOptionsProxy<AppRouter>({
|
|
31
|
-
client: trpcClient,
|
|
32
|
-
queryClient,
|
|
33
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import { ModeToggle } from "./mode-toggle";
|
|
4
|
-
|
|
5
|
-
export default function Header() {
|
|
6
|
-
const links = [
|
|
7
|
-
{ to: "/", label: "Home" },
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div>
|
|
12
|
-
<div className="flex flex-row items-center justify-between px-2 py-1">
|
|
13
|
-
<nav className="flex gap-4 text-lg">
|
|
14
|
-
{links.map(({ to, label }) => (
|
|
15
|
-
<Link
|
|
16
|
-
key={to}
|
|
17
|
-
href={to}
|
|
18
|
-
>
|
|
19
|
-
{label}
|
|
20
|
-
</Link>
|
|
21
|
-
))}
|
|
22
|
-
</nav>
|
|
23
|
-
<div className="flex items-center gap-2">
|
|
24
|
-
<ModeToggle />
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
<hr />
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { QueryCache, QueryClient } from '@tanstack/react-query';
|
|
2
|
-
import { createTRPCClient, httpBatchLink } from '@trpc/client';
|
|
3
|
-
import { createTRPCOptionsProxy } from '@trpc/tanstack-react-query';
|
|
4
|
-
import type { AppRouter } from '../../../server/src/routers';
|
|
5
|
-
import { toast } from 'sonner';
|
|
6
|
-
|
|
7
|
-
export const queryClient = new QueryClient({
|
|
8
|
-
queryCache: new QueryCache({
|
|
9
|
-
onError: (error) => {
|
|
10
|
-
toast.error(error.message, {
|
|
11
|
-
action: {
|
|
12
|
-
label: "retry",
|
|
13
|
-
onClick: () => {
|
|
14
|
-
queryClient.invalidateQueries();
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
}),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const trpcClient = createTRPCClient<AppRouter>({
|
|
23
|
-
links: [
|
|
24
|
-
httpBatchLink({
|
|
25
|
-
url: `${process.env.NEXT_PUBLIC_SERVER_URL}/trpc`,
|
|
26
|
-
}),
|
|
27
|
-
],
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
export const trpc = createTRPCOptionsProxy<AppRouter>({
|
|
31
|
-
client: trpcClient,
|
|
32
|
-
queryClient,
|
|
33
|
-
});
|