create-better-t-stack 2.33.7 → 2.33.8-canary.70c2a51a
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/README.md +2 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +17 -4
- package/dist/index.js +1 -1
- package/dist/{src-v-T6MhJ_.js → src-DT9NPMDZ.js} +1290 -550
- package/package.json +7 -4
- package/templates/addons/biome/biome.json.hbs +1 -0
- package/templates/addons/ruler/.ruler/mcp.json.hbs +1 -1
- package/templates/addons/ultracite/biome.json.hbs +1 -0
- package/templates/api/orpc/native/utils/orpc.ts.hbs +2 -3
- package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +2 -3
- package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +2 -3
- package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +2 -3
- package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +2 -3
- package/templates/auth/server/base/src/lib/auth.ts.hbs +37 -4
- package/templates/backend/server/server-base/_gitignore +1 -0
- package/templates/backend/server/server-base/src/routers/index.ts.hbs +2 -0
- package/templates/backend/server/server-base/tsconfig.json.hbs +1 -1
- package/templates/base/_gitignore +2 -0
- package/templates/deploy/alchemy/alchemy.run.ts.hbs +200 -0
- package/templates/deploy/alchemy/env.d.ts.hbs +20 -0
- package/templates/deploy/{web → wrangler/web}/nuxt/wrangler.jsonc.hbs +1 -1
- package/templates/deploy/{web → wrangler/web}/react/next/wrangler.jsonc.hbs +1 -1
- package/templates/deploy/{web → wrangler/web}/react/react-router/wrangler.jsonc.hbs +1 -1
- package/templates/deploy/{web → wrangler/web}/react/tanstack-router/wrangler.jsonc.hbs +1 -1
- package/templates/deploy/{web → wrangler/web}/react/tanstack-start/wrangler.jsonc.hbs +1 -1
- package/templates/deploy/{web → wrangler/web}/solid/wrangler.jsonc.hbs +1 -1
- package/templates/deploy/{web → wrangler/web}/svelte/wrangler.jsonc.hbs +1 -1
- package/templates/frontend/nuxt/_gitignore +3 -0
- package/templates/frontend/nuxt/tsconfig.json.hbs +4 -4
- package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +2 -3
- package/templates/frontend/react/web-base/_gitignore +1 -0
- package/templates/frontend/react/web-base/src/components/header.tsx.hbs +0 -1
- package/templates/frontend/solid/_gitignore +1 -0
- package/templates/frontend/solid/package.json.hbs +0 -1
- package/templates/frontend/svelte/_gitignore +1 -0
- package/templates/frontend/svelte/package.json.hbs +11 -13
- /package/templates/{runtime/workers/apps → deploy/wrangler}/server/wrangler.jsonc.hbs +0 -0
- /package/templates/deploy/{web → wrangler/web}/react/next/open-next.config.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.8-canary.70c2a51a",
|
|
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",
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"dev": "tsdown --watch",
|
|
53
53
|
"check-types": "tsc --noEmit",
|
|
54
54
|
"check": "biome check --write .",
|
|
55
|
-
"test": "bun run build && vitest
|
|
55
|
+
"test": "bun run build && vitest run",
|
|
56
|
+
"test:ui": "bun run build && vitest --ui",
|
|
56
57
|
"test:with-build": "bun run build && WITH_BUILD=1 vitest --ui",
|
|
57
58
|
"prepublishOnly": "npm run build"
|
|
58
59
|
},
|
|
@@ -63,22 +64,24 @@
|
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|
|
67
|
+
"@biomejs/js-api": "^3.0.0",
|
|
68
|
+
"@biomejs/wasm-nodejs": "^2.2.0",
|
|
66
69
|
"@clack/prompts": "^0.11.0",
|
|
67
70
|
"consola": "^3.4.2",
|
|
68
71
|
"execa": "^9.6.0",
|
|
69
72
|
"fs-extra": "^11.3.1",
|
|
70
|
-
"globby": "^14.1.0",
|
|
71
73
|
"gradient-string": "^3.0.0",
|
|
72
74
|
"handlebars": "^4.7.8",
|
|
73
75
|
"jsonc-parser": "^3.3.1",
|
|
74
76
|
"picocolors": "^1.1.1",
|
|
77
|
+
"tinyglobby": "^0.2.14",
|
|
75
78
|
"trpc-cli": "^0.10.2",
|
|
76
79
|
"ts-morph": "^26.0.0",
|
|
77
80
|
"zod": "^4.0.17"
|
|
78
81
|
},
|
|
79
82
|
"devDependencies": {
|
|
80
83
|
"@types/fs-extra": "^11.0.4",
|
|
81
|
-
"@types/node": "^24.
|
|
84
|
+
"@types/node": "^24.3.0",
|
|
82
85
|
"@vitest/ui": "^3.2.4",
|
|
83
86
|
"tsdown": "^0.14.1",
|
|
84
87
|
"typescript": "^5.9.2",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "stdio",
|
|
5
5
|
"command": "npx",
|
|
6
6
|
"args": ["-y", "@upstash/context7-mcp"]
|
|
7
|
-
}{{#if (or (eq runtime "workers") (eq webDeploy "
|
|
7
|
+
}{{#if (or (eq runtime "workers") (eq webDeploy "wrangler"))}},
|
|
8
8
|
"cloudflare": {
|
|
9
9
|
"command": "npx",
|
|
10
10
|
"args": ["mcp-remote", "https://docs.mcp.cloudflare.com/sse"]
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createORPCClient } from "@orpc/client";
|
|
2
2
|
import { RPCLink } from "@orpc/client/fetch";
|
|
3
3
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
4
|
-
import type { RouterClient } from "@orpc/server";
|
|
5
4
|
import { QueryCache, QueryClient } from "@tanstack/react-query";
|
|
6
|
-
import type {
|
|
5
|
+
import type { AppRouterClient } from "../../server/src/routers";
|
|
7
6
|
{{#if auth}}
|
|
8
7
|
import { authClient } from "@/lib/auth-client";
|
|
9
8
|
{{/if}}
|
|
@@ -30,6 +29,6 @@ export const link = new RPCLink({
|
|
|
30
29
|
{{/if}}
|
|
31
30
|
});
|
|
32
31
|
|
|
33
|
-
export const client:
|
|
32
|
+
export const client: AppRouterClient = createORPCClient(link);
|
|
34
33
|
|
|
35
34
|
export const orpc = createTanstackQueryUtils(client);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
|
|
2
|
-
import type {
|
|
3
|
-
import type { appRouter } from "../../../server/src/routers/index";
|
|
2
|
+
import type { AppRouterClient } from "../../../server/src/routers/index";
|
|
4
3
|
import { createORPCClient } from '@orpc/client'
|
|
5
4
|
import { RPCLink } from '@orpc/client/fetch'
|
|
6
5
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
@@ -24,7 +23,7 @@ export default defineNuxtPlugin(() => {
|
|
|
24
23
|
})
|
|
25
24
|
|
|
26
25
|
|
|
27
|
-
const client:
|
|
26
|
+
const client: AppRouterClient = createORPCClient(rpcLink)
|
|
28
27
|
const orpcUtils = createTanstackQueryUtils(client)
|
|
29
28
|
|
|
30
29
|
return {
|
|
@@ -3,8 +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 {
|
|
7
|
-
import type { RouterClient } from "@orpc/server";
|
|
6
|
+
import type { AppRouterClient } from "../../../server/src/routers/index";
|
|
8
7
|
|
|
9
8
|
export const queryClient = new QueryClient({
|
|
10
9
|
queryCache: new QueryCache({
|
|
@@ -37,6 +36,6 @@ export const link = new RPCLink({
|
|
|
37
36
|
{{/if}}
|
|
38
37
|
});
|
|
39
38
|
|
|
40
|
-
export const client:
|
|
39
|
+
export const client: AppRouterClient = createORPCClient(link)
|
|
41
40
|
|
|
42
41
|
export const orpc = createTanstackQueryUtils(client)
|
|
@@ -2,8 +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 {
|
|
6
|
-
import type { RouterClient } from "@orpc/server";
|
|
5
|
+
import type { AppRouterClient } from "../../../server/src/routers/index";
|
|
7
6
|
|
|
8
7
|
export const queryClient = new QueryClient({
|
|
9
8
|
queryCache: new QueryCache({
|
|
@@ -25,6 +24,6 @@ export const link = new RPCLink({
|
|
|
25
24
|
{{/if}}
|
|
26
25
|
});
|
|
27
26
|
|
|
28
|
-
export const client:
|
|
27
|
+
export const client: AppRouterClient = createORPCClient(link);
|
|
29
28
|
|
|
30
29
|
export const orpc = createTanstackQueryUtils(client);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { PUBLIC_SERVER_URL } from "$env/static/public";
|
|
2
2
|
import { createORPCClient } from "@orpc/client";
|
|
3
3
|
import { RPCLink } from "@orpc/client/fetch";
|
|
4
|
-
import type { RouterClient } from "@orpc/server";
|
|
5
4
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
6
5
|
import { QueryCache, QueryClient } from "@tanstack/svelte-query";
|
|
7
|
-
import type {
|
|
6
|
+
import type { AppRouterClient } from "../../../server/src/routers/index";
|
|
8
7
|
|
|
9
8
|
export const queryClient = new QueryClient({
|
|
10
9
|
queryCache: new QueryCache({
|
|
@@ -26,6 +25,6 @@ export const link = new RPCLink({
|
|
|
26
25
|
{{/if}}
|
|
27
26
|
});
|
|
28
27
|
|
|
29
|
-
export const client:
|
|
28
|
+
export const client: AppRouterClient = createORPCClient(link);
|
|
30
29
|
|
|
31
30
|
export const orpc = createTanstackQueryUtils(client);
|
|
@@ -21,6 +21,13 @@ export const auth = betterAuth({
|
|
|
21
21
|
],
|
|
22
22
|
emailAndPassword: {
|
|
23
23
|
enabled: true,
|
|
24
|
+
},
|
|
25
|
+
advanced: {
|
|
26
|
+
defaultCookieAttributes: {
|
|
27
|
+
sameSite: "none",
|
|
28
|
+
secure: true,
|
|
29
|
+
httpOnly: true,
|
|
30
|
+
},
|
|
24
31
|
}
|
|
25
32
|
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
26
33
|
, plugins: [expo()]
|
|
@@ -54,8 +61,13 @@ export const auth = betterAuth({
|
|
|
54
61
|
emailAndPassword: {
|
|
55
62
|
enabled: true,
|
|
56
63
|
},
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
advanced: {
|
|
65
|
+
defaultCookieAttributes: {
|
|
66
|
+
sameSite: "none",
|
|
67
|
+
secure: true,
|
|
68
|
+
httpOnly: true,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
59
71
|
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
60
72
|
plugins: [expo()],
|
|
61
73
|
{{/if}}
|
|
@@ -73,7 +85,7 @@ import * as schema from "../db/schema/auth";
|
|
|
73
85
|
import { env } from "cloudflare:workers";
|
|
74
86
|
|
|
75
87
|
export const auth = betterAuth({
|
|
76
|
-
|
|
88
|
+
database: drizzleAdapter(db, {
|
|
77
89
|
{{#if (eq database "postgres")}}provider: "pg",{{/if}}
|
|
78
90
|
{{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
|
|
79
91
|
{{#if (eq database "mysql")}}provider: "mysql",{{/if}}
|
|
@@ -85,6 +97,13 @@ export const auth = betterAuth({
|
|
|
85
97
|
},
|
|
86
98
|
secret: env.BETTER_AUTH_SECRET,
|
|
87
99
|
baseURL: env.BETTER_AUTH_URL,
|
|
100
|
+
advanced: {
|
|
101
|
+
defaultCookieAttributes: {
|
|
102
|
+
sameSite: "none",
|
|
103
|
+
secure: true,
|
|
104
|
+
httpOnly: true,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
88
107
|
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
89
108
|
plugins: [expo()],
|
|
90
109
|
{{/if}}
|
|
@@ -110,6 +129,13 @@ export const auth = betterAuth({
|
|
|
110
129
|
],
|
|
111
130
|
emailAndPassword: {
|
|
112
131
|
enabled: true,
|
|
132
|
+
},
|
|
133
|
+
advanced: {
|
|
134
|
+
defaultCookieAttributes: {
|
|
135
|
+
sameSite: "none",
|
|
136
|
+
secure: true,
|
|
137
|
+
httpOnly: true,
|
|
138
|
+
},
|
|
113
139
|
}
|
|
114
140
|
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
115
141
|
, plugins: [expo()]
|
|
@@ -133,9 +159,16 @@ export const auth = betterAuth({
|
|
|
133
159
|
],
|
|
134
160
|
emailAndPassword: {
|
|
135
161
|
enabled: true,
|
|
162
|
+
},
|
|
163
|
+
advanced: {
|
|
164
|
+
defaultCookieAttributes: {
|
|
165
|
+
sameSite: "none",
|
|
166
|
+
secure: true,
|
|
167
|
+
httpOnly: true,
|
|
168
|
+
},
|
|
136
169
|
}
|
|
137
170
|
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
138
171
|
, plugins: [expo()]
|
|
139
172
|
{{/if}}
|
|
140
173
|
});
|
|
141
|
-
{{/if}}
|
|
174
|
+
{{/if}}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{{#if (eq api "orpc")}}
|
|
2
2
|
import { {{#if auth}}protectedProcedure, {{/if}}publicProcedure } from "../lib/orpc";
|
|
3
|
+
import type { RouterClient } from "@orpc/server";
|
|
3
4
|
{{#if (includes examples "todo")}}
|
|
4
5
|
import { todoRouter } from "./todo";
|
|
5
6
|
{{/if}}
|
|
@@ -21,6 +22,7 @@ export const appRouter = {
|
|
|
21
22
|
{{/if}}
|
|
22
23
|
};
|
|
23
24
|
export type AppRouter = typeof appRouter;
|
|
25
|
+
export type AppRouterClient = RouterClient<typeof appRouter>;
|
|
24
26
|
{{else if (eq api "trpc")}}
|
|
25
27
|
import {
|
|
26
28
|
{{#if auth}}protectedProcedure, {{/if}}publicProcedure,
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import alchemy from "alchemy";
|
|
2
|
+
{{#if (eq webDeploy "alchemy")}}
|
|
3
|
+
{{#if (includes frontend "next")}}
|
|
4
|
+
import { Next } from "alchemy/cloudflare";
|
|
5
|
+
{{else if (includes frontend "nuxt")}}
|
|
6
|
+
import { Nuxt } from "alchemy/cloudflare";
|
|
7
|
+
{{else if (includes frontend "svelte")}}
|
|
8
|
+
import { SvelteKit } from "alchemy/cloudflare";
|
|
9
|
+
{{else if (includes frontend "tanstack-start")}}
|
|
10
|
+
import { TanStackStart } from "alchemy/cloudflare";
|
|
11
|
+
{{else if (includes frontend "tanstack-router")}}
|
|
12
|
+
import { Vite } from "alchemy/cloudflare";
|
|
13
|
+
{{else if (includes frontend "react-router")}}
|
|
14
|
+
import { ReactRouter } from "alchemy/cloudflare";
|
|
15
|
+
{{else if (includes frontend "solid")}}
|
|
16
|
+
import { Vite } from "alchemy/cloudflare";
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{/if}}
|
|
19
|
+
{{#if (eq serverDeploy "alchemy")}}
|
|
20
|
+
import { Worker, WranglerJson } from "alchemy/cloudflare";
|
|
21
|
+
{{#if (eq dbSetup "d1")}}
|
|
22
|
+
import { D1Database } from "alchemy/cloudflare";
|
|
23
|
+
{{/if}}
|
|
24
|
+
{{/if}}
|
|
25
|
+
import { config } from "dotenv";
|
|
26
|
+
|
|
27
|
+
{{#if (and (eq webDeploy "alchemy") (eq serverDeploy "alchemy"))}}
|
|
28
|
+
config({ path: "./.env" });
|
|
29
|
+
config({ path: "./apps/web/.env" });
|
|
30
|
+
config({ path: "./apps/server/.env" });
|
|
31
|
+
{{else if (or (eq webDeploy "alchemy") (eq serverDeploy "alchemy"))}}
|
|
32
|
+
config({ path: "./.env" });
|
|
33
|
+
{{/if}}
|
|
34
|
+
|
|
35
|
+
const app = await alchemy("{{projectName}}");
|
|
36
|
+
|
|
37
|
+
{{#if (and (eq serverDeploy "alchemy") (eq dbSetup "d1"))}}
|
|
38
|
+
const db = await D1Database("database", {
|
|
39
|
+
name: `${app.name}-${app.stage}-db`,
|
|
40
|
+
migrationsDir: "apps/server/src/db/migrations",
|
|
41
|
+
});
|
|
42
|
+
{{/if}}
|
|
43
|
+
|
|
44
|
+
{{#if (eq webDeploy "alchemy")}}
|
|
45
|
+
{{#if (includes frontend "next")}}
|
|
46
|
+
export const web = await Next("web", {
|
|
47
|
+
{{#if (eq serverDeploy "alchemy")}}cwd: "apps/web",{{/if}}
|
|
48
|
+
name: `${app.name}-${app.stage}-web`,
|
|
49
|
+
bindings: {
|
|
50
|
+
{{#if (eq backend "convex")}}
|
|
51
|
+
NEXT_PUBLIC_CONVEX_URL: process.env.NEXT_PUBLIC_CONVEX_URL || "",
|
|
52
|
+
{{else}}
|
|
53
|
+
NEXT_PUBLIC_SERVER_URL: process.env.NEXT_PUBLIC_SERVER_URL || "",
|
|
54
|
+
{{/if}}
|
|
55
|
+
},
|
|
56
|
+
dev: {
|
|
57
|
+
command: "{{packageManager}} run dev"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
{{else if (includes frontend "nuxt")}}
|
|
61
|
+
export const web = await Nuxt("web", {
|
|
62
|
+
{{#if (eq serverDeploy "alchemy")}}cwd: "apps/web",{{/if}}
|
|
63
|
+
name: `${app.name}-${app.stage}-web`,
|
|
64
|
+
bindings: {
|
|
65
|
+
{{#if (eq backend "convex")}}
|
|
66
|
+
NUXT_PUBLIC_CONVEX_URL: process.env.NUXT_PUBLIC_CONVEX_URL || "",
|
|
67
|
+
{{else}}
|
|
68
|
+
NUXT_PUBLIC_SERVER_URL: process.env.NUXT_PUBLIC_SERVER_URL || "",
|
|
69
|
+
{{/if}}
|
|
70
|
+
},
|
|
71
|
+
dev: {
|
|
72
|
+
command: "{{packageManager}} run dev"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
{{else if (includes frontend "svelte")}}
|
|
76
|
+
export const web = await SvelteKit("web", {
|
|
77
|
+
{{#if (eq serverDeploy "alchemy")}}cwd: "apps/web",{{/if}}
|
|
78
|
+
name: `${app.name}-${app.stage}-web`,
|
|
79
|
+
bindings: {
|
|
80
|
+
{{#if (eq backend "convex")}}
|
|
81
|
+
PUBLIC_CONVEX_URL: process.env.PUBLIC_CONVEX_URL || "",
|
|
82
|
+
{{else}}
|
|
83
|
+
PUBLIC_SERVER_URL: process.env.PUBLIC_SERVER_URL || "",
|
|
84
|
+
{{/if}}
|
|
85
|
+
},
|
|
86
|
+
dev: {
|
|
87
|
+
command: "{{packageManager}} run dev"
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
{{else if (includes frontend "tanstack-start")}}
|
|
91
|
+
export const web = await TanStackStart("web", {
|
|
92
|
+
{{#if (eq serverDeploy "alchemy")}}cwd: "apps/web",{{/if}}
|
|
93
|
+
name: `${app.name}-${app.stage}-web`,
|
|
94
|
+
bindings: {
|
|
95
|
+
{{#if (eq backend "convex")}}
|
|
96
|
+
VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
|
|
97
|
+
{{else}}
|
|
98
|
+
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
|
|
99
|
+
{{/if}}
|
|
100
|
+
},
|
|
101
|
+
dev: {
|
|
102
|
+
command: "{{packageManager}} run dev"
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
{{else if (includes frontend "tanstack-router")}}
|
|
106
|
+
export const web = await Vite("web", {
|
|
107
|
+
{{#if (eq serverDeploy "alchemy")}}cwd: "apps/web",{{/if}}
|
|
108
|
+
name: `${app.name}-${app.stage}-web`,
|
|
109
|
+
assets: "dist",
|
|
110
|
+
bindings: {
|
|
111
|
+
{{#if (eq backend "convex")}}
|
|
112
|
+
VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
|
|
113
|
+
{{else}}
|
|
114
|
+
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
|
|
115
|
+
{{/if}}
|
|
116
|
+
},
|
|
117
|
+
dev: {
|
|
118
|
+
command: "{{packageManager}} run dev"
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
{{else if (includes frontend "react-router")}}
|
|
122
|
+
export const web = await ReactRouter("web", {
|
|
123
|
+
{{#if (eq serverDeploy "alchemy")}}cwd: "apps/web",{{/if}}
|
|
124
|
+
name: `${app.name}-${app.stage}-web`,
|
|
125
|
+
bindings: {
|
|
126
|
+
{{#if (eq backend "convex")}}
|
|
127
|
+
VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
|
|
128
|
+
{{else}}
|
|
129
|
+
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
|
|
130
|
+
{{/if}}
|
|
131
|
+
},
|
|
132
|
+
dev: {
|
|
133
|
+
command: "{{packageManager}} run dev"
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
{{else if (includes frontend "solid")}}
|
|
137
|
+
export const web = await Vite("web", {
|
|
138
|
+
{{#if (eq serverDeploy "alchemy")}}cwd: "apps/web",{{/if}}
|
|
139
|
+
name: `${app.name}-${app.stage}-web`,
|
|
140
|
+
assets: "dist",
|
|
141
|
+
bindings: {
|
|
142
|
+
{{#if (eq backend "convex")}}
|
|
143
|
+
VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
|
|
144
|
+
{{else}}
|
|
145
|
+
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
|
|
146
|
+
{{/if}}
|
|
147
|
+
},
|
|
148
|
+
dev: {
|
|
149
|
+
command: "{{packageManager}} run dev"
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
{{/if}}
|
|
153
|
+
{{/if}}
|
|
154
|
+
|
|
155
|
+
{{#if (eq serverDeploy "alchemy")}}
|
|
156
|
+
export const server = await Worker("server", {
|
|
157
|
+
{{#if (eq webDeploy "alchemy")}}cwd: "apps/server",{{/if}}
|
|
158
|
+
name: `${app.name}-${app.stage}`,
|
|
159
|
+
entrypoint: "src/index.ts",
|
|
160
|
+
compatibility: "node",
|
|
161
|
+
bindings: {
|
|
162
|
+
{{#if (eq dbSetup "d1")}}
|
|
163
|
+
DB: db,
|
|
164
|
+
{{else if (and (ne database "none") (ne dbSetup "none"))}}
|
|
165
|
+
DATABASE_URL: alchemy.secret(process.env.DATABASE_URL),
|
|
166
|
+
{{/if}}
|
|
167
|
+
CORS_ORIGIN: process.env.CORS_ORIGIN || "",
|
|
168
|
+
{{#if auth}}
|
|
169
|
+
BETTER_AUTH_SECRET: alchemy.secret(process.env.BETTER_AUTH_SECRET),
|
|
170
|
+
BETTER_AUTH_URL: process.env.BETTER_AUTH_URL || "",
|
|
171
|
+
{{/if}}
|
|
172
|
+
{{#if (includes examples "ai")}}
|
|
173
|
+
GOOGLE_GENERATIVE_AI_API_KEY: alchemy.secret(process.env.GOOGLE_GENERATIVE_AI_API_KEY),
|
|
174
|
+
{{/if}}
|
|
175
|
+
{{#if (eq dbSetup "turso")}}
|
|
176
|
+
DATABASE_AUTH_TOKEN: alchemy.secret(process.env.DATABASE_AUTH_TOKEN),
|
|
177
|
+
{{/if}}
|
|
178
|
+
},
|
|
179
|
+
dev: {
|
|
180
|
+
port: 3000,
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
await WranglerJson("wrangler", {
|
|
185
|
+
worker: server,
|
|
186
|
+
});
|
|
187
|
+
{{/if}}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
{{#if (and (eq webDeploy "alchemy") (eq serverDeploy "alchemy"))}}
|
|
192
|
+
console.log(`Web -> ${web.url}`);
|
|
193
|
+
console.log(`Server -> ${server.url}`);
|
|
194
|
+
{{else if (eq webDeploy "alchemy")}}
|
|
195
|
+
console.log(`Web -> ${web.url}`);
|
|
196
|
+
{{else if (eq serverDeploy "alchemy")}}
|
|
197
|
+
console.log(`Server -> ${server.url}`);
|
|
198
|
+
{{/if}}
|
|
199
|
+
|
|
200
|
+
await app.finalize();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// This file infers types for the cloudflare:workers environment from your Alchemy Worker.
|
|
2
|
+
// @see https://alchemy.run/concepts/bindings/#type-safe-bindings
|
|
3
|
+
|
|
4
|
+
{{#if (eq webDeploy "alchemy")}}
|
|
5
|
+
import type { server } from "../../alchemy.run";
|
|
6
|
+
{{else}}
|
|
7
|
+
import type { server } from "./alchemy.run";
|
|
8
|
+
{{/if}}
|
|
9
|
+
|
|
10
|
+
export type CloudflareEnv = typeof server.Env;
|
|
11
|
+
|
|
12
|
+
declare global {
|
|
13
|
+
type Env = CloudflareEnv;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module "cloudflare:workers" {
|
|
17
|
+
namespace Cloudflare {
|
|
18
|
+
export interface Env extends CloudflareEnv {}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
|
4
4
|
*/
|
|
5
5
|
{
|
|
6
|
-
"$schema": "
|
|
6
|
+
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
7
7
|
"name": "{{projectName}}",
|
|
8
8
|
"main": "./.output/server/index.mjs",
|
|
9
9
|
"compatibility_date": "2025-07-01",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
|
4
4
|
*/
|
|
5
5
|
{
|
|
6
|
-
"$schema": "
|
|
6
|
+
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
7
7
|
"name": "{{projectName}}",
|
|
8
8
|
"main": ".svelte-kit/cloudflare/_worker.js",
|
|
9
9
|
"compatibility_date": "2025-07-05",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"path": "./.nuxt/tsconfig.node.json"
|
|
15
|
-
}
|
|
16
|
-
{{#unless (or (eq backend "convex") (eq backend "none"))}}
|
|
17
|
-
,
|
|
15
|
+
}{{#unless (or (eq backend "convex") (eq backend "none"))}},
|
|
18
16
|
{
|
|
19
17
|
"path": "../server"
|
|
20
18
|
}
|
|
21
19
|
{{/unless}}
|
|
22
|
-
]
|
|
20
|
+
]{{#if (eq webDeploy "alchemy")}},
|
|
21
|
+
"include": ["alchemy.run.ts"]
|
|
22
|
+
{{/if}}
|
|
23
23
|
}
|
|
@@ -7,9 +7,8 @@ import { link, orpc } from "@/utils/orpc";
|
|
|
7
7
|
import type { QueryClient } from "@tanstack/react-query";
|
|
8
8
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
9
9
|
import { useState } from "react";
|
|
10
|
-
import type { RouterClient } from "@orpc/server";
|
|
11
10
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
12
|
-
import type {
|
|
11
|
+
import type { AppRouterClient } from "../../../server/src/routers";
|
|
13
12
|
import { createORPCClient } from "@orpc/client";
|
|
14
13
|
{{/if}}
|
|
15
14
|
{{#if (eq api "trpc")}}
|
|
@@ -67,7 +66,7 @@ function RootComponent() {
|
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
{{#if (eq api "orpc")}}
|
|
70
|
-
const [client] = useState<
|
|
69
|
+
const [client] = useState<AppRouterClient>(() => createORPCClient(link));
|
|
71
70
|
const [orpcUtils] = useState(() => createTanstackQueryUtils(client));
|
|
72
71
|
{{/if}}
|
|
73
72
|
|
|
@@ -6,7 +6,6 @@ import { NavLink } from "react-router";
|
|
|
6
6
|
{{else if (or (includes frontend "tanstack-router") (includes frontend "tanstack-start"))}}
|
|
7
7
|
import { Link } from "@tanstack/react-router";
|
|
8
8
|
{{/if}}
|
|
9
|
-
|
|
10
9
|
{{#unless (includes frontend "tanstack-start")}}
|
|
11
10
|
import { ModeToggle } from "./mode-toggle";
|
|
12
11
|
{{/unless}}
|