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
    DocsGuides

    Add a static site

    The root site serves the pages at /. Static mode is the default and exports plain files at build time.

    On this page
    1. Generate the site
    2. Keep it static
    3. Verify and deploy

    Generate the site

    bash
    pnpm nx g @empire-builder-kit/nx:site --mode=static

    The generator creates packages/site. A workspace has one root site. Static is the default mode, so --mode=static is optional.

    Keep it static

    The site’s Next.js configuration carries the two settings a static export needs:

    next.config.ts
    const config = {
      output: 'export',
      images: { unoptimized: true },
    };
    • Give every dynamic route a generateStaticParams function that lists its pages.
    • Do not add route handlers under app/api. Call a Slice’s API from the browser.
    • Read configuration from NEXT_PUBLIC_ variables at build time. There is no server to read it later.

    If the build has a page it cannot export, next build fails and names the route.

    Verify and deploy

    bash
    pnpm nx run site:verify

    The site deploys with the rest of the workspace, after the Foundation. See Deploy.