# @bitbaum/sitekit A website as data. A site is pages; a page is sections; sections come from a **closed** union of shapes validated by Zod at runtime. One set of React renderers draws every site. A provenance sidecar records where every generated field came from — so "we fabricated nothing" is an assertion, not a promise. Extracted from [substrata](https://github.com/bitbaum/substrata)'s hosted-site model (2026-08). Decided in orangecat's ADR-0003 (the Site Factory). ## Why a closed union A generator emitting **data against this schema** is a task with a machine-checkable result; a generator emitting components is not. Per-site quality becomes a property of the renderers — fixing the `cards` renderer improves every site ever generated. And the schema is where review happens: `validateSite()` returns `path: message` errors a model can act on directly. The current kinds: `hero` (with optional CTAs), `prose`, `stats`, `meter`, `cards`, `definitions`, `feature` (a figure beside a story), `contact` (locations, address, hours — the fields provenance exists to protect), `faq`, `index`, `table`. Most kinds take an optional `anchor`, and the schema rejects any index entry or hero action that points at a fragment nothing carries. Extending the union is a deliberate act in THIS repo — a new kind lands with its schema, its renderer, and its tests in one commit, and every consumer gets it on the next version bump. ## Install ```bash pnpm add @bitbaum/sitekit ``` ESM-only. `react >= 18` is a peer dependency of `@bitbaum/sitekit/react`; the root export is framework-free (a Node generator or CI check can use it without React). ## Use ```ts import { validateSite, siteNavItems, sitePageAt, pageRendersOwnHeader } from '@bitbaum/sitekit'; const result = validateSite(generatorOutput); if (!result.success) throw new Error(result.errors.join('\n')); const site = result.data; // fully typed SiteSpec from here on ``` ```tsx import Link from 'next/link'; import { SiteMasthead, SiteFooter, SiteSections } from '@bitbaum/sitekit/react'; ``` `Link` is the one framework seam: it defaults to a plain ``, which is correct everywhere; a Next.js app passes `next/link` to get client-side navigation back. ## Application shell Product apps use the same masthead, navigation and footer with the application appearance. Import `@bitbaum/sitekit/styles.css` once. No Tailwind setup is required for this appearance; `--sk-*` variables map it to the product's shared design tokens. Existing document sites keep their utility-class appearance. ```tsx } actions={} /> ``` `styles.css` gives the chrome's own elements `box-sizing: border-box` at zero specificity, so it measures the same with or without a host reset. A host rule with any type, class or id selector still wins; a host rule on `*` alone has the same zero specificity, so if it loads before `styles.css` it loses (the usual `*, *::before, *::after { box-sizing: border-box }` reset agrees anyway). What a host passes into a slot (`brand`, `actions`, a footer's `extra`, a tab `icon`) keeps the host's own box model. Rendered nav items (`navItems`, `navGroups` items, `SiteNav` `items`) take a `SiteNavLink`: either `path`, an in-site path always rendered through `href()` (`'work'` → `/work`, `'notes:2026'` → `/notes:2026`), or `href`, used verbatim, never both. An `href` must start with `http:`, `https:`, `mailto:`, `tel:`, `//`, `#` or `?` (`isAllowedHref`); `siteNavLinkSchema` refuses anything else (`bitcoin:` and `lightning:` included) with a message on the `href` field, and the renderers leave such an item out. Its output is a `SiteNavLink`, so a parsed item goes straight to the renderers. A nav or group left with no items renders as one given none: the application nav and a group are not rendered, the document nav renders an empty `