The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Namespace from "alchemy/Namespace"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** The framework-integration package that drives the Nuxt build. */ |
| 5 | export const NUXT_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/nuxt"; |
| 6 | |
| 7 | /** The Node container deploy target for the Nuxt build. */ |
| 8 | export const NUXT_NODE_TARGET_SPECIFIER = "@alchemy.run/frontend-frameworks/nuxt/node"; |
| 9 | |
| 10 | export interface NuxtProps extends FrameworkSiteProps { |
| 11 | /** |
| 12 | * Nuxt config overrides merged over the project's own `nuxt.config.ts` |
| 13 | * (highest-priority layer). `nitro.preset` is owned by the Node deploy |
| 14 | * target and may not be set here. |
| 15 | */ |
| 16 | nuxt?: Record<string, unknown>; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Deploy a Nuxt application to a Hetzner Cloud Server: the nitro Node |
| 21 | * server as a systemd unit on port 3000, static assets baked into the |
| 22 | * unit. |
| 23 | * |
| 24 | * The build runs through `@alchemy.run/frontend-frameworks/nuxt` with the |
| 25 | * `@alchemy.run/frontend-frameworks/nuxt/node` deploy target (`nitro.preset` |
| 26 | * `"node"`). |
| 27 | * |
| 28 | * |
| 29 | * ### Creating Nuxt Sites |
| 30 | * **Example:** Basic Nuxt App |
| 31 | * ```typescript |
| 32 | * const site = yield* Hetzner.Website.Nuxt("Web", { |
| 33 | * rootDir: "./app", |
| 34 | * }); |
| 35 | * ``` |
| 36 | * |
| 37 | * **Example:** Custom Domain |
| 38 | * ```typescript |
| 39 | * const site = yield* Hetzner.Website.Nuxt("Web", { |
| 40 | * rootDir: "./app", |
| 41 | * domain: "app.example.com", |
| 42 | * zone, |
| 43 | * }); |
| 44 | * ``` |
| 45 | * |
| 46 | * @resource |
| 47 | * @product Website |
| 48 | */ |
| 49 | export const Nuxt = (id: string, props: NuxtProps = {}) => |
| 50 | makeFrameworkSite(id, props, { |
| 51 | name: "Nuxt", |
| 52 | framework: NUXT_FRAMEWORK_SPECIFIER, |
| 53 | target: NUXT_NODE_TARGET_SPECIFIER, |
| 54 | options: props.nuxt ? { nuxt: props.nuxt } : undefined, |
| 55 | }).pipe(Namespace.push(id)); |