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
| 1 | import * as Namespace from "alchemy/Namespace"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** |
| 5 | * The framework-integration module that drives `next build` plus a Node |
| 6 | * `next({ dev: false })` serve entry. This module IS the Node pipeline |
| 7 | * (not OpenNext). |
| 8 | */ |
| 9 | export const NEXTJS_NODE_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/nextjs/node"; |
| 10 | |
| 11 | export interface NextjsProps extends FrameworkSiteProps {} |
| 12 | |
| 13 | /** |
| 14 | * Deploy a Next.js application to a Hetzner Cloud Server: `next build` |
| 15 | * then a long-running `next({ dev: false })` systemd unit on port 3000. |
| 16 | * Does **not** use OpenNext (those wrappers are Lambda/workerd). |
| 17 | * |
| 18 | * The `.next` output (and `public/` when present) is packed into the |
| 19 | * unit archive. `next`, `react`, and `react-dom` are installed on the |
| 20 | * unit with `npm install` rather than bundled. |
| 21 | * |
| 22 | * During `alchemy dev` the site is `next dev` and no cloud resources |
| 23 | * are declared; `Alchemy.remote()` opts back into the live Service. |
| 24 | * |
| 25 | * |
| 26 | * ### Creating Next.js Sites |
| 27 | * **Example:** Basic Next.js App |
| 28 | * ```typescript |
| 29 | * const site = yield* Hetzner.Website.Nextjs("Web", { |
| 30 | * rootDir: "./app", |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * **Example:** Custom Domain |
| 35 | * ```typescript |
| 36 | * const site = yield* Hetzner.Website.Nextjs("Web", { |
| 37 | * rootDir: "./app", |
| 38 | * domain: "app.example.com", |
| 39 | * zone, |
| 40 | * }); |
| 41 | * ``` |
| 42 | * |
| 43 | * @resource |
| 44 | * @product Website |
| 45 | */ |
| 46 | export const Nextjs = (id: string, props: NextjsProps = {}) => |
| 47 | makeFrameworkSite(id, props, { |
| 48 | name: "Nextjs", |
| 49 | framework: NEXTJS_NODE_FRAMEWORK_SPECIFIER, |
| 50 | target: NEXTJS_NODE_FRAMEWORK_SPECIFIER, |
| 51 | skipClientAssets: true, |
| 52 | install: ["next", "react", "react-dom"], |
| 53 | }).pipe(Namespace.push(id)); |