output: "export") is a folder of HTML and JS on the free static hosting and CDN. An app that needs a server at request time (server actions, middleware, route handlers that answer dynamically, cookies(), ISR, next/image optimization) runs as a container built from its Dockerfile, like any other backend. This guide covers both. It was run at Forge v1.10.1-0.20261123064811-54313eead62f.
Before you begin
- Node.js, and the app in a git repository.
- Forge:
reliant forgeinside Reliant, ornpx -y @reliantlabs/forge@latestanywhere else. - Static: nothing to pay (one hosted static site per person is free). Server: a Reliant account with app hosting billing.
Path 1: a static export
Set the export innext.config.mjs:
next.config.mjs
next build then writes out/, which is what Forge publishes. Every route is rendered at build time, so a dynamic segment like app/posts/[slug]/page.js needs a generateStaticParams() listing every slug. When the values exist only at runtime (records in your API), move the id into the query string: /posts/view?slug=…, read with useSearchParams.
1
Adopt and lint
terminal
next build does. On our test app:Output (trimmed)
npm run build, which is the authority.2
Deploy
Signed in:With no account,
terminal
npx -y @reliantlabs/forge@latest env deploy prod --claimable adopts the app if needed and publishes it, with a claim link valid for 72 hours. See Deploy without an account.3
Verify
terminal
index.html (200), a missing file with an extension is 404.Path 2: a Next.js server, from its Dockerfile
If the lint reports server actions, middleware orcookies(), and removing them isn’t an option, deploy the app as a service. Forge’s lint says this itself when the config isn’t an export: “a Next.js server is a process, so it ships as a workload”. Use Next’s standalone output and a Dockerfile:
Dockerfile
output: "standalone" in next.config.mjs. HOSTNAME=0.0.0.0 matters: the standalone server otherwise binds the container’s hostname only. Then adopt it as an app, not a site:
terminal
Output (trimmed)
--dry-run, then docker build ., reliant forge env render prod, and reliant forge env deploy prod --yes. Without billing it is queued, exit 7, with the billing link. A Next server needs more than the anonymous plan’s 128 MiB, so deploy it signed in. Verify with reliant forge env status prod, a curl of a server-rendered page, and reliant forge obs check prod --wait --json (exit 0 proven good, 1 regressed, 2 not proven, 8 the wait ran out; without OpenTelemetry it is 2, not proven good).
Don’t adopt a server app with --kind site: it is accepted, but every env then fails lint --static-export with static-export-not-exported and env render refuses the binding.
Next.js gotchas
next/imagewithoutunoptimizedfails the export: there is no image server.NEXT_PUBLIC_*is baked into the build, and public. Per-env values that must change without a rebuild go inruntime_config(served as/config.js); see Deploy a static site.- Route handlers (
app/api/*/route.ts) are allowed in an export only asGETwithexport const dynamic = "force-static".