1import * as Namespace from "../../Namespace.ts";
2import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts";
3
4/** Configuration for a Prisma Nextjs website. */
5export interface NextjsProps extends FrameworkSiteProps {}
6
7/**
8 * Next.js on Prisma Compute using next build and the existing Node custom-server target, not OpenNext. The artifact contains .next, public, configuration, and traced runtime dependencies, preserving installed package versions.
9 *
10 * Native framework development and HMR run without Prisma cloud resources.
11 * Apply `Alchemy.remote()` to use the live Compute deployment during dev.
12 * Packaging requires the optional `@vercel/nft` peer dependency.
13 *
14 * ### Creating a Website
15 * **Example:** Nextjs application
16 * ```typescript
17 * const site = yield* Prisma.Website.Nextjs("Web", {
18 * rootDir: "./app",
19 * });
20 * ```
21 *
22 * ### Deployment Configuration
23 * **Example:** Existing project and custom hostname
24 * ```typescript
25 * const site = yield* Prisma.Website.Nextjs("Web", {
26 * project,
27 * domain: "www.example.com",
28 * env: { API_BASE: "https://api.example.com" },
29 * compute: { destroyOldDeployment: true },
30 * });
31 * ```
32 *
33 * @resource
34 * @product Website
35 */
36export const Nextjs = (id: string, props: NextjsProps = {}) =>
37 makeFrameworkSite(id, props, {
38 framework: "@alchemy.run/frontend-frameworks/nextjs/node",
39 target: "@alchemy.run/frontend-frameworks/nextjs/node",
40 layout: "next",
41 }).pipe(Namespace.push(id));