Static sites
The root site is the project that answers at /: a marketing page, documentation, a landing page. It is static by default, which means it is built once and served as files.
Two modes
| Mode | What it builds | Choose it when |
|---|---|---|
static (default) | A Next.js static export, served as files behind the Foundation Router. | Every page can be rendered at build time. |
nextjs | A Next.js server deployed with OpenNext. | A page needs request-time rendering or a server route. |
pnpm nx g @empire-builder-kit/nx:site --mode=static
pnpm nx g @empire-builder-kit/nx:site --mode=nextjsHow static mode works
Build once. Serve files.
Choose Detail to inspect the labels. Download the SVG to keep or share this diagram.
A static site has no server at runtime. Slice paths take precedence over the root site on the same Router.
In static mode the Next.js configuration sets output: 'export', so next build writes HTML, CSS and JavaScript to a directory. Deployment publishes that directory as a static site attached to the Foundation Router. There is no Lambda function for the site and nothing to keep warm, so an idle site costs close to nothing.
What static mode rules out
A static export has no server, so the Next.js features that need one are not available:
- Route handlers and server actions. Call a Slice’s API from the browser.
- Request-time rendering, cookies and headers on the server.
- Dynamic routes without
generateStaticParams. Every page must be listed at build time. - The default image optimizer. Set
images: { unoptimized: true }or use pre-sized images.
If a feature needs sign-in or data, put it in a Product Slice. The root site and the Slices share one Router, so a link from the site to /billing stays on the same origin.
Continue building