create-better-t-stack 2.2.4 → 2.3.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.
- package/dist/index.js +21 -29
- package/package.json +1 -1
- package/templates/addons/turborepo/{turbo.json → turbo.json.hbs} +7 -1
- package/templates/api/orpc/server/base/src/lib/context.ts.hbs +0 -2
- package/templates/auth/web/nuxt/app/components/SignInForm.vue +0 -1
- package/templates/auth/web/nuxt/app/components/SignUpForm.vue +0 -1
- package/templates/auth/web/nuxt/app/components/UserMenu.vue +0 -1
- package/templates/backend/convex/packages/backend/_gitignore +2 -0
- package/templates/backend/convex/packages/backend/convex/README.md +90 -0
- package/templates/backend/convex/packages/backend/convex/healthCheck.ts +7 -0
- package/templates/backend/convex/packages/backend/convex/schema.ts +9 -0
- package/templates/backend/convex/packages/backend/convex/todos.ts +42 -0
- package/templates/backend/convex/packages/backend/convex/tsconfig.json +25 -0
- package/templates/backend/convex/packages/backend/package.json.hbs +21 -0
- package/templates/base/package.json +2 -1
- package/templates/examples/todo/web/react/react-router/src/routes/todos.tsx.hbs +178 -93
- package/templates/examples/todo/web/react/tanstack-router/src/routes/todos.tsx.hbs +178 -92
- package/templates/examples/todo/web/react/tanstack-start/src/routes/todos.tsx.hbs +119 -18
- package/templates/extras/pnpm-workspace.yaml +1 -0
- package/templates/frontend/native/app/(drawer)/index.tsx.hbs +35 -7
- package/templates/frontend/native/app/_layout.tsx.hbs +27 -0
- package/templates/frontend/react/next/package.json +0 -2
- package/templates/frontend/react/next/src/app/page.tsx.hbs +26 -44
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +15 -3
- package/templates/frontend/react/react-router/package.json +0 -2
- package/templates/frontend/react/react-router/src/root.tsx.hbs +31 -11
- package/templates/frontend/react/react-router/src/routes/_index.tsx.hbs +28 -47
- package/templates/frontend/react/tanstack-router/package.json +0 -2
- package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +18 -2
- package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +24 -1
- package/templates/frontend/react/tanstack-router/src/routes/index.tsx.hbs +24 -39
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +57 -13
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +12 -10
- package/templates/frontend/react/tanstack-start/src/routes/index.tsx.hbs +31 -45
- /package/templates/backend/{elysia → server/elysia}/src/index.ts.hbs +0 -0
- /package/templates/backend/{express → server/express}/src/index.ts.hbs +0 -0
- /package/templates/backend/{hono → server/hono}/src/index.ts.hbs +0 -0
- /package/templates/backend/{next → server/next}/next-env.d.ts +0 -0
- /package/templates/backend/{next → server/next}/next.config.ts +0 -0
- /package/templates/backend/{next → server/next}/package.json +0 -0
- /package/templates/backend/{next → server/next}/src/app/route.ts +0 -0
- /package/templates/backend/{next → server/next}/src/middleware.ts +0 -0
- /package/templates/backend/{next → server/next}/tsconfig.json +0 -0
- /package/templates/backend/{server-base → server/server-base}/_gitignore +0 -0
- /package/templates/backend/{server-base → server/server-base}/package.json +0 -0
- /package/templates/backend/{server-base → server/server-base}/src/routers/index.ts.hbs +0 -0
- /package/templates/backend/{server-base → server/server-base}/tsconfig.json.hbs +0 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
{
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
{{#if (eq backend "convex")}}
|
|
3
|
+
import { convexQuery } from "@convex-dev/react-query";
|
|
4
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
5
|
+
import { api } from "@{{projectName}}/backend/convex/_generated/api.js";
|
|
6
|
+
{{else}}
|
|
7
|
+
{{#if (eq api "trpc")}}
|
|
2
8
|
import { useTRPC } from "@/utils/trpc";
|
|
3
|
-
{{/if}}
|
|
4
|
-
{{#if (eq api "orpc")}}
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{#if (eq api "orpc")}}
|
|
5
11
|
import { useORPC } from "@/utils/orpc";
|
|
6
|
-
{{/if}}
|
|
12
|
+
{{/if}}
|
|
7
13
|
import { useQuery } from "@tanstack/react-query";
|
|
8
|
-
|
|
14
|
+
{{/if}}
|
|
9
15
|
|
|
10
16
|
export const Route = createFileRoute("/")({
|
|
11
17
|
component: HomeComponent,
|
|
@@ -28,13 +34,17 @@ const TITLE_TEXT = `
|
|
|
28
34
|
`;
|
|
29
35
|
|
|
30
36
|
function HomeComponent() {
|
|
31
|
-
{{#if (eq
|
|
37
|
+
{{#if (eq backend "convex")}}
|
|
38
|
+
const healthCheck = useSuspenseQuery(convexQuery(api.healthCheck.get, {}));
|
|
39
|
+
{{else}}
|
|
40
|
+
{{#if (eq api "trpc")}}
|
|
32
41
|
const trpc = useTRPC();
|
|
33
42
|
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
{{/if}}
|
|
44
|
+
{{#if (eq api "orpc")}}
|
|
36
45
|
const orpc = useORPC();
|
|
37
46
|
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
47
|
+
{{/if}}
|
|
38
48
|
{{/if}}
|
|
39
49
|
|
|
40
50
|
return (
|
|
@@ -44,6 +54,18 @@ function HomeComponent() {
|
|
|
44
54
|
<section className="rounded-lg border p-4">
|
|
45
55
|
<h2 className="mb-2 font-medium">API Status</h2>
|
|
46
56
|
<div className="flex items-center gap-2">
|
|
57
|
+
{{#if (eq backend "convex")}}
|
|
58
|
+
<div
|
|
59
|
+
className={`h-2 w-2 rounded-full ${healthCheck.data === "OK" ? "bg-green-500" : healthCheck.isLoading ? "bg-orange-400" : "bg-red-500"}`}
|
|
60
|
+
/>
|
|
61
|
+
<span className="text-muted-foreground text-sm">
|
|
62
|
+
{healthCheck.isLoading
|
|
63
|
+
? "Checking..."
|
|
64
|
+
: healthCheck.data === "OK"
|
|
65
|
+
? "Connected"
|
|
66
|
+
: "Error"}
|
|
67
|
+
</span>
|
|
68
|
+
{{else}}
|
|
47
69
|
<div
|
|
48
70
|
className={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
|
49
71
|
/>
|
|
@@ -54,46 +76,10 @@ function HomeComponent() {
|
|
|
54
76
|
? "Connected"
|
|
55
77
|
: "Disconnected"}
|
|
56
78
|
</span>
|
|
79
|
+
{{/if}}
|
|
57
80
|
</div>
|
|
58
81
|
</section>
|
|
59
|
-
|
|
60
|
-
<section>
|
|
61
|
-
<h2 className="mb-3 font-medium">Core Features</h2>
|
|
62
|
-
<ul className="grid grid-cols-2 gap-3">
|
|
63
|
-
<FeatureItem
|
|
64
|
-
title="Type-Safe API"
|
|
65
|
-
description="End-to-end type safety with tRPC"
|
|
66
|
-
/>
|
|
67
|
-
<FeatureItem
|
|
68
|
-
title="Modern React"
|
|
69
|
-
description="TanStack Router + TanStack Query"
|
|
70
|
-
/>
|
|
71
|
-
<FeatureItem
|
|
72
|
-
title="Fast Backend"
|
|
73
|
-
description="Lightweight Hono server"
|
|
74
|
-
/>
|
|
75
|
-
<FeatureItem
|
|
76
|
-
title="Beautiful UI"
|
|
77
|
-
description="TailwindCSS + shadcn/ui components"
|
|
78
|
-
/>
|
|
79
|
-
</ul>
|
|
80
|
-
</section>
|
|
81
82
|
</div>
|
|
82
83
|
</div>
|
|
83
84
|
);
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
function FeatureItem({
|
|
87
|
-
title,
|
|
88
|
-
description,
|
|
89
|
-
}: {
|
|
90
|
-
title: string;
|
|
91
|
-
description: string;
|
|
92
|
-
}) {
|
|
93
|
-
return (
|
|
94
|
-
<li className="border-primary border-l-2 py-1 pl-3">
|
|
95
|
-
<h3 className="font-medium">{title}</h3>
|
|
96
|
-
<p className="text-muted-foreground text-sm">{description}</p>
|
|
97
|
-
</li>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|