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.
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.js +1 -1
- package/dist/{src-B8TD9m4n.js → src-BywywK-y.js} +825 -418
- package/package.json +2 -1
- package/templates/addons/ruler/.ruler/bts.md.hbs +24 -14
- package/templates/api/orpc/fullstack/next/src/app/api/rpc/[[...rest]]/route.ts.hbs +50 -0
- package/templates/api/orpc/native/utils/orpc.ts.hbs +5 -1
- package/templates/api/orpc/server/_gitignore +34 -0
- package/templates/api/orpc/server/package.json.hbs +22 -0
- package/templates/api/orpc/server/{base/src/lib → src}/context.ts.hbs +6 -6
- package/templates/{backend/server/server-base → api/orpc/server}/src/routers/index.ts.hbs +2 -2
- package/templates/api/orpc/server/tsconfig.json.hbs +10 -0
- package/templates/api/orpc/server/tsdown.config.ts.hbs +7 -0
- package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +1 -1
- package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +4 -2
- package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +1 -1
- package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +1 -1
- package/templates/api/trpc/fullstack/next/src/app/api/trpc/[trpc]/route.ts.hbs +14 -0
- package/templates/api/trpc/native/utils/trpc.ts.hbs +5 -1
- package/templates/api/trpc/server/_gitignore +34 -0
- package/templates/api/trpc/server/package.json.hbs +21 -0
- package/templates/api/trpc/server/{base/src/lib → src}/context.ts.hbs +6 -6
- package/templates/api/trpc/server/src/routers/index.ts.hbs +55 -0
- package/templates/api/trpc/server/tsconfig.json.hbs +10 -0
- package/templates/api/trpc/server/tsdown.config.ts.hbs +7 -0
- package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +6 -4
- 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
- package/templates/auth/better-auth/server/base/_gitignore +34 -0
- package/templates/auth/better-auth/server/base/package.json.hbs +21 -0
- package/templates/auth/better-auth/server/base/src/{lib/auth.ts.hbs → index.ts.hbs} +12 -12
- package/templates/auth/better-auth/server/base/tsconfig.json.hbs +10 -0
- package/templates/auth/better-auth/server/base/tsdown.config.ts.hbs +7 -0
- package/templates/auth/better-auth/web/react/base/src/lib/auth-client.ts.hbs +2 -0
- package/templates/auth/better-auth/web/react/next/src/app/dashboard/page.tsx.hbs +8 -17
- package/templates/backend/server/{server-base → base}/package.json.hbs +1 -5
- package/templates/backend/server/base/tsconfig.json.hbs +13 -0
- package/templates/backend/server/base/tsdown.config.ts.hbs +9 -0
- package/templates/backend/server/elysia/src/index.ts.hbs +6 -6
- package/templates/backend/server/express/src/index.ts.hbs +6 -6
- package/templates/backend/server/fastify/src/index.ts.hbs +6 -6
- package/templates/backend/server/hono/src/index.ts.hbs +7 -7
- package/templates/base/_gitignore +47 -1
- package/templates/base/package.json.hbs +1 -3
- package/templates/{backend/server/server-base/tsconfig.json.hbs → base/tsconfig.base.json.hbs} +14 -13
- package/templates/base/tsconfig.json.hbs +3 -0
- package/templates/db/base/_gitignore +34 -0
- package/templates/db/base/package.json.hbs +21 -0
- package/templates/db/base/tsconfig.json.hbs +10 -0
- package/templates/db/base/tsdown.config.ts.hbs +7 -0
- package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +11 -2
- package/templates/db/drizzle/mysql/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
- package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +11 -2
- package/templates/db/drizzle/postgres/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
- package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +11 -2
- package/templates/db/drizzle/sqlite/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
- package/templates/db/prisma/mongodb/prisma.config.ts.hbs +9 -1
- package/templates/db/prisma/mongodb/src/index.ts.hbs +5 -0
- package/templates/db/prisma/mysql/prisma.config.ts.hbs +9 -1
- package/templates/db/prisma/mysql/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
- package/templates/db/prisma/postgres/prisma.config.ts.hbs +11 -3
- package/templates/db/prisma/postgres/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
- package/templates/db/prisma/sqlite/prisma.config.ts.hbs +9 -1
- package/templates/db/prisma/sqlite/src/{db/index.ts.hbs → index.ts.hbs} +3 -3
- package/templates/deploy/alchemy/alchemy.run.ts.hbs +3 -3
- package/templates/examples/ai/fullstack/next/src/app/api/ai/route.ts.hbs +15 -0
- package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +6 -6
- package/templates/examples/todo/server/mongoose/base/src/routers/todo.ts.hbs +4 -4
- package/templates/examples/todo/server/prisma/base/src/routers/todo.ts.hbs +4 -4
- package/templates/extras/bunfig.toml.hbs +2 -2
- package/templates/frontend/native/nativewind/tsconfig.json.hbs +1 -6
- package/templates/frontend/native/unistyles/tsconfig.json.hbs +1 -6
- package/templates/frontend/nuxt/tsconfig.json.hbs +0 -4
- package/templates/frontend/react/next/package.json.hbs +1 -1
- package/templates/frontend/react/next/tsconfig.json.hbs +0 -7
- package/templates/frontend/react/react-router/tsconfig.json.hbs +1 -6
- package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +1 -1
- package/templates/frontend/react/tanstack-router/tsconfig.json.hbs +1 -6
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +1 -1
- package/templates/frontend/react/tanstack-start/tsconfig.json.hbs +1 -6
- package/templates/frontend/solid/tsconfig.json.hbs +1 -6
- package/templates/frontend/svelte/tsconfig.json.hbs +1 -6
- package/templates/api/orpc/server/next/src/app/rpc/[...all]/route.ts.hbs +0 -52
- package/templates/api/trpc/server/next/src/app/trpc/[trpc]/route.ts +0 -14
- package/templates/backend/server/next/next-env.d.ts +0 -5
- package/templates/backend/server/next/next.config.ts +0 -7
- package/templates/backend/server/next/package.json.hbs +0 -27
- package/templates/backend/server/next/src/app/route.ts +0 -5
- package/templates/backend/server/next/src/middleware.ts +0 -19
- package/templates/backend/server/next/tsconfig.json.hbs +0 -33
- package/templates/db/prisma/mongodb/src/db/index.ts.hbs +0 -5
- package/templates/examples/ai/server/next/src/app/ai/route.ts.hbs +0 -15
- /package/templates/api/orpc/server/{base/src/lib/orpc.ts.hbs → src/index.ts.hbs} +0 -0
- /package/templates/api/trpc/server/{base/src/lib/trpc.ts.hbs → src/index.ts.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/drizzle/mysql/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/drizzle/postgres/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/drizzle/sqlite/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/mongoose/mongodb/src/{db/models/auth.model.ts → models/auth.model.ts.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/prisma/mongodb/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/prisma/mysql/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/prisma/postgres/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/prisma/sqlite/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
- /package/templates/auth/better-auth/web/nuxt/app/middleware/{auth.ts → auth.ts.hbs} +0 -0
- /package/templates/backend/server/{server-base → base}/_gitignore +0 -0
- /package/templates/db/mongoose/mongodb/src/{db/index.ts.hbs → index.ts.hbs} +0 -0
- /package/templates/examples/todo/server/drizzle/mysql/src/{db/schema → schema}/todo.ts +0 -0
- /package/templates/examples/todo/server/drizzle/postgres/src/{db/schema → schema}/todo.ts +0 -0
- /package/templates/examples/todo/server/drizzle/sqlite/src/{db/schema → schema}/todo.ts +0 -0
- /package/templates/examples/todo/server/mongoose/mongodb/src/{db/models/todo.model.ts → models/todo.model.ts.hbs} +0 -0
- /package/templates/examples/todo/server/prisma/mongodb/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
- /package/templates/examples/todo/server/prisma/mysql/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
- /package/templates/examples/todo/server/prisma/postgres/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
- /package/templates/examples/todo/server/prisma/sqlite/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# dependencies (bun install)
|
|
2
|
+
node_modules
|
|
3
|
+
|
|
4
|
+
# output
|
|
5
|
+
out
|
|
6
|
+
dist
|
|
7
|
+
*.tgz
|
|
8
|
+
|
|
9
|
+
# code coverage
|
|
10
|
+
coverage
|
|
11
|
+
*.lcov
|
|
12
|
+
|
|
13
|
+
# logs
|
|
14
|
+
logs
|
|
15
|
+
_.log
|
|
16
|
+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
|
17
|
+
|
|
18
|
+
# dotenv environment variable files
|
|
19
|
+
.env
|
|
20
|
+
.env.development.local
|
|
21
|
+
.env.test.local
|
|
22
|
+
.env.production.local
|
|
23
|
+
.env.local
|
|
24
|
+
|
|
25
|
+
# caches
|
|
26
|
+
.eslintcache
|
|
27
|
+
.cache
|
|
28
|
+
*.tsbuildinfo
|
|
29
|
+
|
|
30
|
+
# IntelliJ based IDEs
|
|
31
|
+
.idea
|
|
32
|
+
|
|
33
|
+
# Finder (MacOS) folder config
|
|
34
|
+
.DS_Store
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@{{projectName}}/auth",
|
|
3
|
+
"exports": {
|
|
4
|
+
".": {
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"default": "./src/index.ts"
|
|
7
|
+
},
|
|
8
|
+
"./*": {
|
|
9
|
+
"types": "./dist/*.d.ts",
|
|
10
|
+
"default": "./src/*.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsdown"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"typescript": "^5"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -6,9 +6,9 @@ import { expo } from "@better-auth/expo";
|
|
|
6
6
|
{{/if}}
|
|
7
7
|
{{#if (eq payments "polar")}}
|
|
8
8
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
9
|
-
import { polarClient } from "./payments";
|
|
9
|
+
import { polarClient } from "./lib/payments";
|
|
10
10
|
{{/if}}
|
|
11
|
-
import prisma from "
|
|
11
|
+
import prisma from "@{{projectName}}/db";
|
|
12
12
|
|
|
13
13
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
14
14
|
database: prismaAdapter(prisma, {
|
|
@@ -66,7 +66,7 @@ export const auth = betterAuth<BetterAuthOptions>({
|
|
|
66
66
|
{{/if}}
|
|
67
67
|
|
|
68
68
|
{{#if (eq orm "drizzle")}}
|
|
69
|
-
{{#if (or (eq runtime "bun") (eq runtime "node"))}}
|
|
69
|
+
{{#if (or (eq runtime "bun") (eq runtime "node") (eq runtime "none"))}}
|
|
70
70
|
import { betterAuth, type BetterAuthOptions } from "better-auth";
|
|
71
71
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
72
72
|
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
@@ -74,10 +74,10 @@ import { expo } from "@better-auth/expo";
|
|
|
74
74
|
{{/if}}
|
|
75
75
|
{{#if (eq payments "polar")}}
|
|
76
76
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
77
|
-
import { polarClient } from "./payments";
|
|
77
|
+
import { polarClient } from "./lib/payments";
|
|
78
78
|
{{/if}}
|
|
79
|
-
import { db } from "
|
|
80
|
-
import * as schema from "
|
|
79
|
+
import { db } from "@{{projectName}}/db";
|
|
80
|
+
import * as schema from "@{{projectName}}/db/schema/auth";
|
|
81
81
|
|
|
82
82
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
83
83
|
database: drizzleAdapter(db, {
|
|
@@ -142,10 +142,10 @@ import { expo } from "@better-auth/expo";
|
|
|
142
142
|
{{/if}}
|
|
143
143
|
{{#if (eq payments "polar")}}
|
|
144
144
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
145
|
-
import { polarClient } from "./payments";
|
|
145
|
+
import { polarClient } from "./lib/payments";
|
|
146
146
|
{{/if}}
|
|
147
|
-
import { db } from "
|
|
148
|
-
import * as schema from "
|
|
147
|
+
import { db } from "@{{projectName}}/db";
|
|
148
|
+
import * as schema from "@{{projectName}}/db/schema/auth";
|
|
149
149
|
import { env } from "cloudflare:workers";
|
|
150
150
|
|
|
151
151
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
@@ -224,9 +224,9 @@ import { expo } from "@better-auth/expo";
|
|
|
224
224
|
{{/if}}
|
|
225
225
|
{{#if (eq payments "polar")}}
|
|
226
226
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
227
|
-
import { polarClient } from "./payments";
|
|
227
|
+
import { polarClient } from "./lib/payments";
|
|
228
228
|
{{/if}}
|
|
229
|
-
import { client } from "
|
|
229
|
+
import { client } from "@{{projectName}}/db";
|
|
230
230
|
|
|
231
231
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
232
232
|
database: mongodbAdapter(client),
|
|
@@ -285,7 +285,7 @@ import { expo } from "@better-auth/expo";
|
|
|
285
285
|
{{/if}}
|
|
286
286
|
{{#if (eq payments "polar")}}
|
|
287
287
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
288
|
-
import { polarClient } from "./payments";
|
|
288
|
+
import { polarClient } from "./lib/payments";
|
|
289
289
|
{{/if}}
|
|
290
290
|
|
|
291
291
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
@@ -4,12 +4,14 @@ import { polarClient } from "@polar-sh/better-auth";
|
|
|
4
4
|
{{/if}}
|
|
5
5
|
|
|
6
6
|
export const authClient = createAuthClient({
|
|
7
|
+
{{#unless (eq backend "self")}}
|
|
7
8
|
baseURL:
|
|
8
9
|
{{#if (includes frontend "next")}}
|
|
9
10
|
process.env.NEXT_PUBLIC_SERVER_URL,
|
|
10
11
|
{{else}}
|
|
11
12
|
import.meta.env.VITE_SERVER_URL,
|
|
12
13
|
{{/if}}
|
|
14
|
+
{{/unless}}
|
|
13
15
|
{{#if (eq payments "polar")}}
|
|
14
16
|
plugins: [polarClient()]
|
|
15
17
|
{{/if}}
|
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
import { authClient } from "@/lib/auth-client";
|
|
2
1
|
import { redirect } from "next/navigation";
|
|
3
2
|
import Dashboard from "./dashboard";
|
|
4
3
|
import { headers } from "next/headers";
|
|
4
|
+
import { auth } from "@{{projectName}}/auth";
|
|
5
5
|
|
|
6
6
|
export default async function DashboardPage() {
|
|
7
|
-
const session = await
|
|
8
|
-
|
|
9
|
-
headers: await headers()
|
|
10
|
-
}
|
|
7
|
+
const session = await auth.api.getSession({
|
|
8
|
+
headers: await headers(),
|
|
11
9
|
});
|
|
12
10
|
|
|
13
|
-
if (!session
|
|
11
|
+
if (!session?.user) {
|
|
14
12
|
redirect("/login");
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
{{#if (eq payments "polar")}}
|
|
18
|
-
const { data: customerState
|
|
19
|
-
|
|
20
|
-
headers: await headers()
|
|
21
|
-
}
|
|
16
|
+
const { data: customerState } = await auth.api.customer.state({
|
|
17
|
+
headers: await headers(),
|
|
22
18
|
});
|
|
23
19
|
{{/if}}
|
|
24
20
|
|
|
25
21
|
return (
|
|
26
22
|
<div>
|
|
27
23
|
<h1>Dashboard</h1>
|
|
28
|
-
<p>Welcome {session.
|
|
29
|
-
<Dashboard
|
|
30
|
-
session={session.data}
|
|
31
|
-
{{#if (eq payments "polar")}}
|
|
32
|
-
customerState={customerState}
|
|
33
|
-
{{/if}}
|
|
34
|
-
/>
|
|
24
|
+
<p>Welcome {session.user.name}</p>
|
|
25
|
+
<Dashboard session={session} {{#if (eq payments "polar")}}customerState={customerState}{{/if}} />
|
|
35
26
|
</div>
|
|
36
27
|
);
|
|
37
28
|
}
|
|
@@ -7,17 +7,13 @@
|
|
|
7
7
|
"check-types": "tsc -b",
|
|
8
8
|
"compile": "bun build --compile --minify --sourcemap --bytecode ./src/index.ts --outfile server"
|
|
9
9
|
},
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"dotenv": "^17.2.1",
|
|
12
|
-
"zod": "^4.0.2"
|
|
13
|
-
},
|
|
10
|
+
"dependencies": {},
|
|
14
11
|
{{#if (eq dbSetup 'supabase')}}
|
|
15
12
|
"trustedDependencies": [
|
|
16
13
|
"supabase"
|
|
17
14
|
],
|
|
18
15
|
{{/if}}
|
|
19
16
|
"devDependencies": {
|
|
20
|
-
"tsdown": "^0.15.1",
|
|
21
17
|
"typescript": "^5.8.2"
|
|
22
18
|
}
|
|
23
19
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"outDir": "dist",
|
|
6
|
+
"baseUrl": ".",
|
|
7
|
+
"paths": {
|
|
8
|
+
"@/*": ["./src/*"]
|
|
9
|
+
},
|
|
10
|
+
"jsx": "react-jsx"{{#if (eq backend "hono")}},
|
|
11
|
+
"jsxImportSource": "hono/jsx"{{/if}}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -9,8 +9,8 @@ import { google } from "@ai-sdk/google";
|
|
|
9
9
|
import { convertToModelMessages, streamText } from "ai";
|
|
10
10
|
{{/if}}
|
|
11
11
|
{{#if (eq api "trpc")}}
|
|
12
|
-
import { createContext } from "
|
|
13
|
-
import { appRouter } from "
|
|
12
|
+
import { createContext } from "@{{projectName}}/api/context";
|
|
13
|
+
import { appRouter } from "@{{projectName}}/api/routers/index";
|
|
14
14
|
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
|
15
15
|
{{/if}}
|
|
16
16
|
{{#if (eq api "orpc")}}
|
|
@@ -19,11 +19,11 @@ import { OpenAPIReferencePlugin } from "@orpc/openapi/plugins";
|
|
|
19
19
|
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
|
|
20
20
|
import { RPCHandler } from "@orpc/server/fetch";
|
|
21
21
|
import { onError } from "@orpc/server";
|
|
22
|
-
import { appRouter } from "
|
|
23
|
-
import { createContext } from "
|
|
22
|
+
import { appRouter } from "@{{projectName}}/api/routers/index";
|
|
23
|
+
import { createContext } from "@{{projectName}}/api/context";
|
|
24
24
|
{{/if}}
|
|
25
25
|
{{#if (eq auth "better-auth")}}
|
|
26
|
-
import { auth } from "
|
|
26
|
+
import { auth } from "@{{projectName}}/auth";
|
|
27
27
|
{{/if}}
|
|
28
28
|
|
|
29
29
|
{{#if (eq api "orpc")}}
|
|
@@ -104,7 +104,7 @@ const app = new Elysia()
|
|
|
104
104
|
const body = await context.request.json();
|
|
105
105
|
const uiMessages = body.messages || [];
|
|
106
106
|
const result = streamText({
|
|
107
|
-
model: google("gemini-2.
|
|
107
|
+
model: google("gemini-2.5-flash"),
|
|
108
108
|
messages: convertToModelMessages(uiMessages)
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
2
|
{{#if (eq api "trpc")}}
|
|
3
3
|
import { createExpressMiddleware } from "@trpc/server/adapters/express";
|
|
4
|
-
import { createContext } from "
|
|
5
|
-
import { appRouter } from "
|
|
4
|
+
import { createContext } from "@{{projectName}}/api/context";
|
|
5
|
+
import { appRouter } from "@{{projectName}}/api/routers/index";
|
|
6
6
|
{{/if}}
|
|
7
7
|
{{#if (eq api "orpc")}}
|
|
8
8
|
import { OpenAPIHandler } from "@orpc/openapi/node";
|
|
@@ -10,9 +10,9 @@ import { OpenAPIReferencePlugin } from "@orpc/openapi/plugins";
|
|
|
10
10
|
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
|
|
11
11
|
import { RPCHandler } from "@orpc/server/node";
|
|
12
12
|
import { onError } from "@orpc/server";
|
|
13
|
-
import { appRouter } from "
|
|
13
|
+
import { appRouter } from "@{{projectName}}/api/routers/index";
|
|
14
14
|
{{#if (eq auth "better-auth")}}
|
|
15
|
-
import { createContext } from "
|
|
15
|
+
import { createContext } from "@{{projectName}}/api/context";
|
|
16
16
|
{{/if}}
|
|
17
17
|
{{/if}}
|
|
18
18
|
import cors from "cors";
|
|
@@ -22,7 +22,7 @@ import { streamText, type UIMessage, convertToModelMessages } from "ai";
|
|
|
22
22
|
import { google } from "@ai-sdk/google";
|
|
23
23
|
{{/if}}
|
|
24
24
|
{{#if (eq auth "better-auth")}}
|
|
25
|
-
import { auth } from "
|
|
25
|
+
import { auth } from "@{{projectName}}/auth";
|
|
26
26
|
import { toNodeHandler } from "better-auth/node";
|
|
27
27
|
{{/if}}
|
|
28
28
|
|
|
@@ -105,7 +105,7 @@ app.use(express.json());
|
|
|
105
105
|
app.post("/ai", async (req, res) => {
|
|
106
106
|
const { messages = [] } = (req.body || {}) as { messages: UIMessage[] };
|
|
107
107
|
const result = streamText({
|
|
108
|
-
model: google("gemini-
|
|
108
|
+
model: google("gemini-2.5-flash"),
|
|
109
109
|
messages: convertToModelMessages(messages),
|
|
110
110
|
});
|
|
111
111
|
result.pipeUIMessageStreamToResponse(res);
|
|
@@ -4,8 +4,8 @@ import fastifyCors from "@fastify/cors";
|
|
|
4
4
|
|
|
5
5
|
{{#if (eq api "trpc")}}
|
|
6
6
|
import { fastifyTRPCPlugin, type FastifyTRPCPluginOptions } from "@trpc/server/adapters/fastify";
|
|
7
|
-
import { createContext } from "
|
|
8
|
-
import { appRouter, type AppRouter } from "
|
|
7
|
+
import { createContext } from "@{{projectName}}/api/context";
|
|
8
|
+
import { appRouter, type AppRouter } from "@{{projectName}}/api/routers/index";
|
|
9
9
|
{{/if}}
|
|
10
10
|
|
|
11
11
|
{{#if (eq api "orpc")}}
|
|
@@ -15,10 +15,10 @@ import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
|
|
|
15
15
|
import { RPCHandler } from "@orpc/server/node";
|
|
16
16
|
import { CORSPlugin } from "@orpc/server/plugins";
|
|
17
17
|
import { onError } from "@orpc/server";
|
|
18
|
-
import { appRouter } from "
|
|
18
|
+
import { appRouter } from "@{{projectName}}/api/routers/index";
|
|
19
19
|
import { createServer } from "node:http";
|
|
20
20
|
{{#if (eq auth "better-auth")}}
|
|
21
|
-
import { createContext } from "
|
|
21
|
+
import { createContext } from "@{{projectName}}/api/context";
|
|
22
22
|
{{/if}}
|
|
23
23
|
{{/if}}
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ import { google } from "@ai-sdk/google";
|
|
|
28
28
|
{{/if}}
|
|
29
29
|
|
|
30
30
|
{{#if (eq auth "better-auth")}}
|
|
31
|
-
import { auth } from "
|
|
31
|
+
import { auth } from "@{{projectName}}/auth";
|
|
32
32
|
{{/if}}
|
|
33
33
|
|
|
34
34
|
const baseCorsConfig = {
|
|
@@ -161,7 +161,7 @@ interface AiRequestBody {
|
|
|
161
161
|
fastify.post('/ai', async function (request) {
|
|
162
162
|
const { messages } = request.body as AiRequestBody;
|
|
163
163
|
const result = streamText({
|
|
164
|
-
model: google('gemini-
|
|
164
|
+
model: google('gemini-2.5-flash'),
|
|
165
165
|
messages: convertToModelMessages(messages),
|
|
166
166
|
});
|
|
167
167
|
|
|
@@ -10,16 +10,16 @@ import { OpenAPIReferencePlugin } from "@orpc/openapi/plugins";
|
|
|
10
10
|
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
|
|
11
11
|
import { RPCHandler } from "@orpc/server/fetch";
|
|
12
12
|
import { onError } from "@orpc/server";
|
|
13
|
-
import { createContext } from "
|
|
14
|
-
import { appRouter } from "
|
|
13
|
+
import { createContext } from "@{{projectName}}/api/context";
|
|
14
|
+
import { appRouter } from "@{{projectName}}/api/routers/index";
|
|
15
15
|
{{/if}}
|
|
16
16
|
{{#if (eq api "trpc")}}
|
|
17
17
|
import { trpcServer } from "@hono/trpc-server";
|
|
18
|
-
import { createContext } from "
|
|
19
|
-
import { appRouter } from "
|
|
18
|
+
import { createContext } from "@{{projectName}}/api/context";
|
|
19
|
+
import { appRouter } from "@{{projectName}}/api/routers/index";
|
|
20
20
|
{{/if}}
|
|
21
21
|
{{#if (eq auth "better-auth")}}
|
|
22
|
-
import { auth } from "
|
|
22
|
+
import { auth } from "@{{projectName}}/auth";
|
|
23
23
|
{{/if}}
|
|
24
24
|
import { Hono } from "hono";
|
|
25
25
|
import { cors } from "hono/cors";
|
|
@@ -121,7 +121,7 @@ app.post("/ai", async (c) => {
|
|
|
121
121
|
const body = await c.req.json();
|
|
122
122
|
const uiMessages = body.messages || [];
|
|
123
123
|
const result = streamText({
|
|
124
|
-
model: google("gemini-
|
|
124
|
+
model: google("gemini-2.5-flash"),
|
|
125
125
|
messages: convertToModelMessages(uiMessages),
|
|
126
126
|
});
|
|
127
127
|
|
|
@@ -137,7 +137,7 @@ app.post("/ai", async (c) => {
|
|
|
137
137
|
apiKey: env.GOOGLE_GENERATIVE_AI_API_KEY,
|
|
138
138
|
});
|
|
139
139
|
const result = streamText({
|
|
140
|
-
model: google("gemini-
|
|
140
|
+
model: google("gemini-2.5-flash"),
|
|
141
141
|
messages: convertToModelMessages(uiMessages),
|
|
142
142
|
});
|
|
143
143
|
|
|
@@ -1,4 +1,50 @@
|
|
|
1
|
+
# Dependencies
|
|
1
2
|
node_modules
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Build outputs
|
|
7
|
+
dist
|
|
8
|
+
build
|
|
9
|
+
*.tsbuildinfo
|
|
10
|
+
|
|
11
|
+
# Environment variables
|
|
12
|
+
.env
|
|
13
|
+
.env*.local
|
|
14
|
+
|
|
15
|
+
# IDEs and editors
|
|
16
|
+
.vscode/*
|
|
17
|
+
!.vscode/settings.json
|
|
18
|
+
!.vscode/tasks.json
|
|
19
|
+
!.vscode/launch.json
|
|
20
|
+
!.vscode/extensions.json
|
|
21
|
+
.idea
|
|
22
|
+
*.swp
|
|
23
|
+
*.swo
|
|
24
|
+
*~
|
|
25
|
+
.DS_Store
|
|
26
|
+
|
|
27
|
+
# Logs
|
|
28
|
+
logs
|
|
29
|
+
*.log
|
|
30
|
+
npm-debug.log*
|
|
31
|
+
yarn-debug.log*
|
|
32
|
+
yarn-error.log*
|
|
33
|
+
lerna-debug.log*
|
|
34
|
+
.pnpm-debug.log*
|
|
35
|
+
|
|
36
|
+
# Turbo
|
|
2
37
|
.turbo
|
|
38
|
+
|
|
39
|
+
# Better-T-Stack
|
|
3
40
|
.alchemy
|
|
4
|
-
|
|
41
|
+
|
|
42
|
+
# Testing
|
|
43
|
+
coverage
|
|
44
|
+
.nyc_output
|
|
45
|
+
|
|
46
|
+
# Misc
|
|
47
|
+
*.tgz
|
|
48
|
+
.cache
|
|
49
|
+
tmp
|
|
50
|
+
temp
|
package/templates/{backend/server/server-base/tsconfig.json.hbs → base/tsconfig.base.json.hbs}
RENAMED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
2
3
|
"compilerOptions": {
|
|
3
4
|
"target": "ESNext",
|
|
4
5
|
"module": "ESNext",
|
|
5
6
|
"moduleResolution": "bundler",
|
|
7
|
+
"lib": ["ESNext"],
|
|
6
8
|
"verbatimModuleSyntax": true,
|
|
7
9
|
"strict": true,
|
|
8
10
|
"skipLibCheck": true,
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noUncheckedIndexedAccess": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"noFallthroughCasesInSwitch": true,
|
|
15
20
|
"types": [
|
|
16
21
|
{{#if (eq runtime "node")}}
|
|
17
22
|
"node"
|
|
@@ -20,13 +25,9 @@
|
|
|
20
25
|
{{else if (eq runtime "workers")}}
|
|
21
26
|
"node"
|
|
22
27
|
{{else}}
|
|
23
|
-
"node"
|
|
24
|
-
"bun"
|
|
28
|
+
"node"
|
|
25
29
|
{{/if}}{{#if (eq serverDeploy "alchemy")}},
|
|
26
30
|
"@cloudflare/workers-types"{{/if}}
|
|
27
|
-
]
|
|
28
|
-
"composite": true{{/unless}},
|
|
29
|
-
"jsx": "react-jsx"{{#if (eq backend "hono")}},
|
|
30
|
-
"jsxImportSource": "hono/jsx"{{/if}}
|
|
31
|
+
]
|
|
31
32
|
}
|
|
32
|
-
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# dependencies (bun install)
|
|
2
|
+
node_modules
|
|
3
|
+
|
|
4
|
+
# output
|
|
5
|
+
out
|
|
6
|
+
dist
|
|
7
|
+
*.tgz
|
|
8
|
+
|
|
9
|
+
# code coverage
|
|
10
|
+
coverage
|
|
11
|
+
*.lcov
|
|
12
|
+
|
|
13
|
+
# logs
|
|
14
|
+
logs
|
|
15
|
+
_.log
|
|
16
|
+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
|
17
|
+
|
|
18
|
+
# dotenv environment variable files
|
|
19
|
+
.env
|
|
20
|
+
.env.development.local
|
|
21
|
+
.env.test.local
|
|
22
|
+
.env.production.local
|
|
23
|
+
.env.local
|
|
24
|
+
|
|
25
|
+
# caches
|
|
26
|
+
.eslintcache
|
|
27
|
+
.cache
|
|
28
|
+
*.tsbuildinfo
|
|
29
|
+
|
|
30
|
+
# IntelliJ based IDEs
|
|
31
|
+
.idea
|
|
32
|
+
|
|
33
|
+
# Finder (MacOS) folder config
|
|
34
|
+
.DS_Store
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@{{projectName}}/db",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": {
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"default": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"./*": {
|
|
10
|
+
"types": "./dist/*.d.ts",
|
|
11
|
+
"default": "./src/*.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsdown"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"typescript": "^5"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -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/
|
|
5
|
-
out: "./src/
|
|
13
|
+
schema: "./src/schema",
|
|
14
|
+
out: "./src/migrations",
|
|
6
15
|
dialect: "mysql",
|
|
7
16
|
dbCredentials: {
|
|
8
17
|
url: process.env.DATABASE_URL || "",
|
|
@@ -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/
|
|
5
|
-
out: "./src/
|
|
13
|
+
schema: "./src/schema",
|
|
14
|
+
out: "./src/migrations",
|
|
6
15
|
dialect: "postgresql",
|
|
7
16
|
dbCredentials: {
|
|
8
17
|
url: process.env.DATABASE_URL || "",
|