Site / Creating a site

Building nodes: options or builder

The options object above handles most routes. To annotate in steps or share an annotation bundle across nodes, use the Site.node builder (the options object builds on the same implementation):

ts
import { Site } from 'foldkit-site'

const Person = Site.node(personRouter, AppRoute.Person)
  .title(({ personId }) => `Person ${personId} | Routing`)
  .section('People')
  .node

Methods infer the route type across steps, and reusable bundles compose through .pipe (or pipe) without type annotations:

ts
import { type NodeBuilder } from 'foldkit-site'

const inPeopleSection = <R extends { readonly _tag: string }>(b: NodeBuilder<R>) =>
  b.section('People').shortcut(['G', 'P'])

const People = Site.node(peopleRouter, AppRoute.People).pipe(inPeopleSection).node

Read .node at any stage: every step returns a frozen, usable node. The full annotation set is title, section, landing (the section's nav target params), shortcut (keys bound by Site.shortcuts), history, surface, layout, and view.

Node tags always derive from the route case so every route case maps to one node. Prefetching and server rendering stay caller-composed rather than wrapped in a separate site plan object.