# web: FACE 3, the human surface

web is the part people see: pages, the reference app, static chrome —
plus the composition root that boots and hardens the ONE listener
every face rides. Thin over core (queries only through
`core::reads`), shaped through `kit::tmpl` (typed ctx structs) and
`web::seo` (the head-lane builders). The file map lives in
`src/web/AGENTS.md`.

## the pieces

| piece | the one job |
|---|---|
| `mod.rs` | the **composition root** — merges api's router with web's own onto the ONE listener, exports the face. THE documented face-to-face meeting place |
| `router.rs` | the edge: security headers fleet-wide, CL+TE + dup-Host rejection at 400 (the guard names its reason — `edge.dup_host` — into telemetry), the drive-by guard (cross-site write riders → 403) |
| `serve.rs` | boot (config → db open → import → listen) → the 60s gauge pulse (telemetry ON only) → graceful SIGINT+SIGTERM drain. Also `live_probe` — the raw-TCP wire proof the battery drives |
| `pages.rs` | landing · docs index · doc pages · the wire-count fragment. Rows ride `core::reads`, ctx rides `kit::tmpl`, head lanes ride `seo` |
| `calc.rs` | the reference app — `internal/patterns.md` is the codex; strip it once the patterns live in your surface (fork.md §3) |
| `static_files.rs` | traversal-guarded + dotfile-blind static lane, ETag/304, the cache-age table (fonts 1y · css/js 1h · rest 1d) |
| `seo.rs` | pure text builders (robots/llms/sitemap/JSON-LD/agent-card) + the `Seo` head-lane bundle + `esc_html` (the ONE `| safe` lane) |

## the boot → drain shape

```
boot:    config → db open → import (hash-idempotent) → listen
serve:   request-span middleware · edge guard · router · static · pages
pulse:   gauges every 60s, ONLY when telemetry is ON (honest OFF:
         no task, no ticks, no cost beyond the spawn decision)
drain:   SIGINT/SIGTERM → stop the pulse → graceful shutdown →
         turso flush → exit 0
```

A template save rides the dev restart lane (`just serve` — watchexec
restarts on `.rs`/`.toml`/`.html`, ~2s, systemfd holds the port), and
templates COMPILE IN: a template that disagrees with its ctx is a
`just check` error, not a serve-boot blank.

## the UI lane

The ui kit's engine (vendored, SRI'd, the ONLY third-party js) + the
kit's committed sheet + the skin — the whole story lives in
`internal/assets.md`; the fragment/POST laws every surface copies live
in `internal/patterns.md` (calc is the worked example). The one
sentence version: **JS-off must be correct; JS-on makes it fast** —
every action is a native form POST whose response replaces ONE named
region (the chat dock streams its replies instead: same form law, the
answer rides back as SSE frames), and the no-js door 303s a header-less
post back to the page.
