create-better-t-stack 2.49.1-canary.80158905 → 2.50.0
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.js +1 -1
- package/dist/{src-CyG8-I-3.js → src-BFx0Xu3C.js} +171 -357
- package/package.json +1 -1
- package/templates/api/orpc/server/{rest/src → base/src/lib}/context.ts.hbs +5 -5
- 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 +1 -1
- 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/server/{rest/src → base/src/lib}/context.ts.hbs +5 -5
- package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +2 -2
- package/templates/auth/better-auth/server/base/src/{index.ts.hbs → lib/auth.ts.hbs} +6 -6
- package/templates/auth/clerk/convex/web/react/tanstack-start/src/server.ts.hbs +1 -0
- package/templates/backend/server/elysia/src/index.ts.hbs +5 -5
- package/templates/backend/server/express/src/index.ts.hbs +5 -5
- package/templates/backend/server/fastify/src/index.ts.hbs +5 -5
- package/templates/backend/server/hono/src/index.ts.hbs +5 -5
- package/templates/backend/server/{base → server-base}/package.json.hbs +1 -0
- package/templates/{api/trpc/server/base → backend/server/server-base}/src/routers/index.ts.hbs +2 -2
- package/templates/backend/server/{base → server-base}/tsconfig.json.hbs +10 -5
- package/templates/base/_gitignore +1 -47
- package/templates/base/package.json.hbs +3 -1
- package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +2 -7
- package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +2 -7
- package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +2 -7
- package/templates/db/prisma/mongodb/prisma.config.ts.hbs +1 -5
- package/templates/db/prisma/mongodb/src/db/index.ts.hbs +5 -0
- package/templates/db/prisma/mysql/prisma.config.ts.hbs +1 -5
- package/templates/db/prisma/mysql/src/{index.ts.hbs → db/index.ts.hbs} +1 -1
- package/templates/db/prisma/postgres/prisma.config.ts.hbs +3 -7
- package/templates/db/prisma/postgres/src/{index.ts.hbs → db/index.ts.hbs} +1 -1
- package/templates/db/prisma/sqlite/prisma.config.ts.hbs +1 -5
- package/templates/db/prisma/sqlite/src/{index.ts.hbs → db/index.ts.hbs} +3 -3
- package/templates/deploy/wrangler/web/react/tanstack-start/wrangler.jsonc.hbs +1 -1
- 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/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +1 -1
- package/templates/frontend/react/tanstack-start/package.json.hbs +7 -7
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +5 -5
- package/templates/frontend/react/tanstack-start/vite.config.ts.hbs +1 -1
- package/templates/api/orpc/server/base/_gitignore +0 -34
- package/templates/api/orpc/server/base/package.json.hbs +0 -24
- package/templates/api/orpc/server/base/src/routers/index.ts.hbs +0 -55
- package/templates/api/orpc/server/base/tsconfig.json.hbs +0 -10
- package/templates/api/orpc/server/base/tsdown.config.ts.hbs +0 -7
- package/templates/api/trpc/server/base/_gitignore +0 -34
- package/templates/api/trpc/server/base/package.json.hbs +0 -23
- package/templates/api/trpc/server/base/tsconfig.json.hbs +0 -13
- package/templates/api/trpc/server/base/tsdown.config.ts.hbs +0 -7
- package/templates/auth/better-auth/server/base/_gitignore +0 -34
- package/templates/auth/better-auth/server/base/package.json.hbs +0 -24
- package/templates/auth/better-auth/server/base/tsconfig.json.hbs +0 -13
- package/templates/auth/better-auth/server/base/tsdown.config.ts.hbs +0 -7
- package/templates/backend/server/base/tsdown.config.ts.hbs +0 -14
- package/templates/base/tsconfig.base.json +0 -23
- package/templates/db/base/_gitignore +0 -34
- package/templates/db/base/package.json.hbs +0 -23
- package/templates/db/base/tsconfig.json.hbs +0 -13
- package/templates/db/base/tsdown.config.ts.hbs +0 -7
- package/templates/db/prisma/mongodb/src/index.ts.hbs +0 -5
- /package/templates/api/orpc/server/{rest/src/index.ts.hbs → base/src/lib/orpc.ts.hbs} +0 -0
- /package/templates/api/trpc/server/{rest/src/index.ts.hbs → base/src/lib/trpc.ts.hbs} +0 -0
- /package/templates/auth/better-auth/server/db/drizzle/mysql/src/{schema → db/schema}/auth.ts +0 -0
- /package/templates/auth/better-auth/server/db/drizzle/postgres/src/{schema → db/schema}/auth.ts +0 -0
- /package/templates/auth/better-auth/server/db/drizzle/sqlite/src/{schema → db/schema}/auth.ts +0 -0
- /package/templates/auth/better-auth/server/db/mongoose/mongodb/src/{models → db/models}/auth.model.ts +0 -0
- /package/templates/backend/server/{base → server-base}/_gitignore +0 -0
- /package/templates/db/drizzle/mysql/src/{index.ts.hbs → db/index.ts.hbs} +0 -0
- /package/templates/db/drizzle/postgres/src/{index.ts.hbs → db/index.ts.hbs} +0 -0
- /package/templates/db/drizzle/sqlite/src/{index.ts.hbs → db/index.ts.hbs} +0 -0
- /package/templates/db/mongoose/mongodb/src/{index.ts.hbs → db/index.ts.hbs} +0 -0
- /package/templates/examples/todo/server/mongoose/mongodb/src/db/models/{todo.model.ts.hbs → todo.model.ts} +0 -0
- /package/templates/examples/todo/server/prisma/mongodb/prisma/schema/{todo.prisma.hbs → todo.prisma} +0 -0
- /package/templates/examples/todo/server/prisma/mysql/prisma/schema/{todo.prisma.hbs → todo.prisma} +0 -0
- /package/templates/examples/todo/server/prisma/postgres/prisma/schema/{todo.prisma.hbs → todo.prisma} +0 -0
- /package/templates/examples/todo/server/prisma/sqlite/prisma/schema/{todo.prisma.hbs → todo.prisma} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.50.0",
|
|
4
4
|
"description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{#if (eq backend 'next')}}
|
|
2
2
|
import type { NextRequest } from "next/server";
|
|
3
3
|
{{#if (eq auth "better-auth")}}
|
|
4
|
-
import { auth } from "
|
|
4
|
+
import { auth } from "./auth";
|
|
5
5
|
{{/if}}
|
|
6
6
|
|
|
7
7
|
export async function createContext(req: NextRequest) {
|
|
@@ -20,7 +20,7 @@ export async function createContext(req: NextRequest) {
|
|
|
20
20
|
{{else if (eq backend 'hono')}}
|
|
21
21
|
import type { Context as HonoContext } from "hono";
|
|
22
22
|
{{#if (eq auth "better-auth")}}
|
|
23
|
-
import { auth } from "
|
|
23
|
+
import { auth } from "./auth";
|
|
24
24
|
{{/if}}
|
|
25
25
|
|
|
26
26
|
export type CreateContextOptions = {
|
|
@@ -46,7 +46,7 @@ export async function createContext({ context }: CreateContextOptions) {
|
|
|
46
46
|
{{else if (eq backend 'elysia')}}
|
|
47
47
|
import type { Context as ElysiaContext } from "elysia";
|
|
48
48
|
{{#if (eq auth "better-auth")}}
|
|
49
|
-
import { auth } from "
|
|
49
|
+
import { auth } from "./auth";
|
|
50
50
|
{{/if}}
|
|
51
51
|
|
|
52
52
|
export type CreateContextOptions = {
|
|
@@ -72,7 +72,7 @@ export async function createContext({ context }: CreateContextOptions) {
|
|
|
72
72
|
{{else if (eq backend 'express')}}
|
|
73
73
|
{{#if (eq auth "better-auth")}}
|
|
74
74
|
import { fromNodeHeaders } from "better-auth/node";
|
|
75
|
-
import { auth } from "
|
|
75
|
+
import { auth } from "./auth";
|
|
76
76
|
{{/if}}
|
|
77
77
|
|
|
78
78
|
export async function createContext(opts: any) {
|
|
@@ -95,7 +95,7 @@ export async function createContext(opts: any) {
|
|
|
95
95
|
import type { IncomingHttpHeaders } from "node:http";
|
|
96
96
|
{{#if (eq auth "better-auth")}}
|
|
97
97
|
import { fromNodeHeaders } from "better-auth/node";
|
|
98
|
-
import { auth } from "
|
|
98
|
+
import { auth } from "./auth";
|
|
99
99
|
{{/if}}
|
|
100
100
|
|
|
101
101
|
export async function createContext(req: IncomingHttpHeaders) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
|
|
2
|
-
import type { AppRouterClient } from "
|
|
2
|
+
import type { AppRouterClient } from "../../../server/src/routers/index";
|
|
3
3
|
import { createORPCClient } from '@orpc/client'
|
|
4
4
|
import { RPCLink } from '@orpc/client/fetch'
|
|
5
5
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
@@ -3,7 +3,7 @@ import { RPCLink } from "@orpc/client/fetch";
|
|
|
3
3
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
4
4
|
import { QueryCache, QueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { toast } from "sonner";
|
|
6
|
-
import type { AppRouterClient } from "
|
|
6
|
+
import type { AppRouterClient } from "../../../server/src/routers/index";
|
|
7
7
|
|
|
8
8
|
export const queryClient = new QueryClient({
|
|
9
9
|
queryCache: new QueryCache({
|
|
@@ -2,7 +2,7 @@ import { createORPCClient } from "@orpc/client";
|
|
|
2
2
|
import { RPCLink } from "@orpc/client/fetch";
|
|
3
3
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
4
4
|
import { QueryCache, QueryClient } from "@tanstack/solid-query";
|
|
5
|
-
import type { AppRouterClient } from "
|
|
5
|
+
import type { AppRouterClient } from "../../../server/src/routers/index";
|
|
6
6
|
|
|
7
7
|
export const queryClient = new QueryClient({
|
|
8
8
|
queryCache: new QueryCache({
|
|
@@ -3,7 +3,7 @@ import { createORPCClient } from "@orpc/client";
|
|
|
3
3
|
import { RPCLink } from "@orpc/client/fetch";
|
|
4
4
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
5
5
|
import { QueryCache, QueryClient } from "@tanstack/svelte-query";
|
|
6
|
-
import type { AppRouterClient } from "
|
|
6
|
+
import type { AppRouterClient } from "../../../server/src/routers/index";
|
|
7
7
|
|
|
8
8
|
export const queryClient = new QueryClient({
|
|
9
9
|
queryCache: new QueryCache({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{#if (eq backend 'next')}}
|
|
2
2
|
import type { NextRequest } from "next/server";
|
|
3
3
|
{{#if (eq auth "better-auth")}}
|
|
4
|
-
import { auth } from "
|
|
4
|
+
import { auth } from "./auth";
|
|
5
5
|
{{/if}}
|
|
6
6
|
|
|
7
7
|
export async function createContext(req: NextRequest) {
|
|
@@ -23,7 +23,7 @@ export async function createContext(req: NextRequest) {
|
|
|
23
23
|
{{else if (eq backend 'hono')}}
|
|
24
24
|
import type { Context as HonoContext } from "hono";
|
|
25
25
|
{{#if (eq auth "better-auth")}}
|
|
26
|
-
import { auth } from "
|
|
26
|
+
import { auth } from "./auth";
|
|
27
27
|
{{/if}}
|
|
28
28
|
|
|
29
29
|
export type CreateContextOptions = {
|
|
@@ -49,7 +49,7 @@ export async function createContext({ context }: CreateContextOptions) {
|
|
|
49
49
|
{{else if (eq backend 'elysia')}}
|
|
50
50
|
import type { Context as ElysiaContext } from "elysia";
|
|
51
51
|
{{#if (eq auth "better-auth")}}
|
|
52
|
-
import { auth } from "
|
|
52
|
+
import { auth } from "./auth";
|
|
53
53
|
{{/if}}
|
|
54
54
|
|
|
55
55
|
export type CreateContextOptions = {
|
|
@@ -76,7 +76,7 @@ export async function createContext({ context }: CreateContextOptions) {
|
|
|
76
76
|
import type { CreateExpressContextOptions } from "@trpc/server/adapters/express";
|
|
77
77
|
{{#if (eq auth "better-auth")}}
|
|
78
78
|
import { fromNodeHeaders } from "better-auth/node";
|
|
79
|
-
import { auth } from "
|
|
79
|
+
import { auth } from "./auth";
|
|
80
80
|
{{/if}}
|
|
81
81
|
|
|
82
82
|
export async function createContext(opts: CreateExpressContextOptions) {
|
|
@@ -99,7 +99,7 @@ export async function createContext(opts: CreateExpressContextOptions) {
|
|
|
99
99
|
import type { CreateFastifyContextOptions } from "@trpc/server/adapters/fastify";
|
|
100
100
|
{{#if (eq auth "better-auth")}}
|
|
101
101
|
import { fromNodeHeaders } from "better-auth/node";
|
|
102
|
-
import { auth } from "
|
|
102
|
+
import { auth } from "./auth";
|
|
103
103
|
{{/if}}
|
|
104
104
|
|
|
105
105
|
export async function createContext({ req, res }: CreateFastifyContextOptions) {
|
|
@@ -47,13 +47,13 @@ export const trpc = createTRPCOptionsProxy<AppRouter>({
|
|
|
47
47
|
|
|
48
48
|
{{else if (includes frontend 'tanstack-start')}}
|
|
49
49
|
import { createTRPCContext } from "@trpc/tanstack-react-query";
|
|
50
|
-
import type { AppRouter } from "
|
|
50
|
+
import type { AppRouter } from "../../../server/src/routers";
|
|
51
51
|
|
|
52
52
|
export const { TRPCProvider, useTRPC, useTRPCClient } =
|
|
53
53
|
createTRPCContext<AppRouter>();
|
|
54
54
|
|
|
55
55
|
{{else}}
|
|
56
|
-
import type { AppRouter } from "
|
|
56
|
+
import type { AppRouter } from "../../../server/src/routers";
|
|
57
57
|
import { QueryCache, QueryClient } from "@tanstack/react-query";
|
|
58
58
|
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
59
59
|
import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
|
|
@@ -8,7 +8,7 @@ import { expo } from "@better-auth/expo";
|
|
|
8
8
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
9
9
|
import { polarClient } from "./payments";
|
|
10
10
|
{{/if}}
|
|
11
|
-
import prisma from "
|
|
11
|
+
import prisma from "../db";
|
|
12
12
|
|
|
13
13
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
14
14
|
database: prismaAdapter(prisma, {
|
|
@@ -76,8 +76,8 @@ import { expo } from "@better-auth/expo";
|
|
|
76
76
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
77
77
|
import { polarClient } from "./payments";
|
|
78
78
|
{{/if}}
|
|
79
|
-
import { db } from "
|
|
80
|
-
import * as schema from "
|
|
79
|
+
import { db } from "../db";
|
|
80
|
+
import * as schema from "../db/schema/auth";
|
|
81
81
|
|
|
82
82
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
83
83
|
database: drizzleAdapter(db, {
|
|
@@ -144,8 +144,8 @@ import { expo } from "@better-auth/expo";
|
|
|
144
144
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
145
145
|
import { polarClient } from "./payments";
|
|
146
146
|
{{/if}}
|
|
147
|
-
import { db } from "
|
|
148
|
-
import * as schema from "
|
|
147
|
+
import { db } from "../db";
|
|
148
|
+
import * as schema from "../db/schema/auth";
|
|
149
149
|
import { env } from "cloudflare:workers";
|
|
150
150
|
|
|
151
151
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
@@ -226,7 +226,7 @@ import { expo } from "@better-auth/expo";
|
|
|
226
226
|
import { polar, checkout, portal } from "@polar-sh/better-auth";
|
|
227
227
|
import { polarClient } from "./payments";
|
|
228
228
|
{{/if}}
|
|
229
|
-
import { client } from "
|
|
229
|
+
import { client } from "../db";
|
|
230
230
|
|
|
231
231
|
export const auth = betterAuth<BetterAuthOptions>({
|
|
232
232
|
database: mongodbAdapter(client),
|
|
@@ -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 "./lib/context";
|
|
13
|
+
import { appRouter } from "./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 "./routers";
|
|
23
|
+
import { createContext } from "./lib/context";
|
|
24
24
|
{{/if}}
|
|
25
25
|
{{#if (eq auth "better-auth")}}
|
|
26
|
-
import { auth } from "
|
|
26
|
+
import { auth } from "./lib/auth";
|
|
27
27
|
{{/if}}
|
|
28
28
|
|
|
29
29
|
{{#if (eq api "orpc")}}
|
|
@@ -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 "./lib/context";
|
|
5
|
+
import { appRouter } from "./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 "./routers";
|
|
14
14
|
{{#if (eq auth "better-auth")}}
|
|
15
|
-
import { createContext } from "
|
|
15
|
+
import { createContext } from "./lib/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 "./lib/auth";
|
|
26
26
|
import { toNodeHandler } from "better-auth/node";
|
|
27
27
|
{{/if}}
|
|
28
28
|
|
|
@@ -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 "./lib/context";
|
|
8
|
+
import { appRouter, type AppRouter } from "./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 "./routers/index";
|
|
19
19
|
import { createServer } from "node:http";
|
|
20
20
|
{{#if (eq auth "better-auth")}}
|
|
21
|
-
import { createContext } from "
|
|
21
|
+
import { createContext } from "./lib/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 "./lib/auth";
|
|
32
32
|
{{/if}}
|
|
33
33
|
|
|
34
34
|
const baseCorsConfig = {
|
|
@@ -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 "./lib/context";
|
|
14
|
+
import { appRouter } from "./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 "./lib/context";
|
|
19
|
+
import { appRouter } from "./routers/index";
|
|
20
20
|
{{/if}}
|
|
21
21
|
{{#if (eq auth "better-auth")}}
|
|
22
|
-
import { auth } from "
|
|
22
|
+
import { auth } from "./lib/auth";
|
|
23
23
|
{{/if}}
|
|
24
24
|
import { Hono } from "hono";
|
|
25
25
|
import { cors } from "hono/cors";
|
package/templates/{api/trpc/server/base → backend/server/server-base}/src/routers/index.ts.hbs
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{#if (eq api "orpc")}}
|
|
2
|
-
import { {{#if (eq auth "better-auth")}}protectedProcedure, {{/if}}publicProcedure } from "../
|
|
2
|
+
import { {{#if (eq auth "better-auth")}}protectedProcedure, {{/if}}publicProcedure } from "../lib/orpc";
|
|
3
3
|
import type { RouterClient } from "@orpc/server";
|
|
4
4
|
{{#if (includes examples "todo")}}
|
|
5
5
|
import { todoRouter } from "./todo";
|
|
@@ -27,7 +27,7 @@ export type AppRouterClient = RouterClient<typeof appRouter>;
|
|
|
27
27
|
import {
|
|
28
28
|
{{#if (eq auth "better-auth")}}protectedProcedure, {{/if}}publicProcedure,
|
|
29
29
|
router,
|
|
30
|
-
} from "../
|
|
30
|
+
} from "../lib/trpc";
|
|
31
31
|
{{#if (includes examples "todo")}}
|
|
32
32
|
import { todoRouter } from "./todo";
|
|
33
33
|
{{/if}}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
2
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"verbatimModuleSyntax": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"baseUrl": "./",
|
|
7
10
|
"paths": {
|
|
8
11
|
"@/*": ["./src/*"]{{#if (eq orm "prisma")}},
|
|
9
12
|
"prisma": ["node_modules/prisma"]{{/if}}
|
|
10
13
|
},
|
|
14
|
+
"outDir": "./dist",
|
|
11
15
|
"types": [
|
|
12
16
|
{{#if (eq runtime "node")}}
|
|
13
17
|
"node"
|
|
@@ -20,7 +24,8 @@
|
|
|
20
24
|
"bun"
|
|
21
25
|
{{/if}}{{#if (eq serverDeploy "alchemy")}},
|
|
22
26
|
"@cloudflare/workers-types"{{/if}}
|
|
23
|
-
],
|
|
27
|
+
]{{#unless (or (eq backend "convex") (eq backend "none"))}},
|
|
28
|
+
"composite": true{{/unless}},
|
|
24
29
|
"jsx": "react-jsx"{{#if (eq backend "hono")}},
|
|
25
30
|
"jsxImportSource": "hono/jsx"{{/if}}
|
|
26
31
|
}
|
|
@@ -1,50 +1,4 @@
|
|
|
1
|
-
# Dependencies
|
|
2
1
|
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
|
|
37
2
|
.turbo
|
|
38
|
-
|
|
39
|
-
# Better-T-Stack
|
|
40
3
|
.alchemy
|
|
41
|
-
|
|
42
|
-
# Testing
|
|
43
|
-
coverage
|
|
44
|
-
.nyc_output
|
|
45
|
-
|
|
46
|
-
# Misc
|
|
47
|
-
*.tgz
|
|
48
|
-
.cache
|
|
49
|
-
tmp
|
|
50
|
-
temp
|
|
4
|
+
.env
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { defineConfig } from "drizzle-kit";
|
|
2
|
-
import dotenv from "dotenv";
|
|
3
|
-
|
|
4
|
-
dotenv.config({
|
|
5
|
-
path: "../../apps/server/.env",
|
|
6
|
-
});
|
|
7
2
|
|
|
8
3
|
export default defineConfig({
|
|
9
|
-
schema: "./src/schema",
|
|
10
|
-
out: "./src/migrations",
|
|
4
|
+
schema: "./src/db/schema",
|
|
5
|
+
out: "./src/db/migrations",
|
|
11
6
|
dialect: "mysql",
|
|
12
7
|
dbCredentials: {
|
|
13
8
|
url: process.env.DATABASE_URL || "",
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { defineConfig } from "drizzle-kit";
|
|
2
|
-
import dotenv from "dotenv";
|
|
3
|
-
|
|
4
|
-
dotenv.config({
|
|
5
|
-
path: "../../apps/server/.env",
|
|
6
|
-
});
|
|
7
2
|
|
|
8
3
|
export default defineConfig({
|
|
9
|
-
schema: "./src/schema",
|
|
10
|
-
out: "./src/migrations",
|
|
4
|
+
schema: "./src/db/schema",
|
|
5
|
+
out: "./src/db/migrations",
|
|
11
6
|
dialect: "postgresql",
|
|
12
7
|
dbCredentials: {
|
|
13
8
|
url: process.env.DATABASE_URL || "",
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { defineConfig } from "drizzle-kit";
|
|
2
|
-
import dotenv from "dotenv";
|
|
3
|
-
|
|
4
|
-
dotenv.config({
|
|
5
|
-
path: "../../apps/server/.env",
|
|
6
|
-
});
|
|
7
2
|
|
|
8
3
|
export default defineConfig({
|
|
9
|
-
schema: "./src/schema",
|
|
10
|
-
out: "./src/migrations",
|
|
4
|
+
schema: "./src/db/schema",
|
|
5
|
+
out: "./src/db/migrations",
|
|
11
6
|
{{#if (eq dbSetup "d1")}}
|
|
12
7
|
// DOCS: https://orm.drizzle.team/docs/guides/d1-http-with-drizzle-kit
|
|
13
8
|
dialect: "sqlite",
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import type { PrismaConfig } from "prisma";
|
|
3
1
|
{{#unless (eq dbSetup "prisma-postgres")}}
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
dotenv.config({
|
|
7
|
-
path: "../../apps/server/.env",
|
|
8
|
-
});
|
|
2
|
+
import "dotenv/config";
|
|
9
3
|
{{/unless}}
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import type { PrismaConfig } from "prisma";
|
|
10
6
|
|
|
11
7
|
export default {
|
|
12
8
|
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 "
|
|
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 "
|
|
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 "
|
|
23
|
+
import { PrismaClient } from "../../prisma/generated/client";
|
|
24
24
|
|
|
25
25
|
const prisma = new PrismaClient();
|
|
26
26
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
3
3
|
"name": "{{projectName}}",
|
|
4
|
-
"main": "
|
|
4
|
+
"main": "@tanstack/react-start/server-entry",
|
|
5
5
|
"compatibility_date": "2025-07-05",
|
|
6
6
|
"compatibility_flags": ["nodejs_compat"],
|
|
7
7
|
"assets": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{{#if (eq api "orpc")}}
|
|
2
|
-
import { eq } from "
|
|
2
|
+
import { eq } from "drizzle-orm";
|
|
3
3
|
import z from "zod";
|
|
4
|
-
import { db } from "
|
|
5
|
-
import { todo } from "
|
|
6
|
-
import { publicProcedure } from "../
|
|
4
|
+
import { db } from "../db";
|
|
5
|
+
import { todo } from "../db/schema/todo";
|
|
6
|
+
import { publicProcedure } from "../lib/orpc";
|
|
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 "../
|
|
42
|
+
import { router, publicProcedure } from "../lib/trpc";
|
|
43
43
|
import { todo } from "../db/schema/todo";
|
|
44
44
|
import { eq } from "drizzle-orm";
|
|
45
|
-
import { db } from "
|
|
45
|
+
import { db } from "../db";
|
|
46
46
|
|
|
47
47
|
export const todoRouter = router({
|
|
48
48
|
getAll: publicProcedure.query(async () => {
|