Skip to content

Nextjs

Source: src/Fly/Website/Nextjs.ts

Deploy a Next.js application to Fly as a long-running Node process: next build, then a serve entry that import("next") + next({ dev: false }).prepare() + getRequestHandler(). The .next output (and public/ when present) is baked into the image; next is installed unbundled.

Do not use OpenNext AWS/CF wrappers — those are Lambda/workerd.

During alchemy dev the site is next dev and no cloud resources are declared; Alchemy.remote() opts back into the live Service path.

Basic Next.js App

const site = yield* Fly.Website.Nextjs("Web", {
rootDir: "./app",
});

Custom Domain

const site = yield* Fly.Website.Nextjs("Web", {
rootDir: "./app",
domain: "app.example.com",
});