@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, 06:00 UTC

main
ts 94 lines 3.35 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 SolidStart build. */
5 export const SOLIDSTART_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/solidstart";
6
7 /** The Node container deploy target for the SolidStart build. */
8 export const SOLIDSTART_NODE_TARGET_SPECIFIER = "@alchemy.run/frontend-frameworks/solidstart/node";
9
10 export interface SolidStartProps extends FrameworkSiteProps {
11 /**
12 * Nitro options forwarded into the nitro plugin the integration appends
13 * (prerendering, route rules, storage, ...). `preset` is owned by the
14 * Node deploy target and may not be set here. JSON-serializable values
15 * only — no functions or plugin instances.
16 *
17 * This is a prop (rather than project config) because the integration
18 * owns the nitro plugin instance: a `nitroV2Plugin()` in your project's
19 * `vite.config.*` is rejected, so this prop is the one home for nitro
20 * options — and it accepts values derived from other resources' Outputs,
21 * which a config file cannot.
22 */
23 nitro?: Record<string, unknown>;
24 }
25
26 /**
27 * Deploy a [SolidStart](https://start.solidjs.com) application to Railway:
28 * the SSR server plus client assets (prerendered pages included) on one
29 * `Railway.Service`.
30 *
31 * The build runs through `@alchemy.run/frontend-frameworks/solidstart` with
32 * the `@alchemy.run/frontend-frameworks/solidstart/node` deploy target —
33 * both must be installed in your project, alongside `@solidjs/start` and
34 * `@solidjs/vite-plugin-nitro-2`.
35 *
36 * Your `vite.config.ts` needs no adapter wiring: the integration drives the
37 * project's own `vite build` and appends its own nitro plugin instance
38 * carrying nitro's `node` preset.
39 *
40 * During `alchemy dev` the site is SolidStart's own Vite dev server and no
41 * cloud resources are created. `Alchemy.remote()` opts back into the live
42 * Service path.
43 *
44 * ### Creating SolidStart Sites
45 * **Example:** Basic SolidStart App
46 * ```typescript
47 * const site = yield* Railway.Website.SolidStart("Web", {
48 * rootDir: "./app",
49 * });
50 * ```
51 *
52 * **Example:** Custom Domain
53 * ```typescript
54 * const site = yield* Railway.Website.SolidStart("Web", {
55 * rootDir: "./app",
56 * domain: "app.example.com",
57 * });
58 * ```
59 *
60 * ### Server Configuration
61 * **Example:** Process Environment
62 * ```typescript
63 * const site = yield* Railway.Website.SolidStart("Web", {
64 * rootDir: "./app",
65 * env: {
66 * GREETING: "Hello from SolidStart on Railway!",
67 * },
68 * });
69 * ```
70 *
71 * ### Prerendering
72 * The integration owns the nitro plugin instance (a `nitroV2Plugin()` in
73 * your `vite.config.*` is rejected), so nitro options — prerendering
74 * included — go on the `nitro` prop. Prerendered pages are baked into the
75 * Service image and served as static files.
76 *
77 * **Example:** Prerender Routes
78 * ```typescript
79 * const site = yield* Railway.Website.SolidStart("Web", {
80 * rootDir: "./app",
81 * nitro: { prerender: { routes: ["/", "/about"] } },
82 * });
83 * ```
84 *
85 * @resource
86 * @product Website
87 */
88 export const SolidStart = (id: string, props: SolidStartProps = {}) =>
89 makeFrameworkSite(id, props, {
90 name: "SolidStart",
91 framework: SOLIDSTART_FRAMEWORK_SPECIFIER,
92 target: SOLIDSTART_NODE_TARGET_SPECIFIER,
93 options: { nitro: props.nitro },
94 }).pipe(Namespace.push(id));