create-lx2-app 0.11.5-beta.879764 → 0.11.5-beta.a472eda

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.
Files changed (56) hide show
  1. package/dist/index.js +28 -26
  2. package/package.json +3 -1
  3. package/template/packages/config/biome.jsonc +46 -9
  4. package/template/packages/config/next/with-payload.ts +14 -0
  5. package/template/packages/config/tsconfig/base.json +8 -2
  6. package/template/packages/config/tsconfig/with-payload.json +8 -2
  7. package/template/packages/src/app/api/trpc/[trpc]/route.ts +34 -0
  8. package/template/packages/src/app/layout/with-trpc.tsx +37 -0
  9. package/template/packages/src/app/page/base.tsx +4 -1
  10. package/template/packages/src/app/page/with-authjs-drizzle.tsx +4 -1
  11. package/template/packages/src/app/page/with-authjs-prisma.tsx +10 -1
  12. package/template/packages/src/app/page/with-authjs.tsx +4 -1
  13. package/template/packages/src/app/page/with-better-auth-drizzle.tsx +4 -1
  14. package/template/packages/src/app/page/with-better-auth-prisma.tsx +10 -1
  15. package/template/packages/src/app/page/with-better-auth.tsx +4 -1
  16. package/template/packages/src/app/page/with-drizzle.tsx +4 -1
  17. package/template/packages/src/app/page/with-payload.tsx +4 -1
  18. package/template/packages/src/app/page/with-prisma.tsx +10 -1
  19. package/template/packages/src/app/page/with-trpc.tsx +118 -0
  20. package/template/packages/src/components/greeting.tsx +21 -0
  21. package/template/packages/src/env/with-better-auth-db.js +2 -2
  22. package/template/packages/src/env/with-better-auth.js +2 -2
  23. package/template/packages/src/env/with-trpc-authjs-db.js +55 -0
  24. package/template/packages/src/env/with-trpc-authjs.js +53 -0
  25. package/template/packages/src/env/with-trpc-better-auth-db.js +52 -0
  26. package/template/packages/src/env/with-trpc-better-auth.js +50 -0
  27. package/template/packages/src/env/with-trpc-db.js +46 -0
  28. package/template/packages/src/env/with-trpc.js +44 -0
  29. package/template/packages/src/lib/api/client.tsx +85 -0
  30. package/template/packages/src/lib/api/query-client.ts +22 -0
  31. package/template/packages/src/lib/api/server.ts +31 -0
  32. package/template/packages/src/lib/auth/better-auth-client.ts +1 -1
  33. package/template/packages/src/lib/utils.ts +7 -0
  34. package/template/packages/src/server/api/init/base.ts +103 -0
  35. package/template/packages/src/server/api/init/with-authjs-db.ts +132 -0
  36. package/template/packages/src/server/api/init/with-authjs.ts +130 -0
  37. package/template/packages/src/server/api/init/with-betterauth-db.ts +134 -0
  38. package/template/packages/src/server/api/init/with-betterauth.ts +132 -0
  39. package/template/packages/src/server/api/init/with-db.ts +106 -0
  40. package/template/packages/src/server/api/root.ts +23 -0
  41. package/template/packages/src/server/api/routers/post/base.ts +46 -0
  42. package/template/packages/src/server/api/routers/post/with-auth-drizzle.ts +44 -0
  43. package/template/packages/src/server/api/routers/post/with-auth-prisma.ts +47 -0
  44. package/template/packages/src/server/api/routers/post/with-auth.ts +43 -0
  45. package/template/packages/src/server/api/routers/post/with-drizzle.ts +36 -0
  46. package/template/packages/src/server/api/routers/post/with-prisma.ts +37 -0
  47. package/template/packages/src/server/auth/better-auth-with-drizzle.ts +1 -1
  48. package/template/packages/src/server/auth/better-auth-with-prisma.ts +1 -1
  49. package/template/packages/src/server/auth/better-auth.ts +1 -0
  50. package/template/packages/src/server/auth/config/authjs-with-drizzle.ts +1 -1
  51. package/template/packages/src/server/auth/config/authjs-with-prisma.ts +1 -1
  52. package/template/packages/src/server/auth/config/authjs.ts +1 -1
  53. package/template/packages/src/server/db/schema-drizzle/with-authjs-mysql.ts +1 -1
  54. package/template/packages/src/server/db/schema-drizzle/with-authjs-postgresql.ts +1 -1
  55. package/template/packages/src/server/db/schema-drizzle/with-authjs-sqlite.ts +1 -1
  56. /package/template/{base/next.config.ts → packages/config/next/base.ts} +0 -0
@@ -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
+ })
@@ -9,7 +9,7 @@ export const auth = betterAuth({
9
9
  database: drizzleAdapter(db, {
10
10
  provider: "sqlite",
11
11
  }),
12
- baseURL: env.NEXT_PUBLIC_BETTER_AUTH_URL,
12
+ baseURL: env.NEXT_PUBLIC_URL,
13
13
  socialProviders: {
14
14
  discord: {
15
15
  clientId: env.DISCORD_CLIENT_ID,
@@ -9,7 +9,7 @@ export const auth = betterAuth({
9
9
  database: prismaAdapter(db, {
10
10
  provider: "sqlite",
11
11
  }),
12
- baseURL: env.NEXT_PUBLIC_BETTER_AUTH_URL,
12
+ baseURL: env.NEXT_PUBLIC_URL,
13
13
  socialProviders: {
14
14
  discord: {
15
15
  clientId: env.DISCORD_CLIENT_ID,
@@ -6,6 +6,7 @@ import { env } from "@/env"
6
6
 
7
7
  export const auth = betterAuth({
8
8
  database: new Database("./db.sqlite"),
9
+ baseURL: env.NEXT_PUBLIC_URL,
9
10
  socialProviders: {
10
11
  discord: {
11
12
  clientId: env.DISCORD_CLIENT_ID,
@@ -1,5 +1,5 @@
1
1
  import { DrizzleAdapter } from "@auth/drizzle-adapter"
2
- import { NextAuthConfig } from "next-auth"
2
+ import type { NextAuthConfig } from "next-auth"
3
3
  import Discord from "next-auth/providers/discord"
4
4
 
5
5
  import { env } from "@/env"
@@ -1,5 +1,5 @@
1
1
  import { PrismaAdapter } from "@auth/prisma-adapter"
2
- import { NextAuthConfig } from "next-auth"
2
+ import type { NextAuthConfig } from "next-auth"
3
3
  import Discord from "next-auth/providers/discord"
4
4
 
5
5
  import { env } from "@/env"
@@ -1,4 +1,4 @@
1
- import { NextAuthConfig } from "next-auth"
1
+ import type { NextAuthConfig } from "next-auth"
2
2
  import Discord from "next-auth/providers/discord"
3
3
 
4
4
  import { env } from "@/env"
@@ -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 { type 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, 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 { type 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.