create-better-t-stack 2.49.0 → 2.49.1-canary.80158905

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 (73) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{src-DXyLKhXK.js → src-CyG8-I-3.js} +289 -157
  4. package/package.json +1 -1
  5. package/templates/api/orpc/server/base/_gitignore +34 -0
  6. package/templates/api/orpc/server/base/package.json.hbs +24 -0
  7. package/templates/{backend/server/server-base → api/orpc/server/base}/src/routers/index.ts.hbs +2 -2
  8. package/templates/api/orpc/server/base/tsconfig.json.hbs +10 -0
  9. package/templates/api/orpc/server/base/tsdown.config.ts.hbs +7 -0
  10. package/templates/api/orpc/server/{base/src/lib → rest/src}/context.ts.hbs +5 -5
  11. package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +1 -1
  12. package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +1 -1
  13. package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +1 -1
  14. package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +1 -1
  15. package/templates/api/trpc/server/base/_gitignore +34 -0
  16. package/templates/api/trpc/server/base/package.json.hbs +23 -0
  17. package/templates/api/trpc/server/base/src/routers/index.ts.hbs +55 -0
  18. package/templates/api/trpc/server/base/tsconfig.json.hbs +13 -0
  19. package/templates/api/trpc/server/base/tsdown.config.ts.hbs +7 -0
  20. package/templates/api/trpc/server/{base/src/lib → rest/src}/context.ts.hbs +5 -5
  21. package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +2 -2
  22. package/templates/auth/better-auth/server/base/_gitignore +34 -0
  23. package/templates/auth/better-auth/server/base/package.json.hbs +24 -0
  24. package/templates/auth/better-auth/server/base/src/{lib/auth.ts.hbs → index.ts.hbs} +6 -6
  25. package/templates/auth/better-auth/server/base/tsconfig.json.hbs +13 -0
  26. package/templates/auth/better-auth/server/base/tsdown.config.ts.hbs +7 -0
  27. package/templates/backend/server/{server-base → base}/package.json.hbs +0 -1
  28. package/templates/backend/server/{server-base → base}/tsconfig.json.hbs +5 -10
  29. package/templates/backend/server/base/tsdown.config.ts.hbs +14 -0
  30. package/templates/backend/server/elysia/src/index.ts.hbs +5 -5
  31. package/templates/backend/server/express/src/index.ts.hbs +5 -5
  32. package/templates/backend/server/fastify/src/index.ts.hbs +5 -5
  33. package/templates/backend/server/hono/src/index.ts.hbs +5 -5
  34. package/templates/base/_gitignore +47 -1
  35. package/templates/base/package.json.hbs +1 -3
  36. package/templates/base/tsconfig.base.json +23 -0
  37. package/templates/db/base/_gitignore +34 -0
  38. package/templates/db/base/package.json.hbs +23 -0
  39. package/templates/db/base/tsconfig.json.hbs +13 -0
  40. package/templates/db/base/tsdown.config.ts.hbs +7 -0
  41. package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +7 -2
  42. package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +7 -2
  43. package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +7 -2
  44. package/templates/db/prisma/mongodb/prisma.config.ts.hbs +5 -1
  45. package/templates/db/prisma/mongodb/src/index.ts.hbs +5 -0
  46. package/templates/db/prisma/mysql/prisma.config.ts.hbs +5 -1
  47. package/templates/db/prisma/mysql/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  48. package/templates/db/prisma/postgres/prisma.config.ts.hbs +7 -3
  49. package/templates/db/prisma/postgres/src/{db/index.ts.hbs → index.ts.hbs} +1 -1
  50. package/templates/db/prisma/sqlite/prisma.config.ts.hbs +5 -1
  51. package/templates/db/prisma/sqlite/src/{db/index.ts.hbs → index.ts.hbs} +3 -3
  52. package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +6 -6
  53. package/templates/examples/todo/server/mongoose/base/src/routers/todo.ts.hbs +4 -4
  54. package/templates/examples/todo/server/prisma/base/src/routers/todo.ts.hbs +4 -4
  55. package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +1 -1
  56. package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +1 -1
  57. package/templates/db/prisma/mongodb/src/db/index.ts.hbs +0 -5
  58. /package/templates/api/orpc/server/{base/src/lib/orpc.ts.hbs → rest/src/index.ts.hbs} +0 -0
  59. /package/templates/api/trpc/server/{base/src/lib/trpc.ts.hbs → rest/src/index.ts.hbs} +0 -0
  60. /package/templates/auth/better-auth/server/db/drizzle/mysql/src/{db/schema → schema}/auth.ts +0 -0
  61. /package/templates/auth/better-auth/server/db/drizzle/postgres/src/{db/schema → schema}/auth.ts +0 -0
  62. /package/templates/auth/better-auth/server/db/drizzle/sqlite/src/{db/schema → schema}/auth.ts +0 -0
  63. /package/templates/auth/better-auth/server/db/mongoose/mongodb/src/{db/models → models}/auth.model.ts +0 -0
  64. /package/templates/backend/server/{server-base → base}/_gitignore +0 -0
  65. /package/templates/db/drizzle/mysql/src/{db/index.ts.hbs → index.ts.hbs} +0 -0
  66. /package/templates/db/drizzle/postgres/src/{db/index.ts.hbs → index.ts.hbs} +0 -0
  67. /package/templates/db/drizzle/sqlite/src/{db/index.ts.hbs → index.ts.hbs} +0 -0
  68. /package/templates/db/mongoose/mongodb/src/{db/index.ts.hbs → index.ts.hbs} +0 -0
  69. /package/templates/examples/todo/server/mongoose/mongodb/src/db/models/{todo.model.ts → todo.model.ts.hbs} +0 -0
  70. /package/templates/examples/todo/server/prisma/mongodb/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  71. /package/templates/examples/todo/server/prisma/mysql/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  72. /package/templates/examples/todo/server/prisma/postgres/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
  73. /package/templates/examples/todo/server/prisma/sqlite/prisma/schema/{todo.prisma → todo.prisma.hbs} +0 -0
@@ -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 "./lib/context";
14
- import { appRouter } from "./routers/index";
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 "./lib/context";
19
- import { appRouter } from "./routers/index";
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 "./lib/auth";
22
+ import { auth } from "@{{projectName}}/auth";
23
23
  {{/if}}
24
24
  import { Hono } from "hono";
25
25
  import { cors } from "hono/cors";
@@ -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
- .env
41
+
42
+ # Testing
43
+ coverage
44
+ .nyc_output
45
+
46
+ # Misc
47
+ *.tgz
48
+ .cache
49
+ tmp
50
+ temp
@@ -6,7 +6,5 @@
6
6
  "apps/*",
7
7
  "packages/*"
8
8
  ],
9
- "scripts": {
10
-
11
- }
9
+ "scripts": {}
12
10
  }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "lib": [
8
+ "ESNext"
9
+ ],
10
+ "verbatimModuleSyntax": true,
11
+ "strict": true,
12
+ "skipLibCheck": true,
13
+ "resolveJsonModule": true,
14
+ "allowSyntheticDefaultImports": true,
15
+ "esModuleInterop": true,
16
+ "forceConsistentCasingInFileNames": true,
17
+ "isolatedModules": true,
18
+ "noUncheckedIndexedAccess": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true
22
+ }
23
+ }
@@ -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,23 @@
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
+ "@types/node": "^24.5.2"
19
+ },
20
+ "peerDependencies": {
21
+ "typescript": "^5"
22
+ }
23
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "sourceMap": true,
7
+ "outDir": "dist",
8
+ "composite": true,
9
+ "types": [
10
+ "bun"
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ entry: 'src/**/*.ts',
5
+ sourcemap: true,
6
+ dts: true,
7
+ });
@@ -1,8 +1,13 @@
1
1
  import { defineConfig } from "drizzle-kit";
2
+ import dotenv from "dotenv";
3
+
4
+ dotenv.config({
5
+ path: "../../apps/server/.env",
6
+ });
2
7
 
3
8
  export default defineConfig({
4
- schema: "./src/db/schema",
5
- out: "./src/db/migrations",
9
+ schema: "./src/schema",
10
+ out: "./src/migrations",
6
11
  dialect: "mysql",
7
12
  dbCredentials: {
8
13
  url: process.env.DATABASE_URL || "",
@@ -1,8 +1,13 @@
1
1
  import { defineConfig } from "drizzle-kit";
2
+ import dotenv from "dotenv";
3
+
4
+ dotenv.config({
5
+ path: "../../apps/server/.env",
6
+ });
2
7
 
3
8
  export default defineConfig({
4
- schema: "./src/db/schema",
5
- out: "./src/db/migrations",
9
+ schema: "./src/schema",
10
+ out: "./src/migrations",
6
11
  dialect: "postgresql",
7
12
  dbCredentials: {
8
13
  url: process.env.DATABASE_URL || "",
@@ -1,8 +1,13 @@
1
1
  import { defineConfig } from "drizzle-kit";
2
+ import dotenv from "dotenv";
3
+
4
+ dotenv.config({
5
+ path: "../../apps/server/.env",
6
+ });
2
7
 
3
8
  export default defineConfig({
4
- schema: "./src/db/schema",
5
- out: "./src/db/migrations",
9
+ schema: "./src/schema",
10
+ out: "./src/migrations",
6
11
  {{#if (eq dbSetup "d1")}}
7
12
  // DOCS: https://orm.drizzle.team/docs/guides/d1-http-with-drizzle-kit
8
13
  dialect: "sqlite",
@@ -1,6 +1,10 @@
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
+ path: "../../apps/server/.env",
7
+ });
4
8
 
5
9
  export default {
6
10
  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,10 @@
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
+ path: "../../apps/server/.env",
7
+ });
4
8
 
5
9
  export default {
6
10
  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,12 @@
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
+ path: "../../apps/server/.env",
8
+ });
9
+ {{/unless}}
6
10
 
7
11
  export default {
8
12
  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,10 @@
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
+ path: "../../apps/server/.env",
7
+ });
4
8
 
5
9
  export default {
6
10
  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
 
@@ -1,9 +1,9 @@
1
1
  {{#if (eq api "orpc")}}
2
- import { eq } from "drizzle-orm";
2
+ import { eq } from "@{{projectName}}/db";
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";
42
+ import { router, publicProcedure } from "../index";
43
43
  import { todo } from "../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 () => {
@@ -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/src/routers/index";
12
12
  import { createORPCClient } from "@orpc/client";
13
13
  {{/if}}
14
14
  {{#if (eq api "trpc")}}
@@ -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/src/routers/index";
70
70
  export interface RouterAppContext {
71
71
  trpc: TRPCOptionsProxy<AppRouter>;
72
72
  queryClient: QueryClient;
@@ -1,5 +0,0 @@
1
- import { PrismaClient } from "../../prisma/generated/client";
2
-
3
- const prisma = new PrismaClient();
4
-
5
- export default prisma;