create-lx2-app 0.11.5-beta.7003807 → 0.11.5-beta.98ffa9a
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 +28 -26
- package/package.json +2 -1
- package/template/packages/src/app/api/trpc/[trpc]/route.ts +34 -0
- package/template/packages/src/app/layout/with-trpc.tsx +37 -0
- package/template/packages/src/app/page/with-trpc.tsx +115 -0
- package/template/packages/src/components/greeting.tsx +21 -0
- 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-authjs-db.js +55 -0
- package/template/packages/src/env/with-trpc-authjs.js +53 -0
- package/template/packages/src/env/with-trpc-better-auth-db.js +52 -0
- package/template/packages/src/env/with-trpc-better-auth.js +50 -0
- package/template/packages/src/env/with-trpc-db.js +46 -0
- package/template/packages/src/env/with-trpc.js +44 -0
- package/template/packages/src/lib/api/client.tsx +85 -0
- package/template/packages/src/lib/api/query-client.ts +22 -0
- package/template/packages/src/lib/api/server.ts +31 -0
- package/template/packages/src/lib/auth/better-auth-client.ts +1 -1
- package/template/packages/src/lib/utils.ts +7 -0
- package/template/packages/src/server/api/init/base.ts +103 -0
- package/template/packages/src/server/api/init/with-authjs-db.ts +132 -0
- package/template/packages/src/server/api/init/with-authjs.ts +130 -0
- package/template/packages/src/server/api/init/with-betterauth-db.ts +134 -0
- package/template/packages/src/server/api/init/with-betterauth.ts +132 -0
- package/template/packages/src/server/api/init/with-db.ts +106 -0
- package/template/packages/src/server/api/root.ts +23 -0
- package/template/packages/src/server/api/routers/post/base.ts +46 -0
- package/template/packages/src/server/api/routers/post/with-auth-drizzle.ts +44 -0
- 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 +43 -0
- package/template/packages/src/server/api/routers/post/with-drizzle.ts +36 -0
- 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 -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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import z from "zod"
|
|
2
|
+
|
|
3
|
+
import { createTRPCRouter, publicProcedure } from "@/server/api/init"
|
|
4
|
+
import { post } from "@/server/db/schema"
|
|
5
|
+
|
|
6
|
+
export const postRouter = createTRPCRouter({
|
|
7
|
+
greeting: publicProcedure
|
|
8
|
+
.input(
|
|
9
|
+
z.object({
|
|
10
|
+
text: z.string(),
|
|
11
|
+
})
|
|
12
|
+
)
|
|
13
|
+
.query(({ input }) => {
|
|
14
|
+
return `Hello ${input.text}`
|
|
15
|
+
}),
|
|
16
|
+
|
|
17
|
+
create: publicProcedure
|
|
18
|
+
.input(
|
|
19
|
+
z.object({
|
|
20
|
+
name: z.string().min(1),
|
|
21
|
+
})
|
|
22
|
+
)
|
|
23
|
+
.mutation(async ({ ctx, input }) => {
|
|
24
|
+
await ctx.db.insert(post).values({
|
|
25
|
+
name: input.name,
|
|
26
|
+
})
|
|
27
|
+
}),
|
|
28
|
+
|
|
29
|
+
getLatest: publicProcedure.query(async ({ ctx }) => {
|
|
30
|
+
const post = await ctx.db.query.post.findFirst({
|
|
31
|
+
orderBy: (post, { desc }) => [desc(post.createdAt)],
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return post ?? null
|
|
35
|
+
}),
|
|
36
|
+
})
|
|
@@ -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
|
+
})
|
|
@@ -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.
|