@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 74 lines 2.41 KB
Raw
1 import * as Namespace from "alchemy/Namespace";
2 import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts";
3
4 /** The framework-integration package that drives the TanStack Start build. */
5 export const TANSTACK_START_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/tanstack-start";
6
7 /** The Node container deploy target for the TanStack Start build. */
8 export const TANSTACK_START_NODE_TARGET_SPECIFIER =
9 "@alchemy.run/frontend-frameworks/tanstack-start/node";
10
11 export interface TanStackStartProps extends FrameworkSiteProps {}
12
13 /**
14 * Deploy a [TanStack Start](https://tanstack.com/start) application to a
15 * Hetzner Cloud Server: the SSR server as a systemd unit on port 3000,
16 * static assets baked into the unit.
17 *
18 * The build runs through
19 * `@alchemy.run/frontend-frameworks/tanstack-start` with the
20 * `@alchemy.run/frontend-frameworks/tanstack-start/node` deploy target —
21 * both must be installed in your project, alongside `@tanstack/react-start`
22 * (or `@tanstack/solid-start`) and `vite`.
23 *
24 * Your `vite.config.ts` needs no adapter wiring: TanStack Start is pure
25 * Vite, so the integration drives the project's own `vite build`, forces
26 * the SSR bundle to be self-contained, and wraps its fetch handler as a
27 * Node HTTP server.
28 *
29 *
30 * ### Creating TanStack Start Sites
31 * **Example:** Basic TanStack Start App
32 * ```typescript
33 * const site = yield* Hetzner.Website.TanStackStart("Web", {
34 * rootDir: "./app",
35 * });
36 * ```
37 *
38 * **Example:** Custom Domain
39 * ```typescript
40 * const site = yield* Hetzner.Website.TanStackStart("Web", {
41 * rootDir: "./app",
42 * domain: "app.example.com",
43 * zone,
44 * });
45 * ```
46 *
47 * ### Server Configuration
48 * **Example:** Process Environment
49 * ```typescript
50 * const site = yield* Hetzner.Website.TanStackStart("Web", {
51 * rootDir: "./app",
52 * env: {
53 * API_BASE: "https://api.example.com",
54 * },
55 * });
56 * ```
57 *
58 * **Example:** Read An Environment Variable From A Server Function
59 * ```typescript
60 * // src/routes/index.tsx
61 * const getApiBase = createServerFn({ method: "GET" }).handler(() => ({
62 * apiBase: process.env.API_BASE,
63 * }));
64 * ```
65 *
66 * @resource
67 * @product Website
68 */
69 export const TanStackStart = (id: string, props: TanStackStartProps = {}) =>
70 makeFrameworkSite(id, props, {
71 name: "TanStackStart",
72 framework: TANSTACK_START_FRAMEWORK_SPECIFIER,
73 target: TANSTACK_START_NODE_TARGET_SPECIFIER,
74 }).pipe(Namespace.push(id));