better-ts-stack 2.1.1 → 2.2.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/LICENSE +21 -21
- package/README.md +16 -8
- package/dist/args.js +7 -0
- package/dist/builder/buildPlanner.js +7 -1
- package/dist/builder/configGenerator.js +28 -3
- package/dist/builder/index.js +2 -1
- package/dist/builder/moduleSelector.js +6 -1
- package/dist/builder/readmeGenerator.js +8 -2
- package/dist/builder/templateContext.js +1 -0
- package/dist/output/nextSteps.js +2 -4
- package/dist/prompts/stack.js +6 -1
- package/dist/types/index.js +2 -0
- package/dist/ui/messages.js +2 -0
- package/package.json +71 -71
- package/templates/backend/express/.prettierignore +52 -52
- package/templates/backend/express/.prettierrc +16 -16
- package/templates/backend/express/gitignore +3 -1
- package/templates/backend/express/src/env.ts.hbs +13 -2
- package/templates/backend/express/src/index.ts.hbs +31 -2
- package/templates/backend/express/tsconfig.eslint.json +9 -9
- package/templates/backend/nestjs/.prettierignore +52 -52
- package/templates/backend/nestjs/gitignore +3 -1
- package/templates/backend/nestjs/src/app.module.ts.hbs +4 -1
- package/templates/backend/nestjs/src/env.ts.hbs +13 -2
- package/templates/backend/nestjs/src/health/health.controller.ts.hbs +7 -0
- package/templates/backend/nestjs/src/{main.ts → main.ts.hbs} +11 -0
- package/templates/backend/nestjs/tsconfig.eslint.json +9 -9
- package/templates/frontend/nextjs/app/globals.css +129 -89
- package/templates/frontend/nextjs/app/layout.tsx +36 -34
- package/templates/frontend/nextjs/app/page.tsx.hbs +63 -43
- package/templates/frontend/nextjs/components/ui/alert.tsx +75 -0
- package/templates/frontend/nextjs/components/ui/badge.tsx +51 -0
- package/templates/frontend/nextjs/components/ui/button.tsx +57 -51
- package/templates/frontend/nextjs/components/ui/card.tsx +102 -60
- package/templates/frontend/nextjs/components/ui/field.tsx +238 -67
- package/templates/frontend/nextjs/components/ui/input.tsx +19 -18
- package/templates/frontend/nextjs/components/ui/label.tsx +19 -0
- package/templates/frontend/nextjs/components/ui/separator.tsx +24 -0
- package/templates/frontend/nextjs/components/ui/skeleton.tsx +13 -0
- package/templates/frontend/nextjs/components/ui/spinner.tsx +10 -0
- package/templates/frontend/nextjs/components.json +11 -5
- package/templates/frontend/nextjs/config.json +36 -35
- package/templates/frontend/nextjs/eslint.config.mjs +11 -11
- package/templates/frontend/nextjs/lib/utils.ts +1 -6
- package/templates/frontend/nextjs/next.config.ts.hbs +12 -12
- package/templates/frontend/nextjs/postcss.config.mjs +7 -7
- package/templates/frontend/nextjs/public/file.svg +1 -1
- package/templates/frontend/nextjs/public/globe.svg +1 -1
- package/templates/frontend/nextjs/public/window.svg +1 -1
- package/templates/frontend/tanstack/components.json +25 -18
- package/templates/frontend/tanstack/config.json +5 -2
- package/templates/frontend/tanstack/eslint.config.mjs +23 -23
- package/templates/frontend/tanstack/gitignore +39 -39
- package/templates/frontend/tanstack/public/favicon.svg +7 -7
- package/templates/frontend/tanstack/src/components/ui/alert.tsx +75 -0
- package/templates/frontend/tanstack/src/components/ui/badge.tsx +51 -0
- package/templates/frontend/tanstack/src/components/ui/button.tsx +57 -51
- package/templates/frontend/tanstack/src/components/ui/card.tsx +102 -60
- package/templates/frontend/tanstack/src/components/ui/field.tsx +236 -67
- package/templates/frontend/tanstack/src/components/ui/input.tsx +19 -18
- package/templates/frontend/tanstack/src/components/ui/label.tsx +17 -0
- package/templates/frontend/tanstack/src/components/ui/separator.tsx +24 -0
- package/templates/frontend/tanstack/src/components/ui/skeleton.tsx +13 -0
- package/templates/frontend/tanstack/src/components/ui/spinner.tsx +10 -0
- package/templates/frontend/tanstack/src/lib/utils.ts +1 -6
- package/templates/frontend/tanstack/src/router.tsx +31 -31
- package/templates/frontend/tanstack/src/routes/__root.tsx +69 -69
- package/templates/frontend/tanstack/src/routes/index.tsx.hbs +64 -45
- package/templates/frontend/tanstack/src/styles/app.css +100 -55
- package/templates/frontend/tanstack/tsconfig.json +22 -22
- package/templates/modules/agents/AGENTS.md.hbs +245 -0
- package/templates/modules/agents/CLAUDE.md +1 -0
- package/templates/modules/agents/config.json +10 -0
- package/templates/modules/auth/express/config.json +12 -11
- package/templates/modules/auth/express/src/lib/auth.ts.hbs +143 -0
- package/templates/modules/auth/express/src/lib/email.ts +37 -0
- package/templates/modules/auth/express/src/middleware/requireAuth.ts +29 -0
- package/templates/modules/auth/express/src/routes/me.ts +13 -0
- package/templates/modules/auth/nestjs/config.json +13 -11
- package/templates/modules/auth/nestjs/src/auth/auth.module.ts.hbs +64 -14
- package/templates/modules/auth/nestjs/src/auth/auth.ts.hbs +152 -0
- package/templates/modules/auth/nestjs/src/auth/email.ts +37 -0
- package/templates/modules/auth/nestjs/src/me/me.controller.ts +15 -0
- package/templates/modules/auth/nextjs/app/api/auth/[...all]/route.ts +4 -4
- package/templates/modules/auth/nextjs/app/dashboard/page.tsx +101 -45
- package/templates/modules/auth/nextjs/app/forgot-password/page.tsx +11 -0
- package/templates/modules/auth/nextjs/app/reset-password/page.tsx +17 -0
- package/templates/modules/auth/nextjs/app/sign-in/page.tsx +23 -17
- package/templates/modules/auth/nextjs/app/sign-up/page.tsx +25 -19
- package/templates/modules/auth/nextjs/components/auth/change-password-form.tsx +125 -0
- package/templates/modules/auth/nextjs/components/auth/email-verification-card.tsx +91 -0
- package/templates/modules/auth/nextjs/components/auth/forgot-password-form.tsx +133 -0
- package/templates/modules/auth/nextjs/components/auth/reset-password-form.tsx +155 -0
- package/templates/modules/auth/nextjs/components/auth/sign-in-form.tsx +46 -32
- package/templates/modules/auth/nextjs/components/auth/sign-out-button.tsx +6 -5
- package/templates/modules/auth/nextjs/components/auth/sign-up-form.tsx +36 -30
- package/templates/modules/auth/nextjs/components/auth/social-buttons.tsx +73 -0
- package/templates/modules/auth/nextjs/config.json +24 -18
- package/templates/modules/auth/nextjs/lib/auth-client.ts +3 -3
- package/templates/modules/auth/nextjs/lib/auth-schema.ts +27 -2
- package/templates/modules/auth/nextjs/lib/auth.ts.hbs +65 -0
- package/templates/modules/auth/nextjs/lib/email.ts +43 -0
- package/templates/modules/auth/nextjs/lib/session.ts +12 -0
- package/templates/modules/auth/tanstack/config.json +25 -19
- package/templates/modules/auth/tanstack/src/components/auth/change-password-form.tsx +123 -0
- package/templates/modules/auth/tanstack/src/components/auth/email-verification-card.tsx +89 -0
- package/templates/modules/auth/tanstack/src/components/auth/forgot-password-form.tsx +131 -0
- package/templates/modules/auth/tanstack/src/components/auth/reset-password-form.tsx +149 -0
- package/templates/modules/auth/tanstack/src/components/auth/sign-in-form.tsx +44 -35
- package/templates/modules/auth/tanstack/src/components/auth/sign-out-button.tsx +7 -6
- package/templates/modules/auth/tanstack/src/components/auth/sign-up-form.tsx +37 -34
- package/templates/modules/auth/tanstack/src/components/auth/social-buttons.tsx +71 -0
- package/templates/modules/auth/tanstack/src/lib/auth-client.ts +2 -2
- package/templates/modules/auth/tanstack/src/lib/auth-functions.ts +14 -8
- package/templates/modules/auth/tanstack/src/lib/auth-schema.ts +27 -2
- package/templates/modules/auth/tanstack/src/lib/auth.ts.hbs +98 -38
- package/templates/modules/auth/tanstack/src/lib/email.ts +43 -0
- package/templates/modules/auth/tanstack/src/routeTree.gen.ts +61 -3
- package/templates/modules/auth/tanstack/src/routes/api/auth/$.ts +15 -15
- package/templates/modules/auth/tanstack/src/routes/dashboard.tsx +119 -111
- package/templates/modules/auth/tanstack/src/routes/forgot-password.tsx +17 -0
- package/templates/modules/auth/tanstack/src/routes/reset-password.tsx +25 -0
- package/templates/modules/auth/tanstack/src/routes/sign-in.tsx +44 -37
- package/templates/modules/auth/tanstack/src/routes/sign-up.tsx +44 -37
- package/templates/modules/docker/.dockerignore +2 -0
- package/templates/modules/docker/config.json +15 -15
- package/templates/modules/drizzle/express/config.json +26 -26
- package/templates/modules/drizzle/express/src/lib/schema.ts.hbs +90 -0
- package/templates/modules/drizzle/nestjs/config.json +26 -26
- package/templates/modules/drizzle/nestjs/src/database/schema.ts.hbs +90 -0
- package/templates/modules/drizzle/nextjs/config.json +26 -26
- package/templates/modules/drizzle/nextjs/drizzle.config.ts +13 -13
- package/templates/modules/drizzle/tanstack/config.json +26 -26
- package/templates/modules/drizzle/tanstack/drizzle.config.ts +12 -12
- package/templates/modules/drizzle/tanstack/src/lib/db.ts +13 -13
- package/templates/modules/mongoose/express/config.json +15 -15
- package/templates/modules/mongoose/express/src/lib/db.ts +43 -43
- package/templates/modules/mongoose/express/src/models/User.ts +48 -48
- package/templates/modules/mongoose/nestjs/config.json +16 -15
- package/templates/modules/mongoose/nextjs/config.json +15 -15
- package/templates/modules/mongoose/nextjs/models/User.ts +48 -48
- package/templates/modules/mongoose/tanstack/config.json +16 -16
- package/templates/modules/mongoose/tanstack/src/models/User.ts +48 -48
- package/templates/modules/prisma/express/config.json +27 -27
- package/templates/modules/prisma/express/prisma/schema.prisma.hbs +92 -0
- package/templates/modules/prisma/nestjs/config.json +27 -27
- package/templates/modules/prisma/nestjs/prisma/schema.prisma.hbs +91 -0
- package/templates/modules/prisma/nextjs/config.json +28 -28
- package/templates/modules/prisma/nextjs/lib/prisma.ts +18 -18
- package/templates/modules/prisma/nextjs/prisma.config.ts +14 -14
- package/templates/modules/prisma/tanstack/config.json +28 -28
- package/templates/modules/prisma/tanstack/prisma/schema.prisma.hbs +91 -91
- package/templates/modules/prisma/tanstack/prisma.config.ts +14 -14
- package/templates/modules/prisma/tanstack/src/lib/prisma.ts +17 -17
- package/templates/modules/rate-limit/express/src/middleware/rateLimit.ts +0 -8
- package/templates/modules/vscode/.vscode/extensions.json.hbs +29 -0
- package/templates/modules/vscode/.vscode/settings.json.hbs +22 -0
- package/templates/modules/vscode/config.json +10 -0
- package/templates/modules/auth/express/src/controllers/authController.ts.hbs +0 -116
- package/templates/modules/auth/express/src/lib/jwt.ts.hbs +0 -27
- package/templates/modules/auth/express/src/middleware/requireAuth.ts.hbs +0 -25
- package/templates/modules/auth/express/src/routes/auth.ts.hbs +0 -27
- package/templates/modules/auth/express/src/services/userStore.ts.hbs +0 -117
- package/templates/modules/auth/nestjs/src/auth/auth.controller.ts.hbs +0 -61
- package/templates/modules/auth/nestjs/src/auth/auth.guard.ts +0 -36
- package/templates/modules/auth/nestjs/src/auth/auth.schemas.ts +0 -35
- package/templates/modules/auth/nestjs/src/auth/auth.service.ts +0 -70
- package/templates/modules/auth/nestjs/src/auth/jwt.ts +0 -27
- package/templates/modules/auth/nestjs/src/auth/users.service.ts.hbs +0 -144
- package/templates/modules/auth/nestjs/src/auth/zod-validation.pipe.ts +0 -16
- package/templates/modules/drizzle/express/src/lib/schema.ts +0 -12
- package/templates/modules/drizzle/nestjs/src/database/schema.ts +0 -12
- package/templates/modules/prisma/express/prisma/schema.prisma +0 -24
- package/templates/modules/prisma/nestjs/prisma/schema.prisma +0 -23
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
import { createFileRoute, redirect } from "@tanstack/react-router";
|
|
2
|
-
|
|
3
|
-
import { SignInForm } from "~/components/auth/sign-in-form";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { createFileRoute, redirect } from "@tanstack/react-router";
|
|
2
|
+
|
|
3
|
+
import { SignInForm } from "~/components/auth/sign-in-form";
|
|
4
|
+
import { Badge } from "~/components/ui/badge";
|
|
5
|
+
import { getSession, getSocialProviders } from "~/lib/auth-functions";
|
|
6
|
+
|
|
7
|
+
export const Route = createFileRoute("/sign-in")({
|
|
8
|
+
beforeLoad: async () => {
|
|
9
|
+
// Two independent server calls, made at the same time
|
|
10
|
+
const [session, providers] = await Promise.all([
|
|
11
|
+
getSession(),
|
|
12
|
+
getSocialProviders(),
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
if (session) {
|
|
16
|
+
throw redirect({ to: "/dashboard" });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return { providers };
|
|
20
|
+
},
|
|
21
|
+
component: SignInPage,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function SignInPage() {
|
|
25
|
+
return (
|
|
26
|
+
<main className="flex min-h-svh items-center justify-center bg-muted p-6 md:p-10">
|
|
27
|
+
<div className="grid w-full max-w-5xl items-center gap-12 lg:grid-cols-[0.9fr_1.1fr]">
|
|
28
|
+
<section className="hidden flex-col gap-5 lg:flex">
|
|
29
|
+
<Badge variant="outline">Better Auth</Badge>
|
|
30
|
+
<h1 className="text-4xl font-semibold tracking-tight">
|
|
31
|
+
Welcome back.
|
|
32
|
+
</h1>
|
|
33
|
+
<p className="max-w-md text-base leading-7 text-muted-foreground">
|
|
34
|
+
This generated starter includes protected routes, session-aware page
|
|
35
|
+
guards, and reusable auth form primitives you can extend from here.
|
|
36
|
+
</p>
|
|
37
|
+
</section>
|
|
38
|
+
<SignInForm
|
|
39
|
+
providers={Route.useRouteContext({ select: (ctx) => ctx.providers })}
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</main>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
import { createFileRoute, redirect } from "@tanstack/react-router";
|
|
2
|
-
|
|
3
|
-
import { SignUpForm } from "~/components/auth/sign-up-form";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { createFileRoute, redirect } from "@tanstack/react-router";
|
|
2
|
+
|
|
3
|
+
import { SignUpForm } from "~/components/auth/sign-up-form";
|
|
4
|
+
import { Badge } from "~/components/ui/badge";
|
|
5
|
+
import { getSession, getSocialProviders } from "~/lib/auth-functions";
|
|
6
|
+
|
|
7
|
+
export const Route = createFileRoute("/sign-up")({
|
|
8
|
+
beforeLoad: async () => {
|
|
9
|
+
// Two independent server calls, made at the same time
|
|
10
|
+
const [session, providers] = await Promise.all([
|
|
11
|
+
getSession(),
|
|
12
|
+
getSocialProviders(),
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
if (session) {
|
|
16
|
+
throw redirect({ to: "/dashboard" });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return { providers };
|
|
20
|
+
},
|
|
21
|
+
component: SignUpPage,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function SignUpPage() {
|
|
25
|
+
return (
|
|
26
|
+
<main className="flex min-h-svh items-center justify-center bg-muted p-6 md:p-10">
|
|
27
|
+
<div className="grid w-full max-w-5xl items-center gap-12 lg:grid-cols-[0.9fr_1.1fr]">
|
|
28
|
+
<section className="hidden flex-col gap-5 lg:flex">
|
|
29
|
+
<Badge variant="outline">Better Auth</Badge>
|
|
30
|
+
<h1 className="text-4xl font-semibold tracking-tight">
|
|
31
|
+
Create your account.
|
|
32
|
+
</h1>
|
|
33
|
+
<p className="max-w-md text-base leading-7 text-muted-foreground">
|
|
34
|
+
Sign up with email and password, or with GitHub or Google once
|
|
35
|
+
their keys are set. A verification link goes to your inbox.
|
|
36
|
+
</p>
|
|
37
|
+
</section>
|
|
38
|
+
<SignUpForm
|
|
39
|
+
providers={Route.useRouteContext({ select: (ctx) => ctx.providers })}
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</main>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "docker",
|
|
3
|
-
"name": "Docker",
|
|
4
|
-
"description": "Docker containerization with multi-stage build and docker-compose",
|
|
5
|
-
"type": "feature",
|
|
6
|
-
"dependencies": {},
|
|
7
|
-
"devDependencies": {},
|
|
8
|
-
"scripts": {
|
|
9
|
-
"docker:build": "docker build -t {{projectName}} .",
|
|
10
|
-
"docker:up": "docker compose up -d --build",
|
|
11
|
-
"docker:down": "docker compose down",
|
|
12
|
-
"docker:logs": "docker compose logs -f"
|
|
13
|
-
},
|
|
14
|
-
"envVars": {}
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "docker",
|
|
3
|
+
"name": "Docker",
|
|
4
|
+
"description": "Docker containerization with multi-stage build and docker-compose",
|
|
5
|
+
"type": "feature",
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"devDependencies": {},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"docker:build": "docker build -t {{projectName}} .",
|
|
10
|
+
"docker:up": "docker compose up -d --build",
|
|
11
|
+
"docker:down": "docker compose down",
|
|
12
|
+
"docker:logs": "docker compose logs -f"
|
|
13
|
+
},
|
|
14
|
+
"envVars": {}
|
|
15
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "drizzle",
|
|
3
|
-
"name": "Drizzle ORM",
|
|
4
|
-
"description": "Drizzle ORM for Express with PostgreSQL",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"drizzle-orm": "^0.45.4",
|
|
8
|
-
"pg": "^8.23.1",
|
|
9
|
-
"dotenv": "^17.4.2"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"drizzle-kit": "^0.31.11",
|
|
13
|
-
"@types/pg": "^8.23.1"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"db:generate": "drizzle-kit generate",
|
|
17
|
-
"db:migrate": "drizzle-kit migrate",
|
|
18
|
-
"db:studio": "drizzle-kit studio"
|
|
19
|
-
},
|
|
20
|
-
"envVars": {
|
|
21
|
-
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
22
|
-
},
|
|
23
|
-
"overrides": {
|
|
24
|
-
"esbuild": "^0.28.2"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "drizzle",
|
|
3
|
+
"name": "Drizzle ORM",
|
|
4
|
+
"description": "Drizzle ORM for Express with PostgreSQL",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"drizzle-orm": "^0.45.4",
|
|
8
|
+
"pg": "^8.23.1",
|
|
9
|
+
"dotenv": "^17.4.2"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"drizzle-kit": "^0.31.11",
|
|
13
|
+
"@types/pg": "^8.23.1"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"db:generate": "drizzle-kit generate",
|
|
17
|
+
"db:migrate": "drizzle-kit migrate",
|
|
18
|
+
"db:studio": "drizzle-kit studio"
|
|
19
|
+
},
|
|
20
|
+
"envVars": {
|
|
21
|
+
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
22
|
+
},
|
|
23
|
+
"overrides": {
|
|
24
|
+
"esbuild": "^0.28.2"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{{#if useAuth}}
|
|
2
|
+
import { boolean, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
3
|
+
|
|
4
|
+
export const user = pgTable("user", {
|
|
5
|
+
id: text("id").primaryKey(),
|
|
6
|
+
name: text("name").notNull(),
|
|
7
|
+
email: text("email").notNull().unique(),
|
|
8
|
+
emailVerified: boolean("email_verified").notNull().default(false),
|
|
9
|
+
image: text("image"),
|
|
10
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
11
|
+
.notNull()
|
|
12
|
+
.defaultNow(),
|
|
13
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
14
|
+
.notNull()
|
|
15
|
+
.defaultNow()
|
|
16
|
+
.$onUpdate(() => new Date()),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const session = pgTable("session", {
|
|
20
|
+
id: text("id").primaryKey(),
|
|
21
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
22
|
+
token: text("token").notNull().unique(),
|
|
23
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
24
|
+
.notNull()
|
|
25
|
+
.defaultNow(),
|
|
26
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
27
|
+
.notNull()
|
|
28
|
+
.defaultNow()
|
|
29
|
+
.$onUpdate(() => new Date()),
|
|
30
|
+
ipAddress: text("ip_address"),
|
|
31
|
+
userAgent: text("user_agent"),
|
|
32
|
+
userId: text("user_id")
|
|
33
|
+
.notNull()
|
|
34
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const account = pgTable("account", {
|
|
38
|
+
id: text("id").primaryKey(),
|
|
39
|
+
accountId: text("account_id").notNull(),
|
|
40
|
+
providerId: text("provider_id").notNull(),
|
|
41
|
+
userId: text("user_id")
|
|
42
|
+
.notNull()
|
|
43
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
44
|
+
accessToken: text("access_token"),
|
|
45
|
+
refreshToken: text("refresh_token"),
|
|
46
|
+
idToken: text("id_token"),
|
|
47
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at", {
|
|
48
|
+
withTimezone: true,
|
|
49
|
+
}),
|
|
50
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at", {
|
|
51
|
+
withTimezone: true,
|
|
52
|
+
}),
|
|
53
|
+
scope: text("scope"),
|
|
54
|
+
password: text("password"),
|
|
55
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
56
|
+
.notNull()
|
|
57
|
+
.defaultNow(),
|
|
58
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
59
|
+
.notNull()
|
|
60
|
+
.defaultNow()
|
|
61
|
+
.$onUpdate(() => new Date()),
|
|
62
|
+
}, (table) => [uniqueIndex("account_provider_account_id_unique").on(table.providerId, table.accountId)]);
|
|
63
|
+
|
|
64
|
+
export const verification = pgTable("verification", {
|
|
65
|
+
id: text("id").primaryKey(),
|
|
66
|
+
identifier: text("identifier").notNull(),
|
|
67
|
+
value: text("value").notNull(),
|
|
68
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
69
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
70
|
+
.notNull()
|
|
71
|
+
.defaultNow(),
|
|
72
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
73
|
+
.notNull()
|
|
74
|
+
.defaultNow()
|
|
75
|
+
.$onUpdate(() => new Date()),
|
|
76
|
+
});
|
|
77
|
+
{{else}}
|
|
78
|
+
import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
|
79
|
+
|
|
80
|
+
export const users = pgTable("users", {
|
|
81
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
82
|
+
email: text("email").notNull().unique(),
|
|
83
|
+
name: text("name"),
|
|
84
|
+
password: text("password").notNull(),
|
|
85
|
+
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
|
86
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
87
|
+
.defaultNow()
|
|
88
|
+
.$onUpdate(() => new Date()),
|
|
89
|
+
});
|
|
90
|
+
{{/if}}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "drizzle",
|
|
3
|
-
"name": "Drizzle ORM",
|
|
4
|
-
"description": "Drizzle ORM for NestJS with PostgreSQL",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"drizzle-orm": "^0.45.4",
|
|
8
|
-
"pg": "^8.23.1",
|
|
9
|
-
"dotenv": "^17.4.2"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"drizzle-kit": "^0.31.11",
|
|
13
|
-
"@types/pg": "^8.23.1"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"db:generate": "drizzle-kit generate",
|
|
17
|
-
"db:migrate": "drizzle-kit migrate",
|
|
18
|
-
"db:studio": "drizzle-kit studio"
|
|
19
|
-
},
|
|
20
|
-
"envVars": {
|
|
21
|
-
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
22
|
-
},
|
|
23
|
-
"overrides": {
|
|
24
|
-
"esbuild": "^0.28.2"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "drizzle",
|
|
3
|
+
"name": "Drizzle ORM",
|
|
4
|
+
"description": "Drizzle ORM for NestJS with PostgreSQL",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"drizzle-orm": "^0.45.4",
|
|
8
|
+
"pg": "^8.23.1",
|
|
9
|
+
"dotenv": "^17.4.2"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"drizzle-kit": "^0.31.11",
|
|
13
|
+
"@types/pg": "^8.23.1"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"db:generate": "drizzle-kit generate",
|
|
17
|
+
"db:migrate": "drizzle-kit migrate",
|
|
18
|
+
"db:studio": "drizzle-kit studio"
|
|
19
|
+
},
|
|
20
|
+
"envVars": {
|
|
21
|
+
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
22
|
+
},
|
|
23
|
+
"overrides": {
|
|
24
|
+
"esbuild": "^0.28.2"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{{#if useAuth}}
|
|
2
|
+
import { boolean, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
3
|
+
|
|
4
|
+
export const user = pgTable("user", {
|
|
5
|
+
id: text("id").primaryKey(),
|
|
6
|
+
name: text("name").notNull(),
|
|
7
|
+
email: text("email").notNull().unique(),
|
|
8
|
+
emailVerified: boolean("email_verified").notNull().default(false),
|
|
9
|
+
image: text("image"),
|
|
10
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
11
|
+
.notNull()
|
|
12
|
+
.defaultNow(),
|
|
13
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
14
|
+
.notNull()
|
|
15
|
+
.defaultNow()
|
|
16
|
+
.$onUpdate(() => new Date()),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const session = pgTable("session", {
|
|
20
|
+
id: text("id").primaryKey(),
|
|
21
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
22
|
+
token: text("token").notNull().unique(),
|
|
23
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
24
|
+
.notNull()
|
|
25
|
+
.defaultNow(),
|
|
26
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
27
|
+
.notNull()
|
|
28
|
+
.defaultNow()
|
|
29
|
+
.$onUpdate(() => new Date()),
|
|
30
|
+
ipAddress: text("ip_address"),
|
|
31
|
+
userAgent: text("user_agent"),
|
|
32
|
+
userId: text("user_id")
|
|
33
|
+
.notNull()
|
|
34
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const account = pgTable("account", {
|
|
38
|
+
id: text("id").primaryKey(),
|
|
39
|
+
accountId: text("account_id").notNull(),
|
|
40
|
+
providerId: text("provider_id").notNull(),
|
|
41
|
+
userId: text("user_id")
|
|
42
|
+
.notNull()
|
|
43
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
44
|
+
accessToken: text("access_token"),
|
|
45
|
+
refreshToken: text("refresh_token"),
|
|
46
|
+
idToken: text("id_token"),
|
|
47
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at", {
|
|
48
|
+
withTimezone: true,
|
|
49
|
+
}),
|
|
50
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at", {
|
|
51
|
+
withTimezone: true,
|
|
52
|
+
}),
|
|
53
|
+
scope: text("scope"),
|
|
54
|
+
password: text("password"),
|
|
55
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
56
|
+
.notNull()
|
|
57
|
+
.defaultNow(),
|
|
58
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
59
|
+
.notNull()
|
|
60
|
+
.defaultNow()
|
|
61
|
+
.$onUpdate(() => new Date()),
|
|
62
|
+
}, (table) => [uniqueIndex("account_provider_account_id_unique").on(table.providerId, table.accountId)]);
|
|
63
|
+
|
|
64
|
+
export const verification = pgTable("verification", {
|
|
65
|
+
id: text("id").primaryKey(),
|
|
66
|
+
identifier: text("identifier").notNull(),
|
|
67
|
+
value: text("value").notNull(),
|
|
68
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
69
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
70
|
+
.notNull()
|
|
71
|
+
.defaultNow(),
|
|
72
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
73
|
+
.notNull()
|
|
74
|
+
.defaultNow()
|
|
75
|
+
.$onUpdate(() => new Date()),
|
|
76
|
+
});
|
|
77
|
+
{{else}}
|
|
78
|
+
import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
|
79
|
+
|
|
80
|
+
export const users = pgTable("users", {
|
|
81
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
82
|
+
email: text("email").notNull().unique(),
|
|
83
|
+
name: text("name"),
|
|
84
|
+
password: text("password").notNull(),
|
|
85
|
+
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
|
86
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
87
|
+
.defaultNow()
|
|
88
|
+
.$onUpdate(() => new Date()),
|
|
89
|
+
});
|
|
90
|
+
{{/if}}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "drizzle",
|
|
3
|
-
"name": "Drizzle ORM",
|
|
4
|
-
"description": "Drizzle ORM for Next.js with PostgreSQL",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"drizzle-orm": "^0.45.4",
|
|
8
|
-
"pg": "^8.23.1",
|
|
9
|
-
"dotenv": "^17.4.2"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"drizzle-kit": "^0.31.11",
|
|
13
|
-
"@types/pg": "^8.23.1"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"db:generate": "drizzle-kit generate",
|
|
17
|
-
"db:migrate": "drizzle-kit migrate",
|
|
18
|
-
"db:studio": "drizzle-kit studio"
|
|
19
|
-
},
|
|
20
|
-
"envVars": {
|
|
21
|
-
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
22
|
-
},
|
|
23
|
-
"overrides": {
|
|
24
|
-
"esbuild": "^0.28.2"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "drizzle",
|
|
3
|
+
"name": "Drizzle ORM",
|
|
4
|
+
"description": "Drizzle ORM for Next.js with PostgreSQL",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"drizzle-orm": "^0.45.4",
|
|
8
|
+
"pg": "^8.23.1",
|
|
9
|
+
"dotenv": "^17.4.2"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"drizzle-kit": "^0.31.11",
|
|
13
|
+
"@types/pg": "^8.23.1"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"db:generate": "drizzle-kit generate",
|
|
17
|
+
"db:migrate": "drizzle-kit migrate",
|
|
18
|
+
"db:studio": "drizzle-kit studio"
|
|
19
|
+
},
|
|
20
|
+
"envVars": {
|
|
21
|
+
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
22
|
+
},
|
|
23
|
+
"overrides": {
|
|
24
|
+
"esbuild": "^0.28.2"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { config } from "dotenv";
|
|
2
|
-
import { defineConfig } from "drizzle-kit";
|
|
3
|
-
|
|
4
|
-
config({ path: ".env" });
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
schema: "./lib/schema.ts",
|
|
8
|
-
out: "./migrations",
|
|
9
|
-
dialect: "postgresql",
|
|
10
|
-
dbCredentials: {
|
|
11
|
-
url: process.env.DATABASE_URL!,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
1
|
+
import { config } from "dotenv";
|
|
2
|
+
import { defineConfig } from "drizzle-kit";
|
|
3
|
+
|
|
4
|
+
config({ path: ".env" });
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
schema: "./lib/schema.ts",
|
|
8
|
+
out: "./migrations",
|
|
9
|
+
dialect: "postgresql",
|
|
10
|
+
dbCredentials: {
|
|
11
|
+
url: process.env.DATABASE_URL!,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "drizzle",
|
|
3
|
-
"name": "Drizzle ORM",
|
|
4
|
-
"description": "Drizzle ORM for TanStack Start with PostgreSQL",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"drizzle-orm": "^0.45.4",
|
|
8
|
-
"pg": "^8.23.1",
|
|
9
|
-
"dotenv": "^17.4.2"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"drizzle-kit": "^0.31.11",
|
|
13
|
-
"@types/pg": "^8.23.1"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"db:generate": "drizzle-kit generate",
|
|
17
|
-
"db:migrate": "drizzle-kit migrate",
|
|
18
|
-
"db:studio": "drizzle-kit studio"
|
|
19
|
-
},
|
|
20
|
-
"envVars": {
|
|
21
|
-
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
22
|
-
},
|
|
23
|
-
"overrides": {
|
|
24
|
-
"esbuild": "^0.28.2"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "drizzle",
|
|
3
|
+
"name": "Drizzle ORM",
|
|
4
|
+
"description": "Drizzle ORM for TanStack Start with PostgreSQL",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"drizzle-orm": "^0.45.4",
|
|
8
|
+
"pg": "^8.23.1",
|
|
9
|
+
"dotenv": "^17.4.2"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"drizzle-kit": "^0.31.11",
|
|
13
|
+
"@types/pg": "^8.23.1"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"db:generate": "drizzle-kit generate",
|
|
17
|
+
"db:migrate": "drizzle-kit migrate",
|
|
18
|
+
"db:studio": "drizzle-kit studio"
|
|
19
|
+
},
|
|
20
|
+
"envVars": {
|
|
21
|
+
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
22
|
+
},
|
|
23
|
+
"overrides": {
|
|
24
|
+
"esbuild": "^0.28.2"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineConfig } from "drizzle-kit";
|
|
2
|
-
import { config } from "dotenv";
|
|
3
|
-
|
|
4
|
-
config({ path: ".env" });
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
schema: "./src/lib/schema.ts",
|
|
8
|
-
out: "./migrations",
|
|
9
|
-
dialect: "postgresql",
|
|
10
|
-
dbCredentials: {
|
|
11
|
-
url: process.env.DATABASE_URL!,
|
|
12
|
-
},
|
|
1
|
+
import { defineConfig } from "drizzle-kit";
|
|
2
|
+
import { config } from "dotenv";
|
|
3
|
+
|
|
4
|
+
config({ path: ".env" });
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
schema: "./src/lib/schema.ts",
|
|
8
|
+
out: "./migrations",
|
|
9
|
+
dialect: "postgresql",
|
|
10
|
+
dbCredentials: {
|
|
11
|
+
url: process.env.DATABASE_URL!,
|
|
12
|
+
},
|
|
13
13
|
});
|