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

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