Skip to content
nexisv1.3.3Build with Nexis
← Learning map

Foundation · lesson 03

Model pages, static paths, and render modes

Map source files to stable URLs, generate known dynamic content safely, and select a rendering mode from data requirements.

copyable patternserver-firstenterprise track

01

Routes are an output contract

Use predictable file names. index.tsx maps to a directory route, ordinary names map to path segments, and a bracketed segment describes a parameter.

  • Use static output for public documentation and immutable content.
  • Use server output for request-specific or private content.
  • Return a real 404 for an unknown resource, not a successful empty page.

02

Generate trusted dynamic paths

The installed Nexis practical fixture exports staticPaths for known dynamic slugs. Generate only safe values known at build time and validate all server-provided identifiers.

  • Do not construct paths from unchecked input.
  • Keep an article inventory separate from rendering code.
  • Use trailing-slash links when serving directory-style static output.

03

Do not cache private output

Static and public HTML can use a public cache policy; session-specific pages must use private or no-store semantics and must not leak into shared CDN caches.

  • Separate public docs from account routes.
  • Do not reuse cache keys across users.
  • Test GET, HEAD, 404, and 405 behavior in the production adapter.
Dynamic static route · framework-nativeTypeScript
export const staticPaths = ['quickstart', 'routing', 'security']

export default function Guide({ slug }: { readonly slug?: string }) {
  return (
    <article>
      <h1>{slug}</h1>
      <p>This known guide was generated at build time.</p>
    </article>
  )
}

PRACTICE LAB

Prove the behavior.

Add a [slug] route with three staticPaths values, run pnpm build, and inspect the three emitted HTML directories.