better-ts-stack 2.0.2 → 2.1.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/README.md +114 -113
- package/dist/args.js +27 -20
- package/dist/builder/buildPlanner.js +1 -1
- package/dist/builder/configGenerator.js +4 -6
- package/dist/builder/index.js +15 -3
- package/dist/builder/moduleSelector.js +6 -2
- package/dist/builder/readmeGenerator.js +107 -0
- package/dist/builder/templateContext.js +53 -0
- package/dist/index.js +7 -1
- package/dist/output/nextSteps.js +23 -22
- package/dist/prompts/index.js +5 -2
- package/dist/prompts/stack.js +23 -2
- package/dist/types/index.js +2 -0
- package/dist/ui/messages.js +3 -1
- package/dist/validators/index.js +5 -2
- package/package.json +3 -3
- package/templates/backend/express/config.json +42 -40
- package/templates/backend/express/gitignore +3 -0
- package/templates/backend/express/src/env.ts.hbs +39 -0
- package/templates/backend/express/src/index.ts.hbs +111 -75
- package/templates/backend/nestjs/config.json +43 -41
- package/templates/backend/nestjs/gitignore +3 -0
- package/templates/backend/nestjs/src/app.module.ts.hbs +13 -0
- package/templates/backend/nestjs/src/env.ts.hbs +39 -0
- package/templates/backend/nestjs/src/health/{health.controller.ts → health.controller.ts.hbs} +8 -0
- package/templates/backend/nestjs/src/main.ts +3 -2
- package/templates/frontend/nextjs/app/page.tsx.hbs +98 -97
- package/templates/frontend/nextjs/config.json +12 -14
- package/templates/frontend/nextjs/gitignore +3 -0
- package/templates/frontend/tanstack/config.json +16 -16
- package/templates/frontend/tanstack/gitignore +3 -0
- package/templates/frontend/tanstack/src/routes/index.tsx.hbs +102 -101
- package/templates/frontend/tanstack/vite.config.ts +23 -14
- package/templates/modules/auth/express/config.json +20 -20
- package/templates/modules/auth/express/src/middleware/requireAuth.ts.hbs +1 -2
- package/templates/modules/auth/express/src/routes/auth.ts.hbs +27 -19
- package/templates/modules/auth/nestjs/config.json +20 -20
- package/templates/modules/auth/nestjs/src/auth/{auth.controller.ts → auth.controller.ts.hbs} +15 -0
- package/templates/modules/auth/nextjs/config.json +4 -4
- package/templates/{frontend/nextjs/proxy.ts.hbs → modules/auth/nextjs/proxy.ts} +1 -8
- package/templates/modules/auth/tanstack/config.json +4 -4
- package/templates/modules/auth/tanstack/src/components/auth/sign-in-form.tsx +132 -134
- package/templates/modules/auth/tanstack/src/components/auth/sign-out-button.tsx +46 -48
- package/templates/modules/auth/tanstack/src/components/auth/sign-up-form.tsx +150 -152
- package/templates/modules/ci/.github/workflows/ci.yml.hbs +43 -0
- package/templates/modules/ci/config.json +10 -0
- package/templates/modules/docker/.dockerignore +2 -0
- package/templates/modules/docker/Dockerfile.hbs +147 -136
- package/templates/modules/docker/docker-compose.yml.hbs +97 -2
- package/templates/modules/drizzle/express/config.json +3 -3
- package/templates/modules/drizzle/nestjs/config.json +3 -3
- package/templates/modules/drizzle/nextjs/config.json +3 -3
- package/templates/modules/drizzle/tanstack/config.json +3 -3
- package/templates/modules/mongoose/express/config.json +2 -2
- package/templates/modules/mongoose/nestjs/config.json +1 -1
- package/templates/modules/mongoose/nextjs/config.json +2 -2
- package/templates/modules/mongoose/tanstack/config.json +2 -2
- package/templates/modules/prisma/express/config.json +4 -4
- package/templates/modules/prisma/express/prisma.config.ts +4 -2
- package/templates/modules/prisma/nestjs/config.json +4 -4
- package/templates/modules/prisma/nestjs/prisma.config.ts +4 -2
- package/templates/modules/prisma/nextjs/config.json +4 -4
- package/templates/modules/prisma/nextjs/prisma.config.ts +4 -2
- package/templates/modules/prisma/tanstack/config.json +4 -4
- package/templates/modules/prisma/tanstack/prisma.config.ts +4 -2
- package/templates/modules/rate-limit/express/config.json +12 -0
- package/templates/modules/rate-limit/express/src/middleware/rateLimit.ts +23 -0
- package/templates/modules/rate-limit/nestjs/config.json +12 -0
|
@@ -1,102 +1,103 @@
|
|
|
1
|
-
import { createFileRoute{{#if useAuth}}, Link{{/if}} } from "@tanstack/react-router";
|
|
2
|
-
import { ArrowRight } from "lucide-react";
|
|
3
|
-
|
|
4
|
-
import { buttonVariants } from "~/components/ui/button";
|
|
5
|
-
import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
|
|
6
|
-
import { cn } from "~/lib/utils";
|
|
7
|
-
|
|
8
|
-
export const Route = createFileRoute("/")({
|
|
9
|
-
component: Home,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const featureList = [
|
|
13
|
-
"TanStack Start SSR",
|
|
14
|
-
"TanStack Router and Query",
|
|
15
|
-
"React 19 and TypeScript",
|
|
16
|
-
"Tailwind CSS v4",
|
|
17
|
-
{{#if useAuth}}"Better Auth-ready session flow",{{/if}}
|
|
18
|
-
{{#if (eq database "prisma")}}"Prisma database tooling",{{/if}}
|
|
19
|
-
{{#if (eq database "drizzle")}}"Drizzle database tooling",{{/if}}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<span
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
1
|
+
import { createFileRoute{{#if useAuth}}, Link{{/if}} } from "@tanstack/react-router";
|
|
2
|
+
import { ArrowRight } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
import { buttonVariants } from "~/components/ui/button";
|
|
5
|
+
import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
|
|
6
|
+
import { cn } from "~/lib/utils";
|
|
7
|
+
|
|
8
|
+
export const Route = createFileRoute("/")({
|
|
9
|
+
component: Home,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const featureList = [
|
|
13
|
+
"TanStack Start SSR",
|
|
14
|
+
"TanStack Router and Query",
|
|
15
|
+
"React 19 and TypeScript",
|
|
16
|
+
"Tailwind CSS v4",
|
|
17
|
+
{{#if useAuth}}"Better Auth-ready session flow",{{/if}}
|
|
18
|
+
{{#if (eq database "prisma")}}"Prisma database tooling",{{/if}}
|
|
19
|
+
{{#if (eq database "drizzle")}}"Drizzle database tooling",{{/if}}
|
|
20
|
+
{{#if (eq database "mongoose")}}"Mongoose database tooling",{{/if}}
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
function Home() {
|
|
24
|
+
return (
|
|
25
|
+
<main className="min-h-screen bg-background text-foreground">
|
|
26
|
+
<div className="mx-auto flex min-h-screen max-w-6xl flex-col justify-center gap-12 px-6 py-16 sm:px-10 lg:px-12">
|
|
27
|
+
<section className="grid gap-10 lg:grid-cols-[1.2fr_0.8fr] lg:items-center">
|
|
28
|
+
<div className="space-y-6">
|
|
29
|
+
<span className="inline-flex w-fit items-center rounded-full border border-border bg-card px-3 py-1 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground shadow-sm">
|
|
30
|
+
Created with better-ts-stack
|
|
31
|
+
</span>
|
|
32
|
+
<div className="space-y-4">
|
|
33
|
+
<h1 className="max-w-3xl text-4xl font-semibold tracking-tight sm:text-5xl">
|
|
34
|
+
Ship your stack faster with a polished TypeScript foundation.
|
|
35
|
+
</h1>
|
|
36
|
+
<p className="max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg">
|
|
37
|
+
Your project already includes the core app shell, database wiring,
|
|
38
|
+
and a shadcn-compatible UI foundation so you can keep building
|
|
39
|
+
instead of setting up boilerplate.
|
|
40
|
+
</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div className="flex flex-col gap-3 sm:flex-row">
|
|
43
|
+
{{#if useAuth}}
|
|
44
|
+
<Link
|
|
45
|
+
to="/sign-up"
|
|
46
|
+
className={cn(buttonVariants({ size: "lg" }), "gap-2")}
|
|
47
|
+
>
|
|
48
|
+
Create an account
|
|
49
|
+
<ArrowRight className="size-4" />
|
|
50
|
+
</Link>
|
|
51
|
+
<Link
|
|
52
|
+
to="/sign-in"
|
|
53
|
+
className={buttonVariants({ variant: "outline", size: "lg" })}
|
|
54
|
+
>
|
|
55
|
+
Login
|
|
56
|
+
</Link>
|
|
57
|
+
{{else}}
|
|
58
|
+
<a
|
|
59
|
+
href="https://better-ts-stack.abdullahtech.me/docs"
|
|
60
|
+
target="_blank"
|
|
61
|
+
rel="noreferrer"
|
|
62
|
+
className={cn(buttonVariants({ size: "lg" }), "gap-2")}
|
|
63
|
+
>
|
|
64
|
+
Explore the docs
|
|
65
|
+
<ArrowRight className="size-4" />
|
|
66
|
+
</a>
|
|
67
|
+
<a
|
|
68
|
+
href="https://tanstack.com/start/latest"
|
|
69
|
+
target="_blank"
|
|
70
|
+
rel="noreferrer"
|
|
71
|
+
className={buttonVariants({ variant: "outline", size: "lg" })}
|
|
72
|
+
>
|
|
73
|
+
TanStack guide
|
|
74
|
+
</a>
|
|
75
|
+
{{/if}}
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<Card className="border-border bg-card shadow-sm">
|
|
80
|
+
<CardHeader>
|
|
81
|
+
<CardTitle>Included in this starter</CardTitle>
|
|
82
|
+
</CardHeader>
|
|
83
|
+
<CardContent className="space-y-4">
|
|
84
|
+
<ul className="space-y-3 text-sm text-muted-foreground">
|
|
85
|
+
{featureList.map((feature) => (
|
|
86
|
+
<li key={feature} className="flex items-center gap-3">
|
|
87
|
+
<span className="size-2 rounded-full bg-primary" />
|
|
88
|
+
<span>{feature}</span>
|
|
89
|
+
</li>
|
|
90
|
+
))}
|
|
91
|
+
</ul>
|
|
92
|
+
<div className="rounded-2xl border border-border bg-muted px-4 py-3 text-sm text-muted-foreground">
|
|
93
|
+
Start editing{" "}
|
|
94
|
+
<code className="font-mono">src/routes/index.tsx</code> and
|
|
95
|
+
shape the project around your product instead of setup chores.
|
|
96
|
+
</div>
|
|
97
|
+
</CardContent>
|
|
98
|
+
</Card>
|
|
99
|
+
</section>
|
|
100
|
+
</div>
|
|
101
|
+
</main>
|
|
102
|
+
);
|
|
102
103
|
}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
2
|
-
import tailwindcss from "@tailwindcss/vite";
|
|
3
|
-
import viteReact from "@vitejs/plugin-react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
2
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
3
|
+
import viteReact from "@vitejs/plugin-react";
|
|
4
|
+
import { nitro } from "nitro/vite";
|
|
5
|
+
import { defineConfig } from "vite";
|
|
6
|
+
|
|
7
|
+
export default defineConfig(({ command, isPreview }) => ({
|
|
8
|
+
server: {
|
|
9
|
+
port: 3000,
|
|
10
|
+
},
|
|
11
|
+
resolve: {
|
|
12
|
+
tsconfigPaths: true,
|
|
13
|
+
},
|
|
14
|
+
plugins: [
|
|
15
|
+
tanstackStart({ srcDirectory: "src" }),
|
|
16
|
+
tailwindcss(),
|
|
17
|
+
viteReact(),
|
|
18
|
+
// Nitro builds the production server in .output/ (run with node) and serves
|
|
19
|
+
// it for `vite preview`. It is left out of `vite dev`, where TanStack Start's
|
|
20
|
+
// own dev server is steadier
|
|
21
|
+
(command === "build" || isPreview) && nitro(),
|
|
22
|
+
],
|
|
23
|
+
}));
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "auth",
|
|
3
|
-
"name": "JWT Auth",
|
|
4
|
-
"description": "JWT authentication with bcrypt password hashing",
|
|
5
|
-
"type": "feature",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"bcrypt": "^6.0.0",
|
|
8
|
-
"jsonwebtoken": "^9.0.3",
|
|
9
|
-
"zod": "^4.6.
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@types/bcrypt": "^6.0.0",
|
|
13
|
-
"@types/jsonwebtoken": "^9.0.10"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {},
|
|
16
|
-
"envVars": {
|
|
17
|
-
"JWT_SECRET": "please-change-me",
|
|
18
|
-
"JWT_EXPIRES_IN": "1h"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "auth",
|
|
3
|
+
"name": "JWT Auth",
|
|
4
|
+
"description": "JWT authentication with bcrypt password hashing",
|
|
5
|
+
"type": "feature",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"bcrypt": "^6.0.0",
|
|
8
|
+
"jsonwebtoken": "^9.0.3",
|
|
9
|
+
"zod": "^4.6.7"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@types/bcrypt": "^6.0.0",
|
|
13
|
+
"@types/jsonwebtoken": "^9.0.10"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {},
|
|
16
|
+
"envVars": {
|
|
17
|
+
"JWT_SECRET": "please-change-me",
|
|
18
|
+
"JWT_EXPIRES_IN": "1h"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -19,8 +19,7 @@ export function requireAuth(req: AuthenticatedRequest, res: Response, next: Next
|
|
|
19
19
|
const payload = verifyToken(token);
|
|
20
20
|
req.user = payload;
|
|
21
21
|
next();
|
|
22
|
-
} catch
|
|
23
|
-
console.error('JWT verification failed:', error);
|
|
22
|
+
} catch {
|
|
24
23
|
res.status(401).json({ error: 'Invalid or expired token' });
|
|
25
24
|
}
|
|
26
25
|
}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import { Request, Response, NextFunction, Router } from 'express';
|
|
2
|
-
import { login, me, register } from '../controllers/authController';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { Request, Response, NextFunction, Router } from 'express';
|
|
2
|
+
import { login, me, register } from '../controllers/authController';
|
|
3
|
+
{{#if useRateLimit}}
|
|
4
|
+
import { authLimiter } from '../middleware/rateLimit';
|
|
5
|
+
{{/if}}
|
|
6
|
+
import { requireAuth } from '../middleware/requireAuth';
|
|
7
|
+
|
|
8
|
+
const router: Router = Router();
|
|
9
|
+
|
|
10
|
+
function asyncHandler(
|
|
11
|
+
fn: (req: Request, res: Response, next: NextFunction) => Promise<void>
|
|
12
|
+
): (req: Request, res: Response, next: NextFunction) => void {
|
|
13
|
+
return (req, res, next) => {
|
|
14
|
+
void fn(req, res, next).catch(next);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
{{#if useRateLimit}}
|
|
19
|
+
router.post('/register', authLimiter, asyncHandler(register));
|
|
20
|
+
router.post('/login', authLimiter, asyncHandler(login));
|
|
21
|
+
{{else}}
|
|
22
|
+
router.post('/register', asyncHandler(register));
|
|
23
|
+
router.post('/login', asyncHandler(login));
|
|
24
|
+
{{/if}}
|
|
25
|
+
router.get('/me', requireAuth, me);
|
|
26
|
+
|
|
27
|
+
export default router;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "auth",
|
|
3
|
-
"name": "JWT Auth",
|
|
4
|
-
"description": "JWT authentication for NestJS with bcrypt password hashing",
|
|
5
|
-
"type": "feature",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"bcrypt": "^6.0.0",
|
|
8
|
-
"jsonwebtoken": "^9.0.3",
|
|
9
|
-
"zod": "^4.6.
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@types/bcrypt": "^6.0.0",
|
|
13
|
-
"@types/jsonwebtoken": "^9.0.10"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {},
|
|
16
|
-
"envVars": {
|
|
17
|
-
"JWT_SECRET": "please-change-me",
|
|
18
|
-
"JWT_EXPIRES_IN": "1h"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "auth",
|
|
3
|
+
"name": "JWT Auth",
|
|
4
|
+
"description": "JWT authentication for NestJS with bcrypt password hashing",
|
|
5
|
+
"type": "feature",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"bcrypt": "^6.0.0",
|
|
8
|
+
"jsonwebtoken": "^9.0.3",
|
|
9
|
+
"zod": "^4.6.7"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@types/bcrypt": "^6.0.0",
|
|
13
|
+
"@types/jsonwebtoken": "^9.0.10"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {},
|
|
16
|
+
"envVars": {
|
|
17
|
+
"JWT_SECRET": "please-change-me",
|
|
18
|
+
"JWT_EXPIRES_IN": "1h"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/templates/modules/auth/nestjs/src/auth/{auth.controller.ts → auth.controller.ts.hbs}
RENAMED
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
Req,
|
|
8
8
|
UseGuards,
|
|
9
9
|
} from "@nestjs/common";
|
|
10
|
+
{{#if useRateLimit}}
|
|
11
|
+
import { Throttle } from "@nestjs/throttler";
|
|
12
|
+
{{/if}}
|
|
10
13
|
|
|
11
14
|
import { type AuthenticatedRequest, AuthGuard } from "./auth.guard.js";
|
|
12
15
|
import {
|
|
@@ -19,11 +22,20 @@ import { type AuthResponse, AuthService } from "./auth.service.js";
|
|
|
19
22
|
import type { AuthTokenPayload } from "./jwt.js";
|
|
20
23
|
import { ZodValidationPipe } from "./zod-validation.pipe.js";
|
|
21
24
|
|
|
25
|
+
{{#if useRateLimit}}
|
|
26
|
+
// Sign-up and login: 10 attempts per client IP in 15 minutes, against
|
|
27
|
+
// password guessing
|
|
28
|
+
const AUTH_LIMIT = { default: { ttl: 15 * 60 * 1000, limit: 10 } };
|
|
29
|
+
|
|
30
|
+
{{/if}}
|
|
22
31
|
@Controller("auth")
|
|
23
32
|
export class AuthController {
|
|
24
33
|
constructor(private readonly authService: AuthService) {}
|
|
25
34
|
|
|
26
35
|
@Post("register")
|
|
36
|
+
{{#if useRateLimit}}
|
|
37
|
+
@Throttle(AUTH_LIMIT)
|
|
38
|
+
{{/if}}
|
|
27
39
|
register(
|
|
28
40
|
@Body(new ZodValidationPipe(registerSchema)) body: RegisterInput
|
|
29
41
|
): Promise<AuthResponse> {
|
|
@@ -32,6 +44,9 @@ export class AuthController {
|
|
|
32
44
|
|
|
33
45
|
@Post("login")
|
|
34
46
|
@HttpCode(200)
|
|
47
|
+
{{#if useRateLimit}}
|
|
48
|
+
@Throttle(AUTH_LIMIT)
|
|
49
|
+
{{/if}}
|
|
35
50
|
login(
|
|
36
51
|
@Body(new ZodValidationPipe(loginSchema)) body: LoginInput
|
|
37
52
|
): Promise<AuthResponse> {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"description": "Better Auth for Next.js with optional Prisma or Drizzle adapter",
|
|
5
5
|
"type": "feature",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@hookform/resolvers": "^5.9.
|
|
8
|
-
"better-auth": "^1.7.
|
|
9
|
-
"react-hook-form": "^7.
|
|
10
|
-
"zod": "^4.6.
|
|
7
|
+
"@hookform/resolvers": "^5.9.2",
|
|
8
|
+
"better-auth": "^1.7.14",
|
|
9
|
+
"react-hook-form": "^7.91.0",
|
|
10
|
+
"zod": "^4.6.7"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {},
|
|
13
13
|
"scripts": {},
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import { getSessionCookie } from "better-auth/cookies";
|
|
1
2
|
import { NextResponse } from "next/server";
|
|
2
|
-
|
|
3
|
-
{{#if useAuth}}
|
|
4
3
|
import type { NextRequest } from "next/server";
|
|
5
|
-
import { getSessionCookie } from "better-auth/cookies";
|
|
6
4
|
|
|
7
5
|
export function proxy(request: NextRequest) {
|
|
8
6
|
const sessionCookie = getSessionCookie(request);
|
|
@@ -17,8 +15,3 @@ export function proxy(request: NextRequest) {
|
|
|
17
15
|
export const config = {
|
|
18
16
|
matcher: ["/dashboard/:path*"],
|
|
19
17
|
};
|
|
20
|
-
{{else}}
|
|
21
|
-
export function proxy() {
|
|
22
|
-
return NextResponse.next();
|
|
23
|
-
}
|
|
24
|
-
{{/if}}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"description": "Better Auth for TanStack Start with optional Prisma, Drizzle, or MongoDB adapter",
|
|
5
5
|
"type": "feature",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@hookform/resolvers": "^5.9.
|
|
8
|
-
"better-auth": "^1.7.
|
|
7
|
+
"@hookform/resolvers": "^5.9.2",
|
|
8
|
+
"better-auth": "^1.7.14",
|
|
9
9
|
"dotenv": "^17.4.2",
|
|
10
|
-
"react-hook-form": "^7.
|
|
11
|
-
"zod": "^4.6.
|
|
10
|
+
"react-hook-form": "^7.91.0",
|
|
11
|
+
"zod": "^4.6.7"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {},
|
|
14
14
|
"scripts": {},
|