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

main
ts 75 lines 2.55 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
15 * Railway: the SSR server plus client assets on one `Railway.Service`.
16 *
17 * The build runs through
18 * `@alchemy.run/frontend-frameworks/tanstack-start` with the
19 * `@alchemy.run/frontend-frameworks/tanstack-start/node` deploy target —
20 * both must be installed in your project, alongside
21 * `@tanstack/react-start` (or `@tanstack/solid-start`) and `vite`.
22 *
23 * Your `vite.config.ts` needs no adapter wiring: TanStack Start is pure
24 * Vite, so the integration drives the project's own `vite build`, forces
25 * the SSR bundle to be self-contained, and wraps its fetch handler as a
26 * Node HTTP server on port 3000.
27 *
28 * During `alchemy dev` the site is TanStack Start's own Vite dev server
29 * and no cloud resources are created. `Alchemy.remote()` opts back into
30 * the live Service path.
31 *
32 * ### Creating TanStack Start Sites
33 * **Example:** Basic TanStack Start App
34 * ```typescript
35 * const site = yield* Railway.Website.TanStackStart("Web", {
36 * rootDir: "./app",
37 * });
38 * ```
39 *
40 * **Example:** Custom Domain
41 * ```typescript
42 * const site = yield* Railway.Website.TanStackStart("Web", {
43 * rootDir: "./app",
44 * domain: "app.example.com",
45 * });
46 * ```
47 *
48 * ### Server Configuration
49 * **Example:** Process Environment
50 * ```typescript
51 * const site = yield* Railway.Website.TanStackStart("Web", {
52 * rootDir: "./app",
53 * env: {
54 * GREETING: "Hello from TanStack Start on Railway!",
55 * },
56 * });
57 * ```
58 *
59 * **Example:** Read An Environment Variable From A Server Function
60 * ```typescript
61 * // src/routes/index.tsx
62 * const getApiBase = createServerFn({ method: "GET" }).handler(() => ({
63 * apiBase: process.env.API_BASE,
64 * }));
65 * ```
66 *
67 * @resource
68 * @product Website
69 */
70 export const TanStackStart = (id: string, props: TanStackStartProps = {}) =>
71 makeFrameworkSite(id, props, {
72 name: "TanStackStart",
73 framework: TANSTACK_START_FRAMEWORK_SPECIFIER,
74 target: TANSTACK_START_NODE_TARGET_SPECIFIER,
75 }).pipe(Namespace.push(id));