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

main
ts 58 lines 1.89 KB
Raw
1 import * as Namespace from "alchemy/Namespace";
2 import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts";
3
4 /**
5 * The Next.js Node framework module (it is its own deploy target — not
6 * OpenNext). Container-optimal path is `next build` + a long-running Node
7 * process.
8 */
9 export const NEXTJS_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/nextjs/node";
10
11 /** The Node container deploy target for the Next.js build. */
12 export const NEXTJS_NODE_TARGET_SPECIFIER = "@alchemy.run/frontend-frameworks/nextjs/node";
13
14 export interface NextjsProps extends FrameworkSiteProps {}
15
16 /**
17 * Deploy a Next.js application to Railway as a long-running Node process:
18 * `next build`, then a serve entry that `import("next")` +
19 * `next({ dev: false }).prepare()` + `getRequestHandler()` on `PORT`
20 * (default 3000). **Not** OpenNext — those wrappers are Lambda/workerd.
21 *
22 * The image `npm install`s `next`, `react`, and `react-dom`, and bakes
23 * `.next` plus `public/` into `/app`.
24 *
25 * During `alchemy dev` the site is Next's own dev server (`next dev`) and
26 * no cloud resources are declared; `Alchemy.remote()` opts back into the
27 * full live deployment.
28 *
29 * ### Creating Next.js Sites
30 * **Example:** Basic Next.js App
31 * ```typescript
32 * const site = yield* Railway.Website.Nextjs("Web", {
33 * rootDir: "./app",
34 * });
35 * ```
36 *
37 * ### Server Configuration
38 * **Example:** Process Environment
39 * ```typescript
40 * const site = yield* Railway.Website.Nextjs("Web", {
41 * rootDir: "./app",
42 * env: {
43 * API_BASE: "https://api.example.com",
44 * },
45 * });
46 * ```
47 *
48 * @resource
49 * @product Website
50 */
51 export const Nextjs = (id: string, props: NextjsProps = {}) =>
52 makeFrameworkSite(id, props, {
53 name: "Nextjs",
54 framework: NEXTJS_FRAMEWORK_SPECIFIER,
55 target: NEXTJS_NODE_TARGET_SPECIFIER,
56 bake: "next",
57 install: ["next", "react", "react-dom"],
58 }).pipe(Namespace.push(id));