Skip to content
Empire Builder KitDocumentation
v1 Documentation

Find your next step.

Search the complete documentation, including code examples.

    Full-text search↑ ↓ navigate Enter open
    Browse documentation
    DocsCore concepts

    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.

    On this page
    1. Two modes
    2. How static mode works
    3. What static mode rules out

    Two modes

    ModeWhat it buildsChoose it when
    static (default)A Next.js static export, served as files behind the Foundation Router.Every page can be rendered at build time.
    nextjsA Next.js server deployed with OpenNext.A page needs request-time rendering or a server route.
    bash
    pnpm nx g @empire-builder-kit/nx:site --mode=static
    pnpm nx g @empire-builder-kit/nx:site --mode=nextjs

    How static mode works

    Architecture plate / static site

    Build once. Serve files.

    A static site is built once and served as filesIn static mode, next build exports the site to plain HTML, CSS and JavaScript files. Deployment uploads those files to a static site bucket attached to the Foundation Router. A visitor's request reaches the Router, which serves Product Slice paths from each Slice and every other path from the static files. No server runs for the site.STATIC MODEYOUR SOURCEpackages/siteNext.js App Router pagesBUILDnext buildoutput: 'export'RESULTPlain filesHTML · CSS · JavaScriptdeployAT RUNTIMEVisitorBrowser requestFOUNDATIONRouterOne per stageSlice paths first, then the site/STATIC SITEBucket of filesNo server to keep warm/billingProduct SlicesEach served at its own pathNeed request-time rendering?Generate with --mode=nextjs.

    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.

    The build writes files. The Router serves them. Nothing runs between requests.

    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.