create-lx2-app 0.11.5-beta.be15a1f → 0.11.5-beta.c6e566f
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 +16 -16
- package/package.json +6 -1
- package/template/base/_gitignore +1 -0
- package/template/packages/config/biome.jsonc +46 -9
- package/template/packages/config/next/with-payload.ts +14 -0
- package/template/packages/config/prisma.config.ts +14 -0
- package/template/packages/config/tsconfig/base.json +8 -2
- package/template/packages/config/tsconfig/with-payload.json +8 -2
- package/template/packages/prisma/schema/base.prisma +1 -1
- package/template/packages/prisma/schema/with-authjs.prisma +1 -1
- package/template/packages/prisma/schema/with-better-auth.prisma +1 -1
- package/template/packages/src/app/page/base.tsx +4 -1
- package/template/packages/src/app/page/with-authjs-drizzle.tsx +4 -1
- package/template/packages/src/app/page/with-authjs-prisma.tsx +10 -1
- package/template/packages/src/app/page/with-authjs.tsx +4 -1
- package/template/packages/src/app/page/with-better-auth-drizzle.tsx +4 -1
- package/template/packages/src/app/page/with-better-auth-prisma.tsx +10 -1
- package/template/packages/src/app/page/with-better-auth.tsx +4 -1
- package/template/packages/src/app/page/with-drizzle.tsx +4 -1
- package/template/packages/src/app/page/with-payload.tsx +4 -1
- package/template/packages/src/app/page/with-prisma.tsx +10 -1
- package/template/packages/src/app/page/with-trpc.tsx +4 -1
- package/template/packages/src/env/with-better-auth-db.js +2 -2
- package/template/packages/src/env/with-better-auth.js +2 -2
- package/template/packages/src/env/with-trpc-better-auth-db.js +0 -2
- package/template/packages/src/env/with-trpc-better-auth.js +0 -2
- package/template/packages/src/lib/auth/better-auth-client.ts +1 -1
- package/template/packages/src/server/api/routers/post/with-auth-drizzle.ts +2 -2
- package/template/packages/src/server/api/routers/post/with-auth-prisma.ts +47 -0
- package/template/packages/src/server/api/routers/post/with-auth.ts +2 -2
- package/template/packages/src/server/api/routers/post/with-prisma.ts +37 -0
- package/template/packages/src/server/auth/better-auth-with-drizzle.ts +1 -1
- package/template/packages/src/server/auth/better-auth-with-prisma.ts +1 -1
- package/template/packages/src/server/auth/better-auth.ts +1 -1
- package/template/packages/src/server/db/{db-prisma.ts → prisma/with-mysql.ts} +5 -1
- package/template/packages/src/server/db/prisma/with-postgresql.ts +29 -0
- package/template/packages/src/server/db/prisma/with-sqlite-bun.ts +29 -0
- package/template/packages/src/server/db/prisma/with-sqlite.ts +29 -0
- package/template/packages/src/server/db/schema-drizzle/with-authjs-mysql.ts +1 -1
- package/template/packages/src/server/db/schema-drizzle/with-authjs-postgresql.ts +1 -1
- package/template/packages/src/server/db/schema-drizzle/with-authjs-sqlite.ts +1 -1
- /package/template/{base/next.config.ts → packages/config/next/base.ts} +0 -0
|
@@ -9,7 +9,7 @@ export default async function HomePage() {
|
|
|
9
9
|
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
12
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
13
13
|
{/* Header */}
|
|
14
14
|
<header className="ml-auto">
|
|
15
15
|
{user ? (
|
|
@@ -88,6 +88,7 @@ export default async function HomePage() {
|
|
|
88
88
|
strokeLinejoin="round"
|
|
89
89
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
90
90
|
>
|
|
91
|
+
<title>Docs</title>
|
|
91
92
|
<path d="M7 7h10v10" />
|
|
92
93
|
<path d="M7 17 17 7" />
|
|
93
94
|
</svg>
|
|
@@ -106,6 +107,7 @@ export default async function HomePage() {
|
|
|
106
107
|
strokeLinejoin="round"
|
|
107
108
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
108
109
|
>
|
|
110
|
+
<title>Discord</title>
|
|
109
111
|
<path d="M7 7h10v10" />
|
|
110
112
|
<path d="M7 17 17 7" />
|
|
111
113
|
</svg>
|
|
@@ -124,6 +126,7 @@ export default async function HomePage() {
|
|
|
124
126
|
strokeLinejoin="round"
|
|
125
127
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
126
128
|
>
|
|
129
|
+
<title>GitHub</title>
|
|
127
130
|
<path d="M7 7h10v10" />
|
|
128
131
|
<path d="M7 17 17 7" />
|
|
129
132
|
</svg>
|
|
@@ -19,7 +19,7 @@ export default async function HomePage() {
|
|
|
19
19
|
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
22
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
23
23
|
{/* Header */}
|
|
24
24
|
<header className="ml-auto">
|
|
25
25
|
{user ? (
|
|
@@ -110,6 +110,7 @@ export default async function HomePage() {
|
|
|
110
110
|
strokeLinejoin="round"
|
|
111
111
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
112
112
|
>
|
|
113
|
+
<title>Docs</title>
|
|
113
114
|
<path d="M7 7h10v10" />
|
|
114
115
|
<path d="M7 17 17 7" />
|
|
115
116
|
</svg>
|
|
@@ -128,6 +129,7 @@ export default async function HomePage() {
|
|
|
128
129
|
strokeLinejoin="round"
|
|
129
130
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
130
131
|
>
|
|
132
|
+
<title>Discord</title>
|
|
131
133
|
<path d="M7 7h10v10" />
|
|
132
134
|
<path d="M7 17 17 7" />
|
|
133
135
|
</svg>
|
|
@@ -146,6 +148,7 @@ export default async function HomePage() {
|
|
|
146
148
|
strokeLinejoin="round"
|
|
147
149
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
148
150
|
>
|
|
151
|
+
<title>GitHub</title>
|
|
149
152
|
<path d="M7 7h10v10" />
|
|
150
153
|
<path d="M7 17 17 7" />
|
|
151
154
|
</svg>
|
|
@@ -6,6 +6,12 @@ import { redirect } from "next/navigation"
|
|
|
6
6
|
import { auth } from "@/server/auth"
|
|
7
7
|
import { db } from "@/server/db"
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Force dynamic rendering for pnpm + prisma
|
|
11
|
+
* @see https://github.com/prisma/prisma/issues/28581
|
|
12
|
+
*/
|
|
13
|
+
export const dynamic = "force-dynamic"
|
|
14
|
+
|
|
9
15
|
export default async function HomePage() {
|
|
10
16
|
const session = await auth.api.getSession({
|
|
11
17
|
headers: await headers(),
|
|
@@ -17,7 +23,7 @@ export default async function HomePage() {
|
|
|
17
23
|
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
18
24
|
|
|
19
25
|
return (
|
|
20
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
26
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
21
27
|
{/* Header */}
|
|
22
28
|
<header className="ml-auto">
|
|
23
29
|
{user ? (
|
|
@@ -108,6 +114,7 @@ export default async function HomePage() {
|
|
|
108
114
|
strokeLinejoin="round"
|
|
109
115
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
110
116
|
>
|
|
117
|
+
<title>Docs</title>
|
|
111
118
|
<path d="M7 7h10v10" />
|
|
112
119
|
<path d="M7 17 17 7" />
|
|
113
120
|
</svg>
|
|
@@ -126,6 +133,7 @@ export default async function HomePage() {
|
|
|
126
133
|
strokeLinejoin="round"
|
|
127
134
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
128
135
|
>
|
|
136
|
+
<title>Discord</title>
|
|
129
137
|
<path d="M7 7h10v10" />
|
|
130
138
|
<path d="M7 17 17 7" />
|
|
131
139
|
</svg>
|
|
@@ -144,6 +152,7 @@ export default async function HomePage() {
|
|
|
144
152
|
strokeLinejoin="round"
|
|
145
153
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
146
154
|
>
|
|
155
|
+
<title>GitHub</title>
|
|
147
156
|
<path d="M7 7h10v10" />
|
|
148
157
|
<path d="M7 17 17 7" />
|
|
149
158
|
</svg>
|
|
@@ -13,7 +13,7 @@ export default async function HomePage() {
|
|
|
13
13
|
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
16
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
17
17
|
{/* Header */}
|
|
18
18
|
<header className="ml-auto">
|
|
19
19
|
{user ? (
|
|
@@ -104,6 +104,7 @@ export default async function HomePage() {
|
|
|
104
104
|
strokeLinejoin="round"
|
|
105
105
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
106
106
|
>
|
|
107
|
+
<title>Docs</title>
|
|
107
108
|
<path d="M7 7h10v10" />
|
|
108
109
|
<path d="M7 17 17 7" />
|
|
109
110
|
</svg>
|
|
@@ -122,6 +123,7 @@ export default async function HomePage() {
|
|
|
122
123
|
strokeLinejoin="round"
|
|
123
124
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
124
125
|
>
|
|
126
|
+
<title>Discord</title>
|
|
125
127
|
<path d="M7 7h10v10" />
|
|
126
128
|
<path d="M7 17 17 7" />
|
|
127
129
|
</svg>
|
|
@@ -140,6 +142,7 @@ export default async function HomePage() {
|
|
|
140
142
|
strokeLinejoin="round"
|
|
141
143
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
142
144
|
>
|
|
145
|
+
<title>GitHub</title>
|
|
143
146
|
<path d="M7 7h10v10" />
|
|
144
147
|
<path d="M7 17 17 7" />
|
|
145
148
|
</svg>
|
|
@@ -11,7 +11,7 @@ export default async function HomePage() {
|
|
|
11
11
|
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
14
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
15
15
|
<div className="flex grow flex-col items-center justify-center">
|
|
16
16
|
{/* Logo */}
|
|
17
17
|
<picture className="relative">
|
|
@@ -52,6 +52,7 @@ export default async function HomePage() {
|
|
|
52
52
|
strokeLinejoin="round"
|
|
53
53
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
54
54
|
>
|
|
55
|
+
<title>Docs</title>
|
|
55
56
|
<path d="M7 7h10v10" />
|
|
56
57
|
<path d="M7 17 17 7" />
|
|
57
58
|
</svg>
|
|
@@ -70,6 +71,7 @@ export default async function HomePage() {
|
|
|
70
71
|
strokeLinejoin="round"
|
|
71
72
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
72
73
|
>
|
|
74
|
+
<title>Discord</title>
|
|
73
75
|
<path d="M7 7h10v10" />
|
|
74
76
|
<path d="M7 17 17 7" />
|
|
75
77
|
</svg>
|
|
@@ -88,6 +90,7 @@ export default async function HomePage() {
|
|
|
88
90
|
strokeLinejoin="round"
|
|
89
91
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
90
92
|
>
|
|
93
|
+
<title>GitHub</title>
|
|
91
94
|
<path d="M7 7h10v10" />
|
|
92
95
|
<path d="M7 17 17 7" />
|
|
93
96
|
</svg>
|
|
@@ -12,7 +12,7 @@ export default async function HomePage() {
|
|
|
12
12
|
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
15
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
16
16
|
<div className="flex grow flex-col items-center justify-center">
|
|
17
17
|
{/* Logo */}
|
|
18
18
|
<picture className="relative">
|
|
@@ -86,6 +86,7 @@ export default async function HomePage() {
|
|
|
86
86
|
strokeLinejoin="round"
|
|
87
87
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
88
88
|
>
|
|
89
|
+
<title>Docs</title>
|
|
89
90
|
<path d="M7 7h10v10" />
|
|
90
91
|
<path d="M7 17 17 7" />
|
|
91
92
|
</svg>
|
|
@@ -104,6 +105,7 @@ export default async function HomePage() {
|
|
|
104
105
|
strokeLinejoin="round"
|
|
105
106
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
106
107
|
>
|
|
108
|
+
<title>Discord</title>
|
|
107
109
|
<path d="M7 7h10v10" />
|
|
108
110
|
<path d="M7 17 17 7" />
|
|
109
111
|
</svg>
|
|
@@ -122,6 +124,7 @@ export default async function HomePage() {
|
|
|
122
124
|
strokeLinejoin="round"
|
|
123
125
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
124
126
|
>
|
|
127
|
+
<title>GitHub</title>
|
|
125
128
|
<path d="M7 7h10v10" />
|
|
126
129
|
<path d="M7 17 17 7" />
|
|
127
130
|
</svg>
|
|
@@ -3,13 +3,19 @@ import { revalidatePath } from "next/cache"
|
|
|
3
3
|
|
|
4
4
|
import { db } from "@/server/db"
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Force dynamic rendering for pnpm + prisma
|
|
8
|
+
* @see https://github.com/prisma/prisma/issues/28581
|
|
9
|
+
*/
|
|
10
|
+
export const dynamic = "force-dynamic"
|
|
11
|
+
|
|
6
12
|
export default async function HomePage() {
|
|
7
13
|
const posts = await db.post.findMany()
|
|
8
14
|
|
|
9
15
|
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
10
16
|
|
|
11
17
|
return (
|
|
12
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
18
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
13
19
|
<div className="flex grow flex-col items-center justify-center">
|
|
14
20
|
{/* Logo */}
|
|
15
21
|
<picture className="relative">
|
|
@@ -50,6 +56,7 @@ export default async function HomePage() {
|
|
|
50
56
|
strokeLinejoin="round"
|
|
51
57
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
52
58
|
>
|
|
59
|
+
<title>Docs</title>
|
|
53
60
|
<path d="M7 7h10v10" />
|
|
54
61
|
<path d="M7 17 17 7" />
|
|
55
62
|
</svg>
|
|
@@ -68,6 +75,7 @@ export default async function HomePage() {
|
|
|
68
75
|
strokeLinejoin="round"
|
|
69
76
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
70
77
|
>
|
|
78
|
+
<title>Discord</title>
|
|
71
79
|
<path d="M7 7h10v10" />
|
|
72
80
|
<path d="M7 17 17 7" />
|
|
73
81
|
</svg>
|
|
@@ -86,6 +94,7 @@ export default async function HomePage() {
|
|
|
86
94
|
strokeLinejoin="round"
|
|
87
95
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
88
96
|
>
|
|
97
|
+
<title>GitHub</title>
|
|
89
98
|
<path d="M7 7h10v10" />
|
|
90
99
|
<path d="M7 17 17 7" />
|
|
91
100
|
</svg>
|
|
@@ -12,7 +12,7 @@ export default async function HomePage() {
|
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<HydrateClient>
|
|
15
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
15
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
16
16
|
<div className="flex grow flex-col items-center justify-center">
|
|
17
17
|
{/* Logo */}
|
|
18
18
|
<picture className="relative">
|
|
@@ -53,6 +53,7 @@ export default async function HomePage() {
|
|
|
53
53
|
strokeLinejoin="round"
|
|
54
54
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
55
55
|
>
|
|
56
|
+
<title>Docs</title>
|
|
56
57
|
<path d="M7 7h10v10" />
|
|
57
58
|
<path d="M7 17 17 7" />
|
|
58
59
|
</svg>
|
|
@@ -71,6 +72,7 @@ export default async function HomePage() {
|
|
|
71
72
|
strokeLinejoin="round"
|
|
72
73
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
73
74
|
>
|
|
75
|
+
<title>Discord</title>
|
|
74
76
|
<path d="M7 7h10v10" />
|
|
75
77
|
<path d="M7 17 17 7" />
|
|
76
78
|
</svg>
|
|
@@ -89,6 +91,7 @@ export default async function HomePage() {
|
|
|
89
91
|
strokeLinejoin="round"
|
|
90
92
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
91
93
|
>
|
|
94
|
+
<title>GitHub</title>
|
|
92
95
|
<path d="M7 7h10v10" />
|
|
93
96
|
<path d="M7 17 17 7" />
|
|
94
97
|
</svg>
|
|
@@ -23,7 +23,7 @@ export const env = createEnv({
|
|
|
23
23
|
*/
|
|
24
24
|
client: {
|
|
25
25
|
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
|
26
|
-
|
|
26
|
+
NEXT_PUBLIC_URL: z.url(),
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -34,7 +34,7 @@ export const env = createEnv({
|
|
|
34
34
|
NODE_ENV: process.env.NODE_ENV,
|
|
35
35
|
DATABASE_URL: process.env.DATABASE_URL,
|
|
36
36
|
BETTER_AUTH_SECRET: process.env.BETTER_AUTH_SECRET,
|
|
37
|
-
|
|
37
|
+
NEXT_PUBLIC_URL: process.env.NEXT_PUBLIC_URL,
|
|
38
38
|
DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID,
|
|
39
39
|
DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET,
|
|
40
40
|
},
|
|
@@ -20,7 +20,7 @@ export const env = createEnv({
|
|
|
20
20
|
*/
|
|
21
21
|
client: {
|
|
22
22
|
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
|
23
|
-
|
|
23
|
+
NEXT_PUBLIC_URL: z.url(),
|
|
24
24
|
},
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -31,7 +31,7 @@ export const env = createEnv({
|
|
|
31
31
|
NODE_ENV: process.env.NODE_ENV,
|
|
32
32
|
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
|
|
33
33
|
BETTER_AUTH_SECRET: process.env.BETTER_AUTH_SECRET,
|
|
34
|
-
|
|
34
|
+
NEXT_PUBLIC_URL: process.env.NEXT_PUBLIC_URL,
|
|
35
35
|
DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID,
|
|
36
36
|
DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET,
|
|
37
37
|
},
|
|
@@ -24,7 +24,6 @@ export const env = createEnv({
|
|
|
24
24
|
client: {
|
|
25
25
|
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
|
26
26
|
NEXT_PUBLIC_URL: z.url(),
|
|
27
|
-
NEXT_PUBLIC_BETTER_AUTH_URL: z.url(),
|
|
28
27
|
},
|
|
29
28
|
|
|
30
29
|
/**
|
|
@@ -39,7 +38,6 @@ export const env = createEnv({
|
|
|
39
38
|
NODE_ENV: process.env.NODE_ENV,
|
|
40
39
|
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
|
|
41
40
|
NEXT_PUBLIC_URL: process.env.NEXT_PUBLIC_URL,
|
|
42
|
-
NEXT_PUBLIC_BETTER_AUTH_URL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL,
|
|
43
41
|
},
|
|
44
42
|
/**
|
|
45
43
|
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
|
|
@@ -23,7 +23,6 @@ export const env = createEnv({
|
|
|
23
23
|
client: {
|
|
24
24
|
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
|
25
25
|
NEXT_PUBLIC_URL: z.url(),
|
|
26
|
-
NEXT_PUBLIC_BETTER_AUTH_URL: z.url(),
|
|
27
26
|
},
|
|
28
27
|
|
|
29
28
|
/**
|
|
@@ -37,7 +36,6 @@ export const env = createEnv({
|
|
|
37
36
|
NODE_ENV: process.env.NODE_ENV,
|
|
38
37
|
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
|
|
39
38
|
NEXT_PUBLIC_URL: process.env.NEXT_PUBLIC_URL,
|
|
40
|
-
NEXT_PUBLIC_BETTER_AUTH_URL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL,
|
|
41
39
|
},
|
|
42
40
|
/**
|
|
43
41
|
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
|
|
@@ -3,7 +3,7 @@ import { createAuthClient } from "better-auth/react"
|
|
|
3
3
|
import { env } from "@/env"
|
|
4
4
|
|
|
5
5
|
export const authClient = createAuthClient({
|
|
6
|
-
baseURL: env.
|
|
6
|
+
baseURL: env.NEXT_PUBLIC_URL,
|
|
7
7
|
})
|
|
8
8
|
|
|
9
9
|
export const { signIn, signOut, useSession } = authClient
|
|
@@ -18,7 +18,7 @@ export const postRouter = createTRPCRouter({
|
|
|
18
18
|
return `Hello ${input.text}`
|
|
19
19
|
}),
|
|
20
20
|
|
|
21
|
-
create:
|
|
21
|
+
create: protectedProcedure
|
|
22
22
|
.input(
|
|
23
23
|
z.object({
|
|
24
24
|
name: z.string().min(1),
|
|
@@ -30,7 +30,7 @@ export const postRouter = createTRPCRouter({
|
|
|
30
30
|
})
|
|
31
31
|
}),
|
|
32
32
|
|
|
33
|
-
getLatest:
|
|
33
|
+
getLatest: protectedProcedure.query(async ({ ctx }) => {
|
|
34
34
|
const post = await ctx.db.query.post.findFirst({
|
|
35
35
|
orderBy: (post, { desc }) => [desc(post.createdAt)],
|
|
36
36
|
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import z from "zod"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createTRPCRouter,
|
|
5
|
+
protectedProcedure,
|
|
6
|
+
publicProcedure,
|
|
7
|
+
} from "@/server/api/init"
|
|
8
|
+
|
|
9
|
+
export const postRouter = createTRPCRouter({
|
|
10
|
+
greeting: publicProcedure
|
|
11
|
+
.input(
|
|
12
|
+
z.object({
|
|
13
|
+
text: z.string(),
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
.query(({ input }) => {
|
|
17
|
+
return `Hello ${input.text}`
|
|
18
|
+
}),
|
|
19
|
+
|
|
20
|
+
create: protectedProcedure
|
|
21
|
+
.input(
|
|
22
|
+
z.object({
|
|
23
|
+
name: z.string().min(1),
|
|
24
|
+
})
|
|
25
|
+
)
|
|
26
|
+
.mutation(async ({ ctx, input }) => {
|
|
27
|
+
return ctx.db.post.create({
|
|
28
|
+
data: {
|
|
29
|
+
name: input.name,
|
|
30
|
+
createdBy: { connect: { id: ctx.session.user.id } },
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
getLatest: protectedProcedure.query(async ({ ctx }) => {
|
|
36
|
+
const post = await ctx.db.post.findFirst({
|
|
37
|
+
orderBy: { createdAt: "desc" },
|
|
38
|
+
where: { createdBy: { id: ctx.session.user.id } },
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return post ?? null
|
|
42
|
+
}),
|
|
43
|
+
|
|
44
|
+
getSecretMessage: protectedProcedure.query(() => {
|
|
45
|
+
return "you can now see this secret message!"
|
|
46
|
+
}),
|
|
47
|
+
})
|
|
@@ -22,7 +22,7 @@ export const postRouter = createTRPCRouter({
|
|
|
22
22
|
return `Hello ${input.text}`
|
|
23
23
|
}),
|
|
24
24
|
|
|
25
|
-
create:
|
|
25
|
+
create: protectedProcedure
|
|
26
26
|
.input(
|
|
27
27
|
z.object({
|
|
28
28
|
name: z.string().min(1),
|
|
@@ -33,7 +33,7 @@ export const postRouter = createTRPCRouter({
|
|
|
33
33
|
return post
|
|
34
34
|
}),
|
|
35
35
|
|
|
36
|
-
getLatest:
|
|
36
|
+
getLatest: protectedProcedure.query(async () => {
|
|
37
37
|
return post
|
|
38
38
|
}),
|
|
39
39
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import z from "zod"
|
|
2
|
+
|
|
3
|
+
import { createTRPCRouter, publicProcedure } from "@/server/api/init"
|
|
4
|
+
|
|
5
|
+
export const postRouter = createTRPCRouter({
|
|
6
|
+
greeting: publicProcedure
|
|
7
|
+
.input(
|
|
8
|
+
z.object({
|
|
9
|
+
text: z.string(),
|
|
10
|
+
})
|
|
11
|
+
)
|
|
12
|
+
.query(({ input }) => {
|
|
13
|
+
return `Hello ${input.text}`
|
|
14
|
+
}),
|
|
15
|
+
|
|
16
|
+
create: publicProcedure
|
|
17
|
+
.input(
|
|
18
|
+
z.object({
|
|
19
|
+
name: z.string().min(1),
|
|
20
|
+
})
|
|
21
|
+
)
|
|
22
|
+
.mutation(async ({ ctx, input }) => {
|
|
23
|
+
return ctx.db.post.create({
|
|
24
|
+
data: {
|
|
25
|
+
name: input.name,
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
}),
|
|
29
|
+
|
|
30
|
+
getLatest: publicProcedure.query(async ({ ctx }) => {
|
|
31
|
+
const post = await ctx.db.post.findFirst({
|
|
32
|
+
orderBy: { createdAt: "desc" },
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
return post ?? null
|
|
36
|
+
}),
|
|
37
|
+
})
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PrismaMariaDb } from "@prisma/adapter-mariadb"
|
|
2
2
|
|
|
3
3
|
import { env } from "@/env"
|
|
4
|
+
import { PrismaClient } from "@/generated/prisma"
|
|
5
|
+
|
|
6
|
+
const adapter = new PrismaMariaDb(env.DATABASE_URL)
|
|
4
7
|
|
|
5
8
|
const createPrismaClient = () =>
|
|
6
9
|
new PrismaClient({
|
|
10
|
+
adapter,
|
|
7
11
|
log:
|
|
8
12
|
env.NODE_ENV === "development"
|
|
9
13
|
? [
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PrismaPg } from "@prisma/adapter-pg"
|
|
2
|
+
|
|
3
|
+
import { env } from "@/env"
|
|
4
|
+
import { PrismaClient } from "@/generated/prisma"
|
|
5
|
+
|
|
6
|
+
const adapter = new PrismaPg({
|
|
7
|
+
connectionString: env.DATABASE_URL,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const createPrismaClient = () =>
|
|
11
|
+
new PrismaClient({
|
|
12
|
+
adapter,
|
|
13
|
+
log:
|
|
14
|
+
env.NODE_ENV === "development"
|
|
15
|
+
? [
|
|
16
|
+
// "query",
|
|
17
|
+
"error",
|
|
18
|
+
"warn",
|
|
19
|
+
]
|
|
20
|
+
: ["error"],
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const globalForPrisma = globalThis as unknown as {
|
|
24
|
+
prisma: ReturnType<typeof createPrismaClient> | undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const db = globalForPrisma.prisma ?? createPrismaClient()
|
|
28
|
+
|
|
29
|
+
if (env.NODE_ENV !== "production") globalForPrisma.prisma = db
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PrismaLibSql } from "@prisma/adapter-libsql"
|
|
2
|
+
|
|
3
|
+
import { env } from "@/env"
|
|
4
|
+
import { PrismaClient } from "@/generated/prisma"
|
|
5
|
+
|
|
6
|
+
const adapter = new PrismaLibSql({
|
|
7
|
+
url: env.DATABASE_URL,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const createPrismaClient = () =>
|
|
11
|
+
new PrismaClient({
|
|
12
|
+
adapter,
|
|
13
|
+
log:
|
|
14
|
+
env.NODE_ENV === "development"
|
|
15
|
+
? [
|
|
16
|
+
// "query",
|
|
17
|
+
"error",
|
|
18
|
+
"warn",
|
|
19
|
+
]
|
|
20
|
+
: ["error"],
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const globalForPrisma = globalThis as unknown as {
|
|
24
|
+
prisma: ReturnType<typeof createPrismaClient> | undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const db = globalForPrisma.prisma ?? createPrismaClient()
|
|
28
|
+
|
|
29
|
+
if (env.NODE_ENV !== "production") globalForPrisma.prisma = db
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3"
|
|
2
|
+
|
|
3
|
+
import { env } from "@/env"
|
|
4
|
+
import { PrismaClient } from "@/generated/prisma"
|
|
5
|
+
|
|
6
|
+
const adapter = new PrismaBetterSqlite3({
|
|
7
|
+
url: env.DATABASE_URL,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const createPrismaClient = () =>
|
|
11
|
+
new PrismaClient({
|
|
12
|
+
adapter,
|
|
13
|
+
log:
|
|
14
|
+
env.NODE_ENV === "development"
|
|
15
|
+
? [
|
|
16
|
+
// "query",
|
|
17
|
+
"error",
|
|
18
|
+
"warn",
|
|
19
|
+
]
|
|
20
|
+
: ["error"],
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const globalForPrisma = globalThis as unknown as {
|
|
24
|
+
prisma: ReturnType<typeof createPrismaClient> | undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const db = globalForPrisma.prisma ?? createPrismaClient()
|
|
28
|
+
|
|
29
|
+
if (env.NODE_ENV !== "production") globalForPrisma.prisma = db
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { sql } from "drizzle-orm"
|
|
5
5
|
import { index, mysqlTableCreator, primaryKey } from "drizzle-orm/mysql-core"
|
|
6
|
-
import {
|
|
6
|
+
import type { AdapterAccountType } from "next-auth/adapters"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Below is an example of how to create a table with a prefix.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { sql } from "drizzle-orm"
|
|
5
5
|
import { index, pgTableCreator, primaryKey } from "drizzle-orm/pg-core"
|
|
6
|
-
import { AdapterAccountType } from "next-auth/adapters"
|
|
6
|
+
import type { AdapterAccountType } from "next-auth/adapters"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Below is an example of how to create a table with a prefix.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { sql } from "drizzle-orm"
|
|
5
5
|
import { index, primaryKey, sqliteTableCreator } from "drizzle-orm/sqlite-core"
|
|
6
|
-
import {
|
|
6
|
+
import type { AdapterAccountType } from "next-auth/adapters"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Below is an example of how to create a table with a prefix.
|
|
File without changes
|