@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 92 lines 3.21 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 a
28 * Hetzner Cloud Server: the SSR server as a systemd unit on port 3000,
29 * static assets (prerendered pages included) baked into the unit.
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 *
41 * ### Creating SolidStart Sites
42 * **Example:** Basic SolidStart App
43 * ```typescript
44 * const site = yield* Hetzner.Website.SolidStart("Web", {
45 * rootDir: "./app",
46 * });
47 * ```
48 *
49 * **Example:** Custom Domain
50 * ```typescript
51 * const site = yield* Hetzner.Website.SolidStart("Web", {
52 * rootDir: "./app",
53 * domain: "app.example.com",
54 * zone,
55 * });
56 * ```
57 *
58 * ### Server Configuration
59 * **Example:** Process Environment
60 * ```typescript
61 * const site = yield* Hetzner.Website.SolidStart("Web", {
62 * rootDir: "./app",
63 * env: {
64 * API_BASE: "https://api.example.com",
65 * },
66 * });
67 * ```
68 *
69 * ### Prerendering
70 * The integration owns the nitro plugin instance (a `nitroV2Plugin()` in
71 * your `vite.config.*` is rejected), so nitro options — prerendering
72 * included — go on the `nitro` prop. Prerendered pages are baked into the
73 * unit and served as static assets.
74 *
75 * **Example:** Prerender Routes
76 * ```typescript
77 * const site = yield* Hetzner.Website.SolidStart("Web", {
78 * rootDir: "./app",
79 * nitro: { prerender: { routes: ["/", "/about"] } },
80 * });
81 * ```
82 *
83 * @resource
84 * @product Website
85 */
86 export const SolidStart = (id: string, props: SolidStartProps = {}) =>
87 makeFrameworkSite(id, props, {
88 name: "SolidStart",
89 framework: SOLIDSTART_FRAMEWORK_SPECIFIER,
90 target: SOLIDSTART_NODE_TARGET_SPECIFIER,
91 options: { nitro: props.nitro },
92 }).pipe(Namespace.push(id));