create-better-t-stack 2.50.1 → 3.0.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.
Files changed (113) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.d.ts +8 -9
  3. package/dist/index.js +1 -1
  4. package/dist/{src-B8TD9m4n.js → src-BywywK-y.js} +825 -418
  5. package/package.json +2 -1
  6. package/templates/addons/ruler/.ruler/bts.md.hbs +24 -14
  7. package/templates/api/orpc/fullstack/next/src/app/api/rpc/[[...rest]]/route.ts.hbs +50 -0
  8. package/templates/api/orpc/native/utils/orpc.ts.hbs +5 -1
  9. package/templates/api/orpc/server/_gitignore +34 -0
  10. package/templates/api/orpc/server/package.json.hbs +22 -0
  11. package/templates/api/orpc/server/{base/src/lib → src}/context.ts.hbs +6 -6
  12. package/templates/{backend/server/server-base → api/orpc/server}/src/routers/index.ts.hbs +2 -2
  13. package/templates/api/orpc/server/tsconfig.json.hbs +10 -0
  14. package/templates/api/orpc/server/tsdown.config.ts.hbs +7 -0
  15. package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +1 -1
  16. package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +4 -2
  17. package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +1 -1
  18. package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +1 -1
  19. package/templates/api/trpc/fullstack/next/src/app/api/trpc/[trpc]/route.ts.hbs +14 -0
  20. package/templates/api/trpc/native/utils/trpc.ts.hbs +5 -1
  21. package/templates/api/trpc/server/_gitignore +34 -0
  22. package/templates/api/trpc/server/package.json.hbs +21 -0
  23. package/templates/api/trpc/server/{base/src/lib → src}/context.ts.hbs +6 -6
  24. package/templates/api/trpc/server/src/routers/index.ts.hbs +55 -0
  25. package/templates/api/trpc/server/tsconfig.json.hbs +10 -0
  26. package/templates/api/trpc/server/tsdown.config.ts.hbs +7 -0
  27. package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +6 -4
  28. package/templates/auth/better-auth/{server/next/src/app/api/auth/[...all]/route.ts → fullstack/next/src/app/api/auth/[...all]/route.ts.hbs} +1 -1
  29. package/templates/auth/better-auth/server/base/_gitignore +34 -0
  30. package/templates/auth/better-auth/server/base/package.json.hbs +21 -0
  31. package/templates/auth/better-auth/server/base/src/{lib/auth.ts.hbs → index.ts.hbs} +12 -12
  32. package/templates/auth/better-auth/server/base/tsconfig.json.hbs +10 -0
  33. package/templates/auth/better-auth/server/base/tsdown.config.ts.hbs +7 -0
  34. package/templates/auth/better-auth/web/react/base/src/lib/auth-client.ts.hbs +2 -0
  35. package/templates/auth/better-auth/web/react/next/src/app/dashboard/page.tsx.hbs +8 -17
  36. package/templates/backend/server/{server-base → base}/package.json.hbs +1 -5
  37. package/templates/backend/server/base/tsconfig.json.hbs +13 -0
  38. package/templates/backend/server/base/tsdown.config.ts.hbs +9 -0
  39. package/templates/backend/server/elysia/src/index.ts.hbs +6 -6
  40. package/templates/backend/server/express/src/index.ts.hbs +6 -6
  41. package/templates/backend/server/fastify/src/index.ts.hbs +6 -6
  42. package/templates/backend/server/hono/src/index.ts.hbs +7 -7
  43. package/templates/base/_gitignore +47 -1
  44. package/templates/base/package.json.hbs +1 -3
  45. package/templates/{backend/server/server-base/tsconfig.json.hbs → base/tsconfig.base.json.hbs} +14 -13
  46. package/templates/base/tsconfig.json.hbs +3 -0
  47. package/templates/db/base/_gitignore +34 -0
  48. package/templates/db/base/package.json.hbs +21 -0
  49. package/templates/db/base/tsconfig.json.hbs +10 -0
  50. package/templates/db/base/tsdown.config.ts.hbs +7 -0
  51. package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +11 -2
  52. package/templates/db/drizzle/mysql/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  53. package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +11 -2
  54. package/templates/db/drizzle/postgres/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  55. package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +11 -2
  56. package/templates/db/drizzle/sqlite/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  57. package/templates/db/prisma/mongodb/prisma.config.ts.hbs +9 -1
  58. package/templates/db/prisma/mongodb/src/index.ts.hbs +5 -0
  59. package/templates/db/prisma/mysql/prisma.config.ts.hbs +9 -1
  60. package/templates/db/prisma/mysql/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  61. package/templates/db/prisma/postgres/prisma.config.ts.hbs +11 -3
  62. package/templates/db/prisma/postgres/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  63. package/templates/db/prisma/sqlite/prisma.config.ts.hbs +9 -1
  64. package/templates/db/prisma/sqlite/src/{db/index.ts.hbs → index.ts.hbs} +3 -3
  65. package/templates/deploy/alchemy/alchemy.run.ts.hbs +3 -3
  66. package/templates/examples/ai/fullstack/next/src/app/api/ai/route.ts.hbs +15 -0
  67. package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +6 -6
  68. package/templates/examples/todo/server/mongoose/base/src/routers/todo.ts.hbs +4 -4
  69. package/templates/examples/todo/server/prisma/base/src/routers/todo.ts.hbs +4 -4
  70. package/templates/extras/bunfig.toml.hbs +2 -2
  71. package/templates/frontend/native/nativewind/tsconfig.json.hbs +1 -6
  72. package/templates/frontend/native/unistyles/tsconfig.json.hbs +1 -6
  73. package/templates/frontend/nuxt/tsconfig.json.hbs +0 -4
  74. package/templates/frontend/react/next/package.json.hbs +1 -1
  75. package/templates/frontend/react/next/tsconfig.json.hbs +0 -7
  76. package/templates/frontend/react/react-router/tsconfig.json.hbs +1 -6
  77. package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +1 -1
  78. package/templates/frontend/react/tanstack-router/tsconfig.json.hbs +1 -6
  79. package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +1 -1
  80. package/templates/frontend/react/tanstack-start/tsconfig.json.hbs +1 -6
  81. package/templates/frontend/solid/tsconfig.json.hbs +1 -6
  82. package/templates/frontend/svelte/tsconfig.json.hbs +1 -6
  83. package/templates/api/orpc/server/next/src/app/rpc/[...all]/route.ts.hbs +0 -52
  84. package/templates/api/trpc/server/next/src/app/trpc/[trpc]/route.ts +0 -14
  85. package/templates/backend/server/next/next-env.d.ts +0 -5
  86. package/templates/backend/server/next/next.config.ts +0 -7
  87. package/templates/backend/server/next/package.json.hbs +0 -27
  88. package/templates/backend/server/next/src/app/route.ts +0 -5
  89. package/templates/backend/server/next/src/middleware.ts +0 -19
  90. package/templates/backend/server/next/tsconfig.json.hbs +0 -33
  91. package/templates/db/prisma/mongodb/src/db/index.ts.hbs +0 -5
  92. package/templates/examples/ai/server/next/src/app/ai/route.ts.hbs +0 -15
  93. /package/templates/api/orpc/server/{base/src/lib/orpc.ts.hbs → src/index.ts.hbs} +0 -0
  94. /package/templates/api/trpc/server/{base/src/lib/trpc.ts.hbs → src/index.ts.hbs} +0 -0
  95. /package/templates/auth/better-auth/server/db/drizzle/mysql/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
  96. /package/templates/auth/better-auth/server/db/drizzle/postgres/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
  97. /package/templates/auth/better-auth/server/db/drizzle/sqlite/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
  98. /package/templates/auth/better-auth/server/db/mongoose/mongodb/src/{db/models/auth.model.ts → models/auth.model.ts.hbs} +0 -0
  99. /package/templates/auth/better-auth/server/db/prisma/mongodb/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
  100. /package/templates/auth/better-auth/server/db/prisma/mysql/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
  101. /package/templates/auth/better-auth/server/db/prisma/postgres/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
  102. /package/templates/auth/better-auth/server/db/prisma/sqlite/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
  103. /package/templates/auth/better-auth/web/nuxt/app/middleware/{auth.ts → auth.ts.hbs} +0 -0
  104. /package/templates/backend/server/{server-base → base}/_gitignore +0 -0
  105. /package/templates/db/mongoose/mongodb/src/{db/index.ts.hbs → index.ts.hbs} +0 -0
  106. /package/templates/examples/todo/server/drizzle/mysql/src/{db/schema → schema}/todo.ts +0 -0
  107. /package/templates/examples/todo/server/drizzle/postgres/src/{db/schema → schema}/todo.ts +0 -0
  108. /package/templates/examples/todo/server/drizzle/sqlite/src/{db/schema → schema}/todo.ts +0 -0
  109. /package/templates/examples/todo/server/mongoose/mongodb/src/{db/models/todo.model.ts → models/todo.model.ts.hbs} +0 -0
  110. /package/templates/examples/todo/server/prisma/mongodb/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  111. /package/templates/examples/todo/server/prisma/mysql/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  112. /package/templates/examples/todo/server/prisma/postgres/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  113. /package/templates/examples/todo/server/prisma/sqlite/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
@@ -1,8 +1,17 @@
1
1
  import { defineConfig } from "drizzle-kit";
2
+ import dotenv from "dotenv";
3
+
4
+ dotenv.config({
5
+ {{#if (eq backend "self")}}
6
+ path: "../../apps/web/.env",
7
+ {{else}}
8
+ path: "../../apps/server/.env",
9
+ {{/if}}
10
+ });
2
11
 
3
12
  export default defineConfig({
4
- schema: "./src/db/schema",
5
- out: "./src/db/migrations",
13
+ schema: "./src/schema",
14
+ out: "./src/migrations",
6
15
  {{#if (eq dbSetup "d1")}}
7
16
  // DOCS: https://orm.drizzle.team/docs/guides/d1-http-with-drizzle-kit
8
17
  dialect: "sqlite",
@@ -1,4 +1,4 @@
1
- {{#if (or (eq runtime "bun") (eq runtime "node"))}}
1
+ {{#if (or (eq runtime "bun") (eq runtime "node") (eq runtime "none"))}}
2
2
  import { drizzle } from "drizzle-orm/libsql";
3
3
  import { createClient } from "@libsql/client";
4
4
 
@@ -1,6 +1,14 @@
1
- import "dotenv/config";
2
1
  import path from "node:path";
3
2
  import type { PrismaConfig } from "prisma";
3
+ import dotenv from "dotenv";
4
+
5
+ dotenv.config({
6
+ {{#if (eq backend "self")}}
7
+ path: "../../apps/web/.env",
8
+ {{else}}
9
+ path: "../../apps/server/.env",
10
+ {{/if}}
11
+ });
4
12
 
5
13
  export default {
6
14
  schema: path.join("prisma", "schema"),
@@ -0,0 +1,5 @@
1
+ import { PrismaClient } from "../prisma/generated/client";
2
+
3
+ const prisma = new PrismaClient();
4
+
5
+ export default prisma;
@@ -1,6 +1,14 @@
1
- import "dotenv/config";
2
1
  import path from "node:path";
3
2
  import type { PrismaConfig } from "prisma";
3
+ import dotenv from "dotenv";
4
+
5
+ dotenv.config({
6
+ {{#if (eq backend "self")}}
7
+ path: "../../apps/web/.env",
8
+ {{else}}
9
+ path: "../../apps/server/.env",
10
+ {{/if}}
11
+ });
4
12
 
5
13
  export default {
6
14
  schema: path.join("prisma", "schema"),
@@ -1,4 +1,4 @@
1
- import { PrismaClient } from "../../prisma/generated/client";
1
+ import { PrismaClient } from "../prisma/generated/client";
2
2
  {{#if (eq dbSetup "planetscale")}}
3
3
  import { PrismaPlanetScale } from '@prisma/adapter-planetscale'
4
4
 
@@ -1,8 +1,16 @@
1
- {{#unless (eq dbSetup "prisma-postgres")}}
2
- import "dotenv/config";
3
- {{/unless}}
4
1
  import path from "node:path";
5
2
  import type { PrismaConfig } from "prisma";
3
+ {{#unless (eq dbSetup "prisma-postgres")}}
4
+ import dotenv from "dotenv";
5
+
6
+ dotenv.config({
7
+ {{#if (eq backend "self")}}
8
+ path: "../../apps/web/.env",
9
+ {{else}}
10
+ path: "../../apps/server/.env",
11
+ {{/if}}
12
+ });
13
+ {{/unless}}
6
14
 
7
15
  export default {
8
16
  schema: path.join("prisma", "schema"),
@@ -1,4 +1,4 @@
1
- import { PrismaClient } from "../../prisma/generated/client";
1
+ import { PrismaClient } from "../prisma/generated/client";
2
2
  {{#if (and (eq dbSetup "prisma-postgres") (eq orm "prisma"))}}
3
3
  import { withAccelerate } from "@prisma/extension-accelerate";
4
4
 
@@ -1,6 +1,14 @@
1
- import "dotenv/config";
2
1
  import path from "node:path";
3
2
  import type { PrismaConfig } from "prisma";
3
+ import dotenv from "dotenv";
4
+
5
+ dotenv.config({
6
+ {{#if (eq backend "self")}}
7
+ path: "../../apps/web/.env",
8
+ {{else}}
9
+ path: "../../apps/server/.env",
10
+ {{/if}}
11
+ });
4
12
 
5
13
  export default {
6
14
  schema: path.join("prisma", "schema"),
@@ -1,7 +1,7 @@
1
1
  {{#if (eq dbSetup "d1")}}
2
2
  import { env } from "cloudflare:workers";
3
3
  import { PrismaD1 } from "@prisma/adapter-d1";
4
- import { PrismaClient } from "../../prisma/generated/client";
4
+ import { PrismaClient } from "../prisma/generated/client";
5
5
 
6
6
  const adapter = new PrismaD1(env.DB);
7
7
  const prisma = new PrismaClient({ adapter });
@@ -9,7 +9,7 @@ const prisma = new PrismaClient({ adapter });
9
9
  export default prisma;
10
10
  {{else if (eq dbSetup "turso")}}
11
11
  import { PrismaLibSQL } from "@prisma/adapter-libsql";
12
- import { PrismaClient } from "../../prisma/generated/client";
12
+ import { PrismaClient } from "../prisma/generated/client";
13
13
 
14
14
  const adapter = new PrismaLibSQL({
15
15
  url: process.env.DATABASE_URL || "",
@@ -20,7 +20,7 @@ const prisma = new PrismaClient({ adapter });
20
20
 
21
21
  export default prisma;
22
22
  {{else}}
23
- import { PrismaClient } from "../../prisma/generated/client";
23
+ import { PrismaClient } from "../prisma/generated/client";
24
24
 
25
25
  const prisma = new PrismaClient();
26
26
 
@@ -39,15 +39,15 @@ const app = await alchemy("{{projectName}}");
39
39
 
40
40
  {{#if (and (eq serverDeploy "alchemy") (eq dbSetup "d1"))}}
41
41
  await Exec("db-generate", {
42
- {{#if (and (eq webDeploy "alchemy") (eq serverDeploy "alchemy"))}}cwd: "apps/server",{{/if}}
42
+ {{#if (and (eq webDeploy "alchemy") (eq serverDeploy "alchemy"))}}cwd: "packages/db",{{/if}}
43
43
  command: "{{packageManager}} run db:generate",
44
44
  });
45
45
 
46
46
  const db = await D1Database("database", {
47
47
  {{#if (eq orm "prisma")}}
48
- migrationsDir: "apps/server/prisma/migrations",
48
+ migrationsDir: "packages/db/prisma/migrations",
49
49
  {{else if (eq orm "drizzle")}}
50
- migrationsDir: "apps/server/src/db/migrations",
50
+ migrationsDir: "packages/db/src/migrations",
51
51
  {{/if}}
52
52
  });
53
53
  {{/if}}
@@ -0,0 +1,15 @@
1
+ import { google } from "@ai-sdk/google";
2
+ import { streamText, type UIMessage, convertToModelMessages } from "ai";
3
+
4
+ export const maxDuration = 30;
5
+
6
+ export async function POST(req: Request) {
7
+ const { messages }: { messages: UIMessage[] } = await req.json();
8
+
9
+ const result = streamText({
10
+ model: google("gemini-2.5-flash"),
11
+ messages: convertToModelMessages(messages),
12
+ });
13
+
14
+ return result.toUIMessageStreamResponse();
15
+ }
@@ -1,9 +1,9 @@
1
1
  {{#if (eq api "orpc")}}
2
2
  import { eq } from "drizzle-orm";
3
3
  import z from "zod";
4
- import { db } from "../db";
5
- import { todo } from "../db/schema/todo";
6
- import { publicProcedure } from "../lib/orpc";
4
+ import { db } from "@{{projectName}}/db";
5
+ import { todo } from "@{{projectName}}/db/schema/todo";
6
+ import { publicProcedure } from "../index";
7
7
 
8
8
  export const todoRouter = {
9
9
  getAll: publicProcedure.handler(async () => {
@@ -39,10 +39,10 @@ export const todoRouter = {
39
39
 
40
40
  {{#if (eq api "trpc")}}
41
41
  import z from "zod";
42
- import { router, publicProcedure } from "../lib/trpc";
43
- import { todo } from "../db/schema/todo";
42
+ import { router, publicProcedure } from "../index";
43
+ import { todo } from "@{{projectName}}/db/schema/todo";
44
44
  import { eq } from "drizzle-orm";
45
- import { db } from "../db";
45
+ import { db } from "@{{projectName}}/db";
46
46
 
47
47
  export const todoRouter = router({
48
48
  getAll: publicProcedure.query(async () => {
@@ -1,7 +1,7 @@
1
1
  {{#if (eq api "orpc")}}
2
2
  import z from "zod";
3
- import { publicProcedure } from "../lib/orpc";
4
- import { Todo } from "../db/models/todo.model";
3
+ import { publicProcedure } from "../index";
4
+ import { Todo } from "@{{projectName}}/db/models/todo.model";
5
5
 
6
6
  export const todoRouter = {
7
7
  getAll: publicProcedure.handler(async () => {
@@ -34,8 +34,8 @@ export const todoRouter = {
34
34
 
35
35
  {{#if (eq api "trpc")}}
36
36
  import z from "zod";
37
- import { router, publicProcedure } from "../lib/trpc";
38
- import { Todo } from "../db/models/todo.model";
37
+ import { router, publicProcedure } from "../index";
38
+ import { Todo } from "@{{projectName}}/db/models/todo.model";
39
39
 
40
40
  export const todoRouter = router({
41
41
  getAll: publicProcedure.query(async () => {
@@ -1,7 +1,7 @@
1
1
  {{#if (eq api "orpc")}}
2
2
  import z from "zod";
3
- import prisma from "../db";
4
- import { publicProcedure } from "../lib/orpc";
3
+ import prisma from "@{{projectName}}/db";
4
+ import { publicProcedure } from "../index";
5
5
 
6
6
  export const todoRouter = {
7
7
  getAll: publicProcedure.handler(async () => {
@@ -52,8 +52,8 @@ export const todoRouter = {
52
52
  {{#if (eq api "trpc")}}
53
53
  import { TRPCError } from "@trpc/server";
54
54
  import z from "zod";
55
- import prisma from "../db";
56
- import { publicProcedure, router } from "../lib/trpc";
55
+ import prisma from "@{{projectName}}/db";
56
+ import { publicProcedure, router } from "../index";
57
57
 
58
58
  export const todoRouter = router({
59
59
  getAll: publicProcedure.query(async () => {
@@ -1,6 +1,6 @@
1
1
  [install]
2
- {{#if (includes frontend "nuxt")}}
3
- # linker = "isolated" # Commented out for Nuxt compatibility
2
+ {{#if (or (includes frontend "nuxt") (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
3
+ # linker = "isolated" # having issues with Nuxt and NativeWind/Unistyles
4
4
  {{else}}
5
5
  linker = "isolated"
6
6
  {{/if}}
@@ -14,10 +14,5 @@
14
14
  ".expo/types/**/*.ts",
15
15
  "expo-env.d.ts",
16
16
  "nativewind-env.d.ts"
17
- ],
18
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
19
- "references": [{
20
- "path": "../server"
21
- }]
22
- {{/unless}}
17
+ ]
23
18
  }
@@ -8,10 +8,5 @@
8
8
  "@/*": ["*"]
9
9
  }
10
10
  },
11
- "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"],
12
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
13
- "references": [{
14
- "path": "../server"
15
- }]
16
- {{/unless}}
11
+ "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
17
12
  }
@@ -13,10 +13,6 @@
13
13
  },
14
14
  {
15
15
  "path": "./.nuxt/tsconfig.node.json"
16
- }{{#unless (or (eq backend "convex") (eq backend "none"))}},
17
- {
18
- "path": "../server"
19
16
  }
20
- {{/unless}}
21
17
  ]
22
18
  }
@@ -13,7 +13,7 @@
13
13
  "class-variance-authority": "^0.7.1",
14
14
  "clsx": "^2.1.1",
15
15
  "lucide-react": "^0.487.0",
16
- "next": "15.5.0",
16
+ "next": "15.5.4",
17
17
  "next-themes": "^0.4.6",
18
18
  "react": "19.1.0",
19
19
  "react-dom": "19.1.0",
@@ -40,12 +40,5 @@
40
40
  ],
41
41
  "exclude": [
42
42
  "./node_modules"
43
- ],
44
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
45
- "references": [
46
- {
47
- "path": "../server"
48
- }
49
43
  ]
50
- {{/unless}}
51
44
  }
@@ -23,10 +23,5 @@
23
23
  "resolveJsonModule": true,
24
24
  "skipLibCheck": true,
25
25
  "strict": true
26
- },
27
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
28
- "references": [{
29
- "path": "../server"
30
- }]
31
- {{/unless}}
26
+ }
32
27
  }
@@ -8,7 +8,7 @@ import type { QueryClient } from "@tanstack/react-query";
8
8
  import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
9
9
  import { useState } from "react";
10
10
  import { createTanstackQueryUtils } from "@orpc/tanstack-query";
11
- import type { AppRouterClient } from "../../../server/src/routers";
11
+ import type { AppRouterClient } from "@{{projectName}}/api/routers/index";
12
12
  import { createORPCClient } from "@orpc/client";
13
13
  {{/if}}
14
14
  {{#if (eq api "trpc")}}
@@ -14,10 +14,5 @@
14
14
  "paths": {
15
15
  "@/*": ["./src/*"]
16
16
  }
17
- },
18
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
19
- "references": [{
20
- "path": "../server"
21
- }]
22
- {{/unless}}
17
+ }
23
18
  }
@@ -66,7 +66,7 @@ export interface RouterAppContext {
66
66
  {{else}}
67
67
  {{#if (eq api "trpc")}}
68
68
  import type { TRPCOptionsProxy } from "@trpc/tanstack-react-query";
69
- import type { AppRouter } from "../../../server/src/routers";
69
+ import type { AppRouter } from "@{{projectName}}/api/routers/index";
70
70
  export interface RouterAppContext {
71
71
  trpc: TRPCOptionsProxy<AppRouter>;
72
72
  queryClient: QueryClient;
@@ -24,10 +24,5 @@
24
24
  "paths": {
25
25
  "@/*": ["./src/*"]
26
26
  }
27
- },
28
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
29
- "references": [{
30
- "path": "../server"
31
- }]
32
- {{/unless}}
27
+ }
33
28
  }
@@ -25,10 +25,5 @@
25
25
  "paths": {
26
26
  "@/*": ["./src/*"]
27
27
  }
28
- },
29
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
30
- "references": [{
31
- "path": "../server"
32
- }]
33
- {{/unless}}
28
+ }
34
29
  }
@@ -10,12 +10,7 @@
10
10
  "sourceMap": true,
11
11
  "strict": true,
12
12
  "moduleResolution": "bundler"
13
- },
14
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
15
- "references": [{
16
- "path": "../server"
17
- }]
18
- {{/unless}}
13
+ }
19
14
  // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
20
15
  // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
21
16
  //
@@ -1,52 +0,0 @@
1
- {{#if (eq auth "better-auth")}}
2
- import { createContext } from '@/lib/context'
3
- {{/if}}
4
- import { appRouter } from '@/routers'
5
- import { OpenAPIHandler } from '@orpc/openapi/fetch'
6
- import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins'
7
- import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
8
- import { RPCHandler } from '@orpc/server/fetch'
9
- import { onError } from '@orpc/server'
10
- import { NextRequest } from 'next/server'
11
-
12
- const rpcHandler = new RPCHandler(appRouter, {
13
- interceptors: [
14
- onError((error) => {
15
- console.error(error)
16
- }),
17
- ],
18
- })
19
- const apiHandler = new OpenAPIHandler(appRouter, {
20
- plugins: [
21
- new OpenAPIReferencePlugin({
22
- schemaConverters: [new ZodToJsonSchemaConverter()],
23
- }),
24
- ],
25
- interceptors: [
26
- onError((error) => {
27
- console.error(error)
28
- }),
29
- ],
30
- })
31
-
32
- async function handleRequest(req: NextRequest) {
33
- const rpcResult = await rpcHandler.handle(req, {
34
- prefix: '/rpc',
35
- context: {{#if (eq auth "better-auth")}}await createContext(req){{else}}{}{{/if}},
36
- })
37
- if (rpcResult.response) return rpcResult.response
38
-
39
- const apiResult = await apiHandler.handle(req, {
40
- prefix: '/rpc/api',
41
- context: {{#if (eq auth "better-auth")}}await createContext(req){{else}}{}{{/if}},
42
- })
43
- if (apiResult.response) return apiResult.response
44
-
45
- return new Response('Not found', { status: 404 })
46
- }
47
-
48
- export const GET = handleRequest
49
- export const POST = handleRequest
50
- export const PUT = handleRequest
51
- export const PATCH = handleRequest
52
- export const DELETE = handleRequest
@@ -1,14 +0,0 @@
1
- import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
2
- import { appRouter } from '@/routers';
3
- import { createContext } from '@/lib/context';
4
- import { NextRequest } from 'next/server';
5
-
6
- function handler(req: NextRequest) {
7
- return fetchRequestHandler({
8
- endpoint: '/trpc',
9
- req,
10
- router: appRouter,
11
- createContext: () => createContext(req)
12
- });
13
- }
14
- export { handler as GET, handler as POST };
@@ -1,5 +0,0 @@
1
- /// <reference types="next" />
2
- /// <reference types="next/image-types/global" />
3
-
4
- // NOTE: This file should not be edited
5
- // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -1,7 +0,0 @@
1
- import type { NextConfig } from "next";
2
-
3
- const nextConfig: NextConfig = {
4
- typedRoutes: true,
5
- };
6
-
7
- export default nextConfig;
@@ -1,27 +0,0 @@
1
- {
2
- "name": "server",
3
- "version": "0.1.0",
4
- "private": true,
5
- "scripts": {
6
- "dev": "next dev --turbopack",
7
- "build": "next build",
8
- "start": "next start"
9
- },
10
- "dependencies": {
11
- "next": "15.5.0",
12
- "react": "19.1.0",
13
- "react-dom": "19.1.0",
14
- "dotenv": "^17.2.1"
15
- },
16
- {{#if (eq dbSetup 'supabase')}}
17
- "trustedDependencies": [
18
- "supabase"
19
- ],
20
- {{/if}}
21
- "devDependencies": {
22
- "@types/node": "^20",
23
- "@types/react": "~19.1.10",
24
- "zod": "^4.0.13",
25
- "typescript": "^5"
26
- }
27
- }
@@ -1,5 +0,0 @@
1
- import { NextResponse } from "next/server";
2
-
3
- export async function GET() {
4
- return NextResponse.json({ message: "OK" });
5
- }
@@ -1,19 +0,0 @@
1
- import { NextResponse } from "next/server";
2
-
3
- export function middleware() {
4
- const res = NextResponse.next()
5
-
6
- res.headers.append('Access-Control-Allow-Credentials', "true")
7
- res.headers.append('Access-Control-Allow-Origin', process.env.CORS_ORIGIN || "")
8
- res.headers.append('Access-Control-Allow-Methods', 'GET,POST,OPTIONS')
9
- res.headers.append(
10
- 'Access-Control-Allow-Headers',
11
- 'Content-Type, Authorization'
12
- )
13
-
14
- return res
15
- }
16
-
17
- export const config = {
18
- matcher: '/:path*',
19
- }
@@ -1,33 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2017",
4
- "lib": ["dom", "dom.iterable", "esnext"],
5
- "allowJs": true,
6
- "skipLibCheck": true,
7
- "strict": true,
8
- "noEmit": true,
9
- "esModuleInterop": true,
10
- "module": "esnext",
11
- "moduleResolution": "bundler",
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "jsx": "preserve",
15
- {{#unless (or (eq backend "convex") (eq backend "none"))}}
16
- "composite": true,
17
- {{/unless}}
18
- "incremental": true,
19
- "plugins": [
20
- {
21
- "name": "next"
22
- }
23
- ],
24
- "paths": {
25
- "@/*": ["./src/*"]
26
- {{#if (eq orm 'prisma')}},
27
- "prisma": ["node_modules/prisma"]
28
- {{/if}}
29
- },
30
- },
31
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
32
- "exclude": ["node_modules"]
33
- }
@@ -1,5 +0,0 @@
1
- import { PrismaClient } from "../../prisma/generated/client";
2
-
3
- const prisma = new PrismaClient();
4
-
5
- export default prisma;
@@ -1,15 +0,0 @@
1
- import { google } from '@ai-sdk/google';
2
- import { streamText, type UIMessage, convertToModelMessages } from 'ai';
3
-
4
- export const maxDuration = 30;
5
-
6
- export async function POST(req: Request) {
7
- const { messages }: { messages: UIMessage[] } = await req.json();
8
-
9
- const result = streamText({
10
- model: google('gemini-2.0-flash'),
11
- messages: convertToModelMessages(messages),
12
- });
13
-
14
- return result.toUIMessageStreamResponse();
15
- }