create-better-t-stack 2.36.3-canary.5fe7a73e → 2.37.0-canary.28c5b8e0
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/cli.js +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.js +1 -1
- package/dist/{src-C_VdApv8.js → src-CzVr9ZoP.js} +278 -224
- package/package.json +1 -1
- package/templates/addons/ruler/.ruler/bts.md.hbs +2 -2
- package/templates/api/orpc/native/utils/orpc.ts.hbs +2 -2
- package/templates/api/orpc/server/base/src/lib/context.ts.hbs +10 -10
- package/templates/api/orpc/server/base/src/lib/orpc.ts.hbs +1 -1
- package/templates/api/orpc/server/next/src/app/rpc/[...all]/route.ts.hbs +2 -2
- package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +1 -1
- package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +1 -1
- package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +1 -1
- package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +1 -1
- package/templates/api/trpc/native/utils/trpc.ts.hbs +2 -2
- package/templates/api/trpc/server/base/src/lib/context.ts.hbs +10 -10
- package/templates/api/trpc/server/base/src/lib/trpc.ts.hbs +1 -1
- package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +2 -2
- package/templates/auth/clerk/convex/backend/convex/auth.config.ts.hbs +12 -0
- package/templates/auth/clerk/convex/backend/convex/privateData.ts.hbs +16 -0
- package/templates/auth/clerk/convex/native/base/app/(auth)/_layout.tsx.hbs +12 -0
- package/templates/auth/clerk/convex/native/base/app/(auth)/sign-in.tsx.hbs +67 -0
- package/templates/auth/clerk/convex/native/base/app/(auth)/sign-out.tsx.hbs +110 -0
- package/templates/auth/clerk/convex/native/base/components/sign-out-button.tsx.hbs +27 -0
- package/templates/auth/clerk/convex/web/react/next/src/app/dashboard/page.tsx.hbs +29 -0
- package/templates/auth/clerk/convex/web/react/next/src/middleware.ts.hbs +12 -0
- package/templates/auth/clerk/convex/web/react/react-router/src/routes/dashboard.tsx.hbs +32 -0
- package/templates/auth/clerk/convex/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +37 -0
- package/templates/auth/clerk/convex/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +37 -0
- package/templates/auth/clerk/convex/web/react/tanstack-start/src/server.ts.hbs +18 -0
- package/templates/backend/convex/packages/backend/package.json.hbs +1 -0
- package/templates/backend/server/elysia/src/index.ts.hbs +3 -3
- package/templates/backend/server/express/src/index.ts.hbs +6 -6
- package/templates/backend/server/fastify/src/index.ts.hbs +4 -4
- package/templates/backend/server/hono/src/index.ts.hbs +4 -4
- package/templates/backend/server/server-base/src/routers/index.ts.hbs +4 -4
- package/templates/deploy/alchemy/alchemy.run.ts.hbs +3 -18
- package/templates/frontend/native/nativewind/app/(drawer)/index.tsx.hbs +35 -3
- package/templates/frontend/native/nativewind/app/_layout.tsx.hbs +28 -0
- package/templates/frontend/native/nativewind/package.json.hbs +1 -0
- package/templates/frontend/native/unistyles/app/(drawer)/index.tsx.hbs +32 -0
- package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +35 -0
- package/templates/frontend/native/unistyles/package.json.hbs +1 -0
- package/templates/frontend/nuxt/app/components/Header.vue.hbs +3 -3
- package/templates/frontend/react/next/src/app/layout.tsx.hbs +23 -15
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +12 -0
- package/templates/frontend/react/react-router/src/root.tsx.hbs +28 -1
- package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +19 -1
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +8 -4
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +52 -5
- package/templates/frontend/react/web-base/src/components/header.tsx.hbs +3 -3
- package/templates/frontend/solid/src/components/header.tsx.hbs +3 -3
- package/templates/frontend/svelte/src/components/Header.svelte.hbs +3 -3
- package/templates/deploy/alchemy/wrangler.jsonc.hbs +0 -11
- /package/templates/auth/{native → better-auth/native}/native-base/lib/auth-client.ts.hbs +0 -0
- /package/templates/auth/{native → better-auth/native}/nativewind/app/(drawer)/index.tsx.hbs +0 -0
- /package/templates/auth/{native → better-auth/native}/nativewind/components/sign-in.tsx.hbs +0 -0
- /package/templates/auth/{native → better-auth/native}/nativewind/components/sign-up.tsx.hbs +0 -0
- /package/templates/auth/{native → better-auth/native}/unistyles/app/(drawer)/index.tsx.hbs +0 -0
- /package/templates/auth/{native → better-auth/native}/unistyles/components/sign-in.tsx.hbs +0 -0
- /package/templates/auth/{native → better-auth/native}/unistyles/components/sign-up.tsx.hbs +0 -0
- /package/templates/auth/{server → better-auth/server}/base/src/lib/auth.ts.hbs +0 -0
- /package/templates/auth/{server → better-auth/server}/db/drizzle/mysql/src/db/schema/auth.ts +0 -0
- /package/templates/auth/{server → better-auth/server}/db/drizzle/postgres/src/db/schema/auth.ts +0 -0
- /package/templates/auth/{server → better-auth/server}/db/drizzle/sqlite/src/db/schema/auth.ts +0 -0
- /package/templates/auth/{server → better-auth/server}/db/mongoose/mongodb/src/db/models/auth.model.ts +0 -0
- /package/templates/auth/{server → better-auth/server}/db/prisma/mongodb/prisma/schema/auth.prisma +0 -0
- /package/templates/auth/{server → better-auth/server}/db/prisma/mysql/prisma/schema/auth.prisma +0 -0
- /package/templates/auth/{server → better-auth/server}/db/prisma/postgres/prisma/schema/auth.prisma +0 -0
- /package/templates/auth/{server → better-auth/server}/db/prisma/sqlite/prisma/schema/auth.prisma +0 -0
- /package/templates/auth/{server → better-auth/server}/next/src/app/api/auth/[...all]/route.ts +0 -0
- /package/templates/auth/{web → better-auth/web}/nuxt/app/components/SignInForm.vue +0 -0
- /package/templates/auth/{web → better-auth/web}/nuxt/app/components/SignUpForm.vue +0 -0
- /package/templates/auth/{web → better-auth/web}/nuxt/app/components/UserMenu.vue +0 -0
- /package/templates/auth/{web → better-auth/web}/nuxt/app/middleware/auth.ts +0 -0
- /package/templates/auth/{web → better-auth/web}/nuxt/app/pages/dashboard.vue.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/nuxt/app/pages/login.vue +0 -0
- /package/templates/auth/{web → better-auth/web}/nuxt/app/plugins/auth-client.ts +0 -0
- /package/templates/auth/{web → better-auth/web}/react/base/src/lib/auth-client.ts.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/react/next/src/app/dashboard/page.tsx.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/react/next/src/app/login/page.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/next/src/components/sign-in-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/next/src/components/sign-up-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/next/src/components/theme-provider.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/next/src/components/user-menu.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/react-router/src/components/sign-in-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/react-router/src/components/sign-up-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/react-router/src/components/user-menu.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/react-router/src/routes/dashboard.tsx.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/react/react-router/src/routes/login.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-router/src/components/sign-in-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-router/src/components/sign-up-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-router/src/components/user-menu.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-router/src/routes/dashboard.tsx.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-router/src/routes/login.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/components/sign-in-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/components/sign-up-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/components/user-menu.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/routes/dashboard.tsx.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/routes/login.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/solid/src/components/sign-in-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/solid/src/components/sign-up-form.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/solid/src/components/user-menu.tsx.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/solid/src/lib/auth-client.ts +0 -0
- /package/templates/auth/{web → better-auth/web}/solid/src/routes/dashboard.tsx.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/solid/src/routes/login.tsx +0 -0
- /package/templates/auth/{web → better-auth/web}/svelte/src/components/SignInForm.svelte +0 -0
- /package/templates/auth/{web → better-auth/web}/svelte/src/components/SignUpForm.svelte +0 -0
- /package/templates/auth/{web → better-auth/web}/svelte/src/components/UserMenu.svelte +0 -0
- /package/templates/auth/{web → better-auth/web}/svelte/src/lib/auth-client.ts +0 -0
- /package/templates/auth/{web → better-auth/web}/svelte/src/routes/dashboard/+page.svelte.hbs +0 -0
- /package/templates/auth/{web → better-auth/web}/svelte/src/routes/login/+page.svelte +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Metadata } from "next";
|
|
2
2
|
import { Geist, Geist_Mono } from "next/font/google";
|
|
3
3
|
import "../index.css";
|
|
4
|
-
import
|
|
4
|
+
{{#if (eq auth "clerk")}}{{#if (eq backend "convex")}}import { ClerkProvider } from "@clerk/nextjs";
|
|
5
|
+
{{/if}}{{/if}}import Providers from "@/components/providers";
|
|
5
6
|
import Header from "@/components/header";
|
|
6
7
|
|
|
7
8
|
const geistSans = Geist({
|
|
@@ -24,18 +25,25 @@ export default function RootLayout({
|
|
|
24
25
|
}: Readonly<{
|
|
25
26
|
children: React.ReactNode;
|
|
26
27
|
}>) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
return (
|
|
29
|
+
<html lang="en" suppressHydrationWarning>
|
|
30
|
+
<body
|
|
31
|
+
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
32
|
+
>
|
|
33
|
+
{{#if (and (eq auth "clerk") (eq backend "convex"))}}<ClerkProvider>
|
|
34
|
+
<Providers>
|
|
35
|
+
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
36
|
+
<Header />
|
|
37
|
+
{children}
|
|
38
|
+
</div>
|
|
39
|
+
</Providers>
|
|
40
|
+
</ClerkProvider>{{else}}<Providers>
|
|
41
|
+
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
42
|
+
<Header />
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
</Providers>{{/if}}
|
|
46
|
+
</body>
|
|
47
|
+
</html>
|
|
48
|
+
);
|
|
41
49
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
{{#if (eq backend "convex")}}
|
|
4
|
+
{{#if (eq auth "clerk")}}
|
|
5
|
+
import { useAuth } from "@clerk/nextjs";
|
|
6
|
+
import { ConvexReactClient } from "convex/react";
|
|
7
|
+
import { ConvexProviderWithClerk } from "convex/react-clerk";
|
|
8
|
+
{{else}}
|
|
4
9
|
import { ConvexProvider, ConvexReactClient } from "convex/react";
|
|
10
|
+
{{/if}}
|
|
5
11
|
{{else}}
|
|
6
12
|
{{#unless (eq api "none")}}
|
|
7
13
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
@@ -34,7 +40,13 @@ export default function Providers({
|
|
|
34
40
|
disableTransitionOnChange
|
|
35
41
|
>
|
|
36
42
|
{{#if (eq backend "convex")}}
|
|
43
|
+
{{#if (eq auth "clerk")}}
|
|
44
|
+
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
|
|
45
|
+
{children}
|
|
46
|
+
</ConvexProviderWithClerk>
|
|
47
|
+
{{else}}
|
|
37
48
|
<ConvexProvider client={convex}>{children}</ConvexProvider>
|
|
49
|
+
{{/if}}
|
|
38
50
|
{{else}}
|
|
39
51
|
{{#unless (eq api "none")}}
|
|
40
52
|
<QueryClientProvider client={queryClient}>
|
|
@@ -13,7 +13,13 @@ import { ThemeProvider } from "./components/theme-provider";
|
|
|
13
13
|
import { Toaster } from "./components/ui/sonner";
|
|
14
14
|
|
|
15
15
|
{{#if (eq backend "convex")}}
|
|
16
|
-
import {
|
|
16
|
+
import { ConvexReactClient } from "convex/react";
|
|
17
|
+
{{#if (eq auth "clerk")}}
|
|
18
|
+
import { ClerkProvider, useAuth } from "@clerk/clerk-react";
|
|
19
|
+
import { ConvexProviderWithClerk } from "convex/react-clerk";
|
|
20
|
+
{{else}}
|
|
21
|
+
import { ConvexProvider } from "convex/react";
|
|
22
|
+
{{/if}}
|
|
17
23
|
{{else}}
|
|
18
24
|
{{#unless (eq api "none")}}
|
|
19
25
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
@@ -60,6 +66,26 @@ export default function App() {
|
|
|
60
66
|
const convex = new ConvexReactClient(
|
|
61
67
|
import.meta.env.VITE_CONVEX_URL as string,
|
|
62
68
|
);
|
|
69
|
+
{{#if (eq auth "clerk")}}
|
|
70
|
+
return (
|
|
71
|
+
<ClerkProvider publishableKey={import.meta.env.VITE_CLERK_PUBLISHABLE_KEY}>
|
|
72
|
+
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
|
|
73
|
+
<ThemeProvider
|
|
74
|
+
attribute="class"
|
|
75
|
+
defaultTheme="dark"
|
|
76
|
+
disableTransitionOnChange
|
|
77
|
+
storageKey="vite-ui-theme"
|
|
78
|
+
>
|
|
79
|
+
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
80
|
+
<Header />
|
|
81
|
+
<Outlet />
|
|
82
|
+
</div>
|
|
83
|
+
<Toaster richColors />
|
|
84
|
+
</ThemeProvider>
|
|
85
|
+
</ConvexProviderWithClerk>
|
|
86
|
+
</ClerkProvider>
|
|
87
|
+
);
|
|
88
|
+
{{else}}
|
|
63
89
|
return (
|
|
64
90
|
<ConvexProvider client={convex}>
|
|
65
91
|
<ThemeProvider
|
|
@@ -76,6 +102,7 @@ export default function App() {
|
|
|
76
102
|
</ThemeProvider>
|
|
77
103
|
</ConvexProvider>
|
|
78
104
|
);
|
|
105
|
+
{{/if}}
|
|
79
106
|
}
|
|
80
107
|
{{else if (eq api "orpc")}}
|
|
81
108
|
export default function App() {
|
|
@@ -12,7 +12,13 @@ import { routeTree } from "./routeTree.gen";
|
|
|
12
12
|
import { queryClient, trpc } from "./utils/trpc";
|
|
13
13
|
{{/if}}
|
|
14
14
|
{{#if (eq backend "convex")}}
|
|
15
|
-
import {
|
|
15
|
+
import { ConvexReactClient } from "convex/react";
|
|
16
|
+
{{#if (eq auth "clerk")}}
|
|
17
|
+
import { ClerkProvider, useAuth } from "@clerk/clerk-react";
|
|
18
|
+
import { ConvexProviderWithClerk } from "convex/react-clerk";
|
|
19
|
+
{{else}}
|
|
20
|
+
import { ConvexProvider } from "convex/react";
|
|
21
|
+
{{/if}}
|
|
16
22
|
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL as string);
|
|
17
23
|
{{/if}}
|
|
18
24
|
|
|
@@ -41,7 +47,19 @@ const router = createRouter({
|
|
|
41
47
|
{{else if (eq backend "convex")}}
|
|
42
48
|
context: {},
|
|
43
49
|
Wrap: function WrapComponent({ children }: { children: React.ReactNode }) {
|
|
50
|
+
{{#if (eq auth "clerk")}}
|
|
51
|
+
return (
|
|
52
|
+
<ClerkProvider
|
|
53
|
+
publishableKey={import.meta.env.VITE_CLERK_PUBLISHABLE_KEY}
|
|
54
|
+
>
|
|
55
|
+
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
|
|
56
|
+
{children}
|
|
57
|
+
</ConvexProviderWithClerk>
|
|
58
|
+
</ClerkProvider>
|
|
59
|
+
);
|
|
60
|
+
{{else}}
|
|
44
61
|
return <ConvexProvider client={convex}>{children}</ConvexProvider>;
|
|
62
|
+
{{/if}}
|
|
45
63
|
},
|
|
46
64
|
{{else}}
|
|
47
65
|
context: {},
|
|
@@ -3,7 +3,7 @@ import { createRouter as createTanStackRouter } from "@tanstack/react-router";
|
|
|
3
3
|
import { QueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { routerWithQueryClient } from "@tanstack/react-router-with-query";
|
|
5
5
|
import { ConvexQueryClient } from "@convex-dev/react-query";
|
|
6
|
-
import { ConvexProvider } from "convex/react";
|
|
6
|
+
import { ConvexProvider, ConvexReactClient } from "convex/react";
|
|
7
7
|
import { routeTree } from "./routeTree.gen";
|
|
8
8
|
import Loader from "./components/loader";
|
|
9
9
|
import "./index.css";
|
|
@@ -31,7 +31,11 @@ export function createRouter() {
|
|
|
31
31
|
if (!CONVEX_URL) {
|
|
32
32
|
console.error("missing envar VITE_CONVEX_URL");
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const convex = new ConvexReactClient(CONVEX_URL, {
|
|
35
|
+
unsavedChangesWarning: false,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const convexQueryClient = new ConvexQueryClient(convex);
|
|
35
39
|
|
|
36
40
|
const queryClient: QueryClient = new QueryClient({
|
|
37
41
|
defaultOptions: {
|
|
@@ -49,7 +53,7 @@ export function createRouter() {
|
|
|
49
53
|
defaultPreload: "intent",
|
|
50
54
|
defaultPendingComponent: () => <Loader />,
|
|
51
55
|
defaultNotFoundComponent: () => <div>Not Found</div>,
|
|
52
|
-
context: { queryClient },
|
|
56
|
+
context: { queryClient, convexClient: convex, convexQueryClient },
|
|
53
57
|
Wrap: ({ children }) => (
|
|
54
58
|
<ConvexProvider client={convexQueryClient.convexClient}>
|
|
55
59
|
{children}
|
|
@@ -82,7 +86,7 @@ const trpcClient = createTRPCClient<AppRouter>({
|
|
|
82
86
|
links: [
|
|
83
87
|
httpBatchLink({
|
|
84
88
|
url: `${import.meta.env.VITE_SERVER_URL}/trpc`,
|
|
85
|
-
{{#if auth}}
|
|
89
|
+
{{#if (eq auth "better-auth")}}
|
|
86
90
|
fetch(url, options) {
|
|
87
91
|
return fetch(url, {
|
|
88
92
|
...options,
|
|
@@ -8,22 +8,37 @@ import {
|
|
|
8
8
|
Scripts,
|
|
9
9
|
createRootRouteWithContext,
|
|
10
10
|
useRouterState,
|
|
11
|
+
useRouteContext,
|
|
11
12
|
} from "@tanstack/react-router";
|
|
12
13
|
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
|
13
14
|
import Header from "../components/header";
|
|
14
15
|
import appCss from "../index.css?url";
|
|
15
16
|
{{#if (eq backend "convex")}}
|
|
16
17
|
import type { QueryClient } from "@tanstack/react-query";
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
import type { QueryClient } from "@tanstack/react-query";
|
|
20
|
-
{{/unless}}
|
|
18
|
+
import type { ConvexQueryClient } from "@convex-dev/react-query";
|
|
19
|
+
import type { ConvexReactClient } from "convex/react";
|
|
21
20
|
{{/if}}
|
|
22
21
|
import Loader from "@/components/loader";
|
|
23
22
|
|
|
23
|
+
{{#if (and (eq backend "convex") (eq auth "clerk"))}}
|
|
24
|
+
import { ClerkProvider, useAuth } from "@clerk/tanstack-react-start";
|
|
25
|
+
import { getAuth } from "@clerk/tanstack-react-start/server";
|
|
26
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
27
|
+
import { getWebRequest } from "@tanstack/react-start/server";
|
|
28
|
+
import { ConvexProviderWithClerk } from "convex/react-clerk";
|
|
29
|
+
|
|
30
|
+
const fetchClerkAuth = createServerFn({ method: "GET" }).handler(async () => {
|
|
31
|
+
const auth = await getAuth(getWebRequest());
|
|
32
|
+
const token = await auth.getToken({ template: "convex" });
|
|
33
|
+
return { userId: auth.userId, token };
|
|
34
|
+
});
|
|
35
|
+
{{/if}}
|
|
36
|
+
|
|
24
37
|
{{#if (eq backend "convex")}}
|
|
25
38
|
export interface RouterAppContext {
|
|
26
39
|
queryClient: QueryClient;
|
|
40
|
+
convexClient: ConvexReactClient;
|
|
41
|
+
convexQueryClient: ConvexQueryClient;
|
|
27
42
|
}
|
|
28
43
|
{{else}}
|
|
29
44
|
{{#if (eq api "trpc")}}
|
|
@@ -68,11 +83,42 @@ export const Route = createRootRouteWithContext<RouterAppContext>()({
|
|
|
68
83
|
}),
|
|
69
84
|
|
|
70
85
|
component: RootDocument,
|
|
86
|
+
{{#if (and (eq backend "convex") (eq auth "clerk"))}}
|
|
87
|
+
beforeLoad: async (ctx) => {
|
|
88
|
+
const { userId, token } = await fetchClerkAuth();
|
|
89
|
+
if (token) {
|
|
90
|
+
ctx.context.convexQueryClient.serverHttpClient?.setAuth(token);
|
|
91
|
+
}
|
|
92
|
+
return { userId, token };
|
|
93
|
+
},
|
|
94
|
+
{{/if}}
|
|
71
95
|
});
|
|
72
96
|
|
|
73
97
|
function RootDocument() {
|
|
74
98
|
const isFetching = useRouterState({ select: (s) => s.isLoading });
|
|
75
|
-
|
|
99
|
+
{{#if (and (eq backend "convex") (eq auth "clerk"))}}
|
|
100
|
+
const context = useRouteContext({ from: Route.id });
|
|
101
|
+
return (
|
|
102
|
+
<ClerkProvider>
|
|
103
|
+
<ConvexProviderWithClerk client={context.convexClient} useAuth={useAuth}>
|
|
104
|
+
<html lang="en" className="dark">
|
|
105
|
+
<head>
|
|
106
|
+
<HeadContent />
|
|
107
|
+
</head>
|
|
108
|
+
<body>
|
|
109
|
+
<div className="grid h-svh grid-rows-[auto_1fr]">
|
|
110
|
+
<Header />
|
|
111
|
+
{isFetching ? <Loader /> : <Outlet />}
|
|
112
|
+
</div>
|
|
113
|
+
<Toaster richColors />
|
|
114
|
+
<TanStackRouterDevtools position="bottom-left" />
|
|
115
|
+
<Scripts />
|
|
116
|
+
</body>
|
|
117
|
+
</html>
|
|
118
|
+
</ConvexProviderWithClerk>
|
|
119
|
+
</ClerkProvider>
|
|
120
|
+
);
|
|
121
|
+
{{else}}
|
|
76
122
|
return (
|
|
77
123
|
<html lang="en" className="dark">
|
|
78
124
|
<head>
|
|
@@ -94,4 +140,5 @@ function RootDocument() {
|
|
|
94
140
|
</body>
|
|
95
141
|
</html>
|
|
96
142
|
);
|
|
143
|
+
{{/if}}
|
|
97
144
|
}
|
|
@@ -9,14 +9,14 @@ import { Link } from "@tanstack/react-router";
|
|
|
9
9
|
{{#unless (includes frontend "tanstack-start")}}
|
|
10
10
|
import { ModeToggle } from "./mode-toggle";
|
|
11
11
|
{{/unless}}
|
|
12
|
-
{{#if auth}}
|
|
12
|
+
{{#if (eq auth "better-auth")}}
|
|
13
13
|
import UserMenu from "./user-menu";
|
|
14
14
|
{{/if}}
|
|
15
15
|
|
|
16
16
|
export default function Header() {
|
|
17
17
|
const links = [
|
|
18
18
|
{ to: "/", label: "Home" },
|
|
19
|
-
{{#if auth}}
|
|
19
|
+
{{#if (or (eq auth "better-auth") (eq auth "clerk"))}}
|
|
20
20
|
{ to: "/dashboard", label: "Dashboard" },
|
|
21
21
|
{{/if}}
|
|
22
22
|
{{#if (includes examples "todo")}}
|
|
@@ -67,7 +67,7 @@ export default function Header() {
|
|
|
67
67
|
{{#unless (includes frontend "tanstack-start")}}
|
|
68
68
|
<ModeToggle />
|
|
69
69
|
{{/unless}}
|
|
70
|
-
{{#if auth}}
|
|
70
|
+
{{#if (eq auth "better-auth")}}
|
|
71
71
|
<UserMenu />
|
|
72
72
|
{{/if}}
|
|
73
73
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Link } from "@tanstack/solid-router";
|
|
2
|
-
{{#if auth}}
|
|
2
|
+
{{#if (eq auth "better-auth")}}
|
|
3
3
|
import UserMenu from "./user-menu";
|
|
4
4
|
{{/if}}
|
|
5
5
|
import { For } from "solid-js";
|
|
@@ -7,7 +7,7 @@ import { For } from "solid-js";
|
|
|
7
7
|
export default function Header() {
|
|
8
8
|
const links = [
|
|
9
9
|
{ to: "/", label: "Home" },
|
|
10
|
-
{{#if auth}}
|
|
10
|
+
{{#if (eq auth "better-auth")}}
|
|
11
11
|
{ to: "/dashboard", label: "Dashboard" },
|
|
12
12
|
{{/if}}
|
|
13
13
|
{{#if (includes examples "todo")}}
|
|
@@ -27,7 +27,7 @@ export default function Header() {
|
|
|
27
27
|
</For>
|
|
28
28
|
</nav>
|
|
29
29
|
<div class="flex items-center gap-2">
|
|
30
|
-
{{#if auth}}
|
|
30
|
+
{{#if (eq auth "better-auth")}}
|
|
31
31
|
<UserMenu />
|
|
32
32
|
{{/if}}
|
|
33
33
|
</div>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
|
|
3
|
-
{{#if auth}}
|
|
3
|
+
{{#if (eq auth "better-auth")}}
|
|
4
4
|
import UserMenu from './UserMenu.svelte';
|
|
5
5
|
{{/if}}
|
|
6
6
|
const links = [
|
|
7
7
|
{ to: "/", label: "Home" },
|
|
8
|
-
{{#if auth}}
|
|
8
|
+
{{#if (eq auth "better-auth")}}
|
|
9
9
|
{ to: "/dashboard", label: "Dashboard" },
|
|
10
10
|
{{/if}}
|
|
11
11
|
{{#if (includes examples "todo")}}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
{/each}
|
|
32
32
|
</nav>
|
|
33
33
|
<div class="flex items-center gap-2">
|
|
34
|
-
{{#if auth}}
|
|
34
|
+
{{#if (eq auth "better-auth")}}
|
|
35
35
|
<UserMenu />
|
|
36
36
|
{{/if}}
|
|
37
37
|
</div>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This is a temporary wrangler.jsonc file that will be overwritten by alchemy
|
|
2
|
-
// It's only here so that `wrangler dev` can work or use alchemy dev instead
|
|
3
|
-
{
|
|
4
|
-
"name": "{{projectName}}",
|
|
5
|
-
"main": "src/index.ts",
|
|
6
|
-
"compatibility_date": "2025-08-16",
|
|
7
|
-
"compatibility_flags": [
|
|
8
|
-
"nodejs_compat",
|
|
9
|
-
"nodejs_compat_populate_process_env"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/templates/auth/{server → better-auth/server}/db/drizzle/mysql/src/db/schema/auth.ts
RENAMED
|
File without changes
|
/package/templates/auth/{server → better-auth/server}/db/drizzle/postgres/src/db/schema/auth.ts
RENAMED
|
File without changes
|
/package/templates/auth/{server → better-auth/server}/db/drizzle/sqlite/src/db/schema/auth.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/templates/auth/{server → better-auth/server}/db/prisma/mongodb/prisma/schema/auth.prisma
RENAMED
|
File without changes
|
/package/templates/auth/{server → better-auth/server}/db/prisma/mysql/prisma/schema/auth.prisma
RENAMED
|
File without changes
|
/package/templates/auth/{server → better-auth/server}/db/prisma/postgres/prisma/schema/auth.prisma
RENAMED
|
File without changes
|
/package/templates/auth/{server → better-auth/server}/db/prisma/sqlite/prisma/schema/auth.prisma
RENAMED
|
File without changes
|
/package/templates/auth/{server → better-auth/server}/next/src/app/api/auth/[...all]/route.ts
RENAMED
|
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
|
/package/templates/auth/{web → better-auth/web}/react/next/src/components/theme-provider.tsx
RENAMED
|
File without changes
|
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/react-router/src/components/sign-in-form.tsx
RENAMED
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/react-router/src/components/sign-up-form.tsx
RENAMED
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/react-router/src/components/user-menu.tsx
RENAMED
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/react-router/src/routes/dashboard.tsx.hbs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/tanstack-router/src/components/user-menu.tsx
RENAMED
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/tanstack-router/src/routes/dashboard.tsx.hbs
RENAMED
|
File without changes
|
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/components/sign-in-form.tsx
RENAMED
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/components/sign-up-form.tsx
RENAMED
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/components/user-menu.tsx
RENAMED
|
File without changes
|
/package/templates/auth/{web → better-auth/web}/react/tanstack-start/src/routes/dashboard.tsx.hbs
RENAMED
|
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
|
/package/templates/auth/{web → better-auth/web}/svelte/src/routes/dashboard/+page.svelte.hbs
RENAMED
|
File without changes
|
|
File without changes
|