create-better-t-stack 2.49.1 → 2.50.0-canary.dd7000f2

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 (96) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.js +1 -1
  4. package/dist/{src-CKCxH6aF.js → src-dv6H37db.js} +518 -286
  5. package/package.json +2 -1
  6. package/templates/api/orpc/server/_gitignore +34 -0
  7. package/templates/api/orpc/server/package.json.hbs +24 -0
  8. package/templates/api/orpc/server/{base/src/lib → src}/context.ts.hbs +6 -6
  9. package/templates/{backend/server/server-base → api/orpc/server}/src/routers/index.ts.hbs +2 -2
  10. package/templates/api/orpc/server/tsconfig.json.hbs +10 -0
  11. package/templates/api/orpc/server/tsdown.config.ts.hbs +7 -0
  12. package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +1 -1
  13. package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +1 -1
  14. package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +1 -1
  15. package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +1 -1
  16. package/templates/api/trpc/server/_gitignore +34 -0
  17. package/templates/api/trpc/server/package.json.hbs +23 -0
  18. package/templates/api/trpc/server/{base/src/lib → src}/context.ts.hbs +6 -6
  19. package/templates/api/trpc/server/src/routers/index.ts.hbs +55 -0
  20. package/templates/api/trpc/server/tsconfig.json.hbs +13 -0
  21. package/templates/api/trpc/server/tsdown.config.ts.hbs +7 -0
  22. package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +2 -2
  23. package/templates/auth/better-auth/server/base/_gitignore +34 -0
  24. package/templates/auth/better-auth/server/base/package.json.hbs +24 -0
  25. package/templates/auth/better-auth/server/base/src/{lib/auth.ts.hbs → index.ts.hbs} +7 -7
  26. package/templates/auth/better-auth/server/base/tsconfig.json.hbs +13 -0
  27. package/templates/auth/better-auth/server/base/tsdown.config.ts.hbs +7 -0
  28. package/templates/auth/clerk/convex/web/react/tanstack-start/src/server.ts.hbs +1 -0
  29. package/templates/backend/server/{server-base → base}/package.json.hbs +0 -1
  30. package/templates/backend/server/{server-base → base}/tsconfig.json.hbs +5 -10
  31. package/templates/backend/server/base/tsdown.config.ts.hbs +14 -0
  32. package/templates/backend/server/elysia/src/index.ts.hbs +6 -6
  33. package/templates/backend/server/express/src/index.ts.hbs +6 -6
  34. package/templates/backend/server/fastify/src/index.ts.hbs +6 -6
  35. package/templates/backend/server/hono/src/index.ts.hbs +7 -7
  36. package/templates/base/_gitignore +47 -1
  37. package/templates/base/package.json.hbs +1 -3
  38. package/templates/base/tsconfig.base.json +23 -0
  39. package/templates/db/base/_gitignore +34 -0
  40. package/templates/db/base/package.json.hbs +23 -0
  41. package/templates/db/base/tsconfig.json.hbs +13 -0
  42. package/templates/db/base/tsdown.config.ts.hbs +7 -0
  43. package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +7 -2
  44. package/templates/db/drizzle/mysql/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  45. package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +7 -2
  46. package/templates/db/drizzle/postgres/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  47. package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +7 -2
  48. package/templates/db/drizzle/sqlite/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  49. package/templates/db/prisma/mongodb/prisma.config.ts.hbs +5 -1
  50. package/templates/db/prisma/mongodb/src/index.ts.hbs +5 -0
  51. package/templates/db/prisma/mysql/prisma.config.ts.hbs +5 -1
  52. package/templates/db/prisma/mysql/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  53. package/templates/db/prisma/postgres/prisma.config.ts.hbs +7 -3
  54. package/templates/db/prisma/postgres/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  55. package/templates/db/prisma/sqlite/prisma.config.ts.hbs +5 -1
  56. package/templates/db/prisma/sqlite/src/{db/index.ts.hbs → index.ts.hbs} +3 -3
  57. package/templates/deploy/wrangler/web/react/tanstack-start/wrangler.jsonc.hbs +1 -1
  58. package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +6 -6
  59. package/templates/examples/todo/server/mongoose/base/src/routers/todo.ts.hbs +4 -4
  60. package/templates/examples/todo/server/prisma/base/src/routers/todo.ts.hbs +4 -4
  61. package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +1 -1
  62. package/templates/frontend/react/tanstack-start/package.json.hbs +7 -7
  63. package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +5 -5
  64. package/templates/frontend/react/tanstack-start/vite.config.ts.hbs +1 -1
  65. package/templates/api/orpc/server/next/src/app/rpc/[...all]/route.ts.hbs +0 -52
  66. package/templates/api/trpc/server/next/src/app/trpc/[trpc]/route.ts +0 -14
  67. package/templates/auth/better-auth/server/next/src/app/api/auth/[...all]/route.ts +0 -4
  68. package/templates/backend/server/next/next-env.d.ts +0 -5
  69. package/templates/backend/server/next/next.config.ts +0 -7
  70. package/templates/backend/server/next/package.json.hbs +0 -27
  71. package/templates/backend/server/next/src/app/route.ts +0 -5
  72. package/templates/backend/server/next/src/middleware.ts +0 -19
  73. package/templates/backend/server/next/tsconfig.json.hbs +0 -33
  74. package/templates/db/prisma/mongodb/src/db/index.ts.hbs +0 -5
  75. package/templates/examples/ai/server/next/src/app/ai/route.ts.hbs +0 -15
  76. /package/templates/api/orpc/server/{base/src/lib/orpc.ts.hbs → src/index.ts.hbs} +0 -0
  77. /package/templates/api/trpc/server/{base/src/lib/trpc.ts.hbs → src/index.ts.hbs} +0 -0
  78. /package/templates/auth/better-auth/server/db/drizzle/mysql/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
  79. /package/templates/auth/better-auth/server/db/drizzle/postgres/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
  80. /package/templates/auth/better-auth/server/db/drizzle/sqlite/src/{db/schema/auth.ts → schema/auth.ts.hbs} +0 -0
  81. /package/templates/auth/better-auth/server/db/mongoose/mongodb/src/{db/models/auth.model.ts → models/auth.model.ts.hbs} +0 -0
  82. /package/templates/auth/better-auth/server/db/prisma/mongodb/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
  83. /package/templates/auth/better-auth/server/db/prisma/mysql/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
  84. /package/templates/auth/better-auth/server/db/prisma/postgres/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
  85. /package/templates/auth/better-auth/server/db/prisma/sqlite/prisma/schema/{auth.prisma → auth.prisma.hbs} +0 -0
  86. /package/templates/auth/better-auth/web/nuxt/app/middleware/{auth.ts → auth.ts.hbs} +0 -0
  87. /package/templates/backend/server/{server-base → base}/_gitignore +0 -0
  88. /package/templates/db/mongoose/mongodb/src/{db/index.ts.hbs → index.ts.hbs} +0 -0
  89. /package/templates/examples/todo/server/drizzle/mysql/src/{db/schema → schema}/todo.ts +0 -0
  90. /package/templates/examples/todo/server/drizzle/postgres/src/{db/schema → schema}/todo.ts +0 -0
  91. /package/templates/examples/todo/server/drizzle/sqlite/src/{db/schema → schema}/todo.ts +0 -0
  92. /package/templates/examples/todo/server/mongoose/mongodb/src/{db/models/todo.model.ts → models/todo.model.ts.hbs} +0 -0
  93. /package/templates/examples/todo/server/prisma/mongodb/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  94. /package/templates/examples/todo/server/prisma/mysql/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  95. /package/templates/examples/todo/server/prisma/postgres/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  96. /package/templates/examples/todo/server/prisma/sqlite/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
@@ -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,4 +0,0 @@
1
- import { auth } from "@/lib/auth";
2
- import { toNextJsHandler } from "better-auth/next-js";
3
-
4
- export const { GET, POST } = toNextJsHandler(auth.handler);
@@ -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
- }