@nifrajs/cli 5.3.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +2 -1
  3. package/dist/check-scan.d.ts +6 -0
  4. package/dist/check-scan.d.ts.map +1 -1
  5. package/dist/check-scan.js +10 -10
  6. package/dist/check-scan.js.map +1 -1
  7. package/dist/check.d.ts.map +1 -1
  8. package/dist/check.js +1 -0
  9. package/dist/check.js.map +1 -1
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +6 -5
  12. package/dist/cli.js.map +1 -1
  13. package/dist/docs-search.d.ts +10 -1
  14. package/dist/docs-search.d.ts.map +1 -1
  15. package/dist/docs-search.js +86 -9
  16. package/dist/docs-search.js.map +1 -1
  17. package/dist/doctor.d.ts.map +1 -1
  18. package/dist/doctor.js +49 -4
  19. package/dist/doctor.js.map +1 -1
  20. package/dist/load.d.ts +4 -1
  21. package/dist/load.d.ts.map +1 -1
  22. package/dist/load.js +8 -0
  23. package/dist/load.js.map +1 -1
  24. package/dist/lock-links.d.ts.map +1 -1
  25. package/dist/lock-links.js +3 -1
  26. package/dist/lock-links.js.map +1 -1
  27. package/dist/mcp-http.js +1 -1
  28. package/dist/recipes/5.4.0.d.ts +10 -0
  29. package/dist/recipes/5.4.0.d.ts.map +1 -0
  30. package/dist/recipes/5.4.0.js +27 -0
  31. package/dist/recipes/5.4.0.js.map +1 -0
  32. package/dist/recipes/5.5.0.d.ts +9 -0
  33. package/dist/recipes/5.5.0.d.ts.map +1 -0
  34. package/dist/recipes/5.5.0.js +31 -0
  35. package/dist/recipes/5.5.0.js.map +1 -0
  36. package/dist/recipes/index.d.ts +7 -0
  37. package/dist/recipes/index.d.ts.map +1 -1
  38. package/dist/recipes/index.js +4 -0
  39. package/dist/recipes/index.js.map +1 -1
  40. package/dist/release-verification.d.ts +20 -0
  41. package/dist/release-verification.d.ts.map +1 -1
  42. package/dist/release-verification.js +62 -13
  43. package/dist/release-verification.js.map +1 -1
  44. package/dist/review.d.ts.map +1 -1
  45. package/dist/review.js +2 -0
  46. package/dist/review.js.map +1 -1
  47. package/dist/rules/codes.d.ts +2 -0
  48. package/dist/rules/codes.d.ts.map +1 -1
  49. package/dist/rules/codes.js +2 -0
  50. package/dist/rules/codes.js.map +1 -1
  51. package/dist/rules/explanations.d.ts.map +1 -1
  52. package/dist/rules/explanations.js +12 -2
  53. package/dist/rules/explanations.js.map +1 -1
  54. package/dist/rules/legacy.d.ts.map +1 -1
  55. package/dist/rules/legacy.js +63 -19
  56. package/dist/rules/legacy.js.map +1 -1
  57. package/dist/rules/security.d.ts +6 -0
  58. package/dist/rules/security.d.ts.map +1 -1
  59. package/dist/rules/security.js +152 -2
  60. package/dist/rules/security.js.map +1 -1
  61. package/dist/rules/zones.d.ts.map +1 -1
  62. package/dist/rules/zones.js +43 -1
  63. package/dist/rules/zones.js.map +1 -1
  64. package/dist/smoke.d.ts +17 -1
  65. package/dist/smoke.d.ts.map +1 -1
  66. package/dist/smoke.js +49 -0
  67. package/dist/smoke.js.map +1 -1
  68. package/dist/upgrade.d.ts +40 -12
  69. package/dist/upgrade.d.ts.map +1 -1
  70. package/dist/upgrade.js +182 -17
  71. package/dist/upgrade.js.map +1 -1
  72. package/dist/verification-plan.d.ts +4 -0
  73. package/dist/verification-plan.d.ts.map +1 -1
  74. package/dist/verification-plan.js +48 -0
  75. package/dist/verification-plan.js.map +1 -1
  76. package/dist/version-drift.d.ts +2 -1
  77. package/dist/version-drift.d.ts.map +1 -1
  78. package/dist/version-drift.js +11 -26
  79. package/dist/version-drift.js.map +1 -1
  80. package/dist/web-app-options.d.ts +1 -1
  81. package/dist/web-app-options.d.ts.map +1 -1
  82. package/dist/web-app-options.js.map +1 -1
  83. package/docs/examples.json +14 -2
  84. package/docs/llms-full.txt +759 -199
  85. package/docs/types.json +258 -44
  86. package/package.json +11 -11
  87. package/src/check-scan.ts +10 -12
  88. package/src/check.ts +1 -0
  89. package/src/cli.ts +6 -5
  90. package/src/docs-search.ts +90 -10
  91. package/src/doctor.ts +60 -4
  92. package/src/load.ts +13 -0
  93. package/src/lock-links.ts +3 -1
  94. package/src/mcp-http.ts +1 -1
  95. package/src/recipes/5.4.0.ts +28 -0
  96. package/src/recipes/5.5.0.ts +32 -0
  97. package/src/recipes/index.ts +11 -0
  98. package/src/release-verification.ts +88 -12
  99. package/src/review.ts +2 -0
  100. package/src/rules/codes.ts +2 -0
  101. package/src/rules/explanations.ts +12 -2
  102. package/src/rules/legacy.ts +75 -20
  103. package/src/rules/security.ts +171 -2
  104. package/src/rules/zones.ts +44 -1
  105. package/src/smoke.ts +70 -0
  106. package/src/upgrade.ts +199 -21
  107. package/src/verification-plan.ts +51 -0
  108. package/src/version-drift.ts +18 -26
  109. package/src/web-app-options.ts +1 -0
@@ -235,33 +235,15 @@ to full-stack later without a rewrite.
235
235
  -
236
236
  **Throughput - the realistic case.** Router micro-benchmarks flatter Hono (a single compiled
237
237
  regex), but a real request also pays for middleware and validation,
238
- context, and serialization. In the current matrix (median of 5 full runs) Nifra
239
- **tops the framework field on Bun** - level with Elysia on `GET /users/:id` at
240
- percentOf(
241
- httpWorkloadRps("Bun", "Nifra", "postUsers"),
242
- httpWorkloadRps("Bun", "Elysia", "postUsers"),
243
- of Elysia on the validated `POST` - and
244
- **leads every framework on Deno** on both workloads. On **Node** it
245
- **leads the framework field too** - at
246
- percentOf(
247
- httpWorkloadRps("Node", "Nifra", "postUsers"),
248
- httpWorkloadRps("Node", "Fastify", "postUsers"),
249
- of Fastify on the validated `POST` ({formatPercent(
250
- percentOf(
251
- httpWorkloadRps("Node", "Nifra", "postUsers"),
252
- httpWorkloadRps("Node", "node-raw", "postUsers"),
253
- )} of the raw-Node ceiling) and ahead on GET, with Elysia, Hono,
254
- and Express behind. In the realistic shape (security headers + CORS +
238
+ context, and serialization. In the current matrix Nifra runs **level with Elysia on Bun** -
239
+ 101% of Elysia on `GET /users/:id` and
240
+ 101% on the validated `POST` - and
241
+ **level with Fastify on Node** (98% of Fastify on GET,
242
+ 101% on the validated `POST`), with Elysia, Hono,
243
+ and Express behind. On **Deno** it runs at 97% of Elysia on
244
+ GET and 114% on the validated `POST`. In the realistic shape (security headers + CORS +
255
245
  bearer auth + cookies + validated query/body + a ~2.4 KB JSON response, measured with
256
- `oha`) Nifra runs at **{formatPercent(
257
- percentOf(
258
- httpRealworldRps("Bun", "Nifra", "get"),
259
- httpRealworldRps("Bun", "Elysia", "get"),
260
- )} of Elysia on GET and {formatPercent(
261
- percentOf(
262
- httpRealworldRps("Bun", "Nifra", "post"),
263
- httpRealworldRps("Bun", "Elysia", "post"),
264
- )} on POST**. Treat benchmark
246
+ `oha`) Nifra runs at **98% of Elysia on GET and 99% on POST**. Treat benchmark
265
247
  rows as same-run evidence, not a permanent law of nature.
266
248
 
267
249
  -
@@ -973,7 +955,7 @@ Check the value in the page's loader.
973
955
  ### Several methods, custom methods (all, method)
974
956
 
975
957
  `all()` registers one handler under every standard method, and `method()`
976
- under the method or methods you name, including one outside the standard seven. Both come
958
+ under the method or methods you name, including one outside the standard ones. Both come
977
959
  from `@nifrajs/core/methods` and are applied with `use()`:
978
960
 
979
961
  ```ts
@@ -981,9 +963,9 @@ import { server } from "@nifrajs/core/server"
981
963
  import { all, method } from "@nifrajs/core/methods"
982
964
 
983
965
  export const app = server()
984
- // GET, POST, PUT, PATCH, DELETE, HEAD and OPTIONS /echo
966
+ // GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS and QUERY /echo
985
967
  .use(all("/echo", (c) => ({ method: c.req.method })))
986
- // A method outside the standard seven
968
+ // A method outside the standard ones
987
969
  .use(method("PURGE", "/cache/:key", (c) => ({ purged: c.params.key })))
988
970
  // A list of methods, one handler
989
971
  .use(method(["GET", "POST"], "/search", (c) => ({ q: c.query.get("q") })))
@@ -996,7 +978,7 @@ registered for that method and path. One call is one registration: if any of its
996
978
  refused, none is added.
997
979
 
998
980
  -
999
- **There is no catch-all.** `all()` is the seven standard methods, and a
981
+ **There is no catch-all.** `all()` is the eight standard methods, and a
1000
982
  request with any other method is still a `405` with an `Allow`
1001
983
  header. To hand every request under a path to another handler whatever its method, use
1002
984
  `mount()`.
@@ -1019,6 +1001,48 @@ route is under a method it lists. `securityBaseline()` holds a custom method to
1019
1001
  its mutation rules, CSRF included, and `csrf()` publishes its evidence for one.
1020
1002
  Left unmatched, a route is reported as `unclassified-route`.
1021
1003
 
1004
+ #### QUERY
1005
+
1006
+ `QUERY` is a read like `GET` that carries its input in the body, for a
1007
+ filter too large or too structured for a URL. It is a standard method without a builder of
1008
+ its own: `method("QUERY", ...)` registers it, the route is typed and validates a
1009
+ `body` schema, and `all()` includes it. The typed client calls it as
1010
+ `$query(body)`, so a route segment named `query` stays an ordinary path,
1011
+ and retries it like the other idempotent methods.
1012
+
1013
+ ```ts
1014
+ import { client } from "@nifrajs/client"
1015
+ import { server } from "@nifrajs/core/server"
1016
+ import { method } from "@nifrajs/core/methods"
1017
+ import { t } from "@nifrajs/schema"
1018
+
1019
+ // QUERY: a safe, repeatable read whose filter travels in the body instead of the URL.
1020
+ export const app = server().use(
1021
+ method("QUERY", "/books", { body: t.object({ author: t.string() }) }, (c) => ({
1022
+ author: c.body.author,
1023
+ })),
1024
+ )
1025
+
1026
+ const api = client<typeof app>("https://api.example.com")
1027
+ const found = await api.books.$query({ author: "Le Guin" }) // the body is checked against the schema
1028
+ ```
1029
+
1030
+ -
1031
+ **OpenAPI:** a `toOpenAPI(app, { openapiVersion: "3.2.0" })` document
1032
+ lists it as the path item's `query` operation. OpenAPI 3.1 has no field for it,
1033
+ so a 3.1 document leaves the route out.
1034
+
1035
+ -
1036
+ **Middleware:** `csrf()` lets it through without a token, since a cross-site
1037
+ page cannot send one: a form has no such method, and a cross-origin `fetch` must
1038
+ pass a CORS preflight first. `cors()` advertises it, `bodyLimit()`
1039
+ bounds its body, and `securityBaseline()` holds it to the read rules.
1040
+
1041
+ -
1042
+ **Runtimes:** Bun, Node, Deno and workerd accept it. On Bun it is served by the portable
1043
+ router, since Bun's route table has no slot for it. The compact server from
1044
+ `@nifrajs/edge` has no way to register it.
1045
+
1022
1046
  Whether a custom method reaches the app is up to the runtime's HTTP parser.
1023
1047
  `PROPFIND`, `REPORT`, `PURGE` and `QUERY` arrive on
1024
1048
  Bun, Node, Deno and workerd. A token the parser does not know is answered by the runtime
@@ -1159,7 +1183,7 @@ A strict `t.object` here would reject real traffic. A signed cookie arrives as i
1159
1183
 
1160
1184
  A `headers` schema is validated before the handler like the other slots: a missing
1161
1185
  or malformed header is a `422` (`onValidationError` receives the kind
1162
- `"headers"`), and `c.headers` becomes the schema&rsquo;s typed output.
1186
+ `"headers"`), and `c.headers` becomes the schema's typed output.
1163
1187
  Every client sends headers no route declares - `host`, `user-agent`,
1164
1188
  `accept` - so a closed `t.object` validates only the names it declares,
1165
1189
  each read case-insensitively, which is also how the OpenAPI document lists them: one
@@ -2042,7 +2066,7 @@ export default {
2042
2066
  A store outage never fails a page. A read that throws, rejects, or outlives
2043
2067
  `storeTimeoutMs` is a miss and the page renders; a failed write still returns the
2044
2068
  rendered page; a failed background regeneration keeps the stale entry. Each failure goes to
2045
- `onStoreError(error, &#123; op &#125;)`, which by default logs one line per operation
2069
+ `onStoreError(error, { op })`, which by default logs one line per operation
2046
2070
  per minute without the cache key. Set `storeTimeoutMs` for a network store, so a
2047
2071
  hung connection costs a miss rather than the request.
2048
2072
 
@@ -2135,7 +2159,7 @@ A purge is sent after the origin store is purged, coalesced for 250 ms, chunked
2135
2159
  provider's per-call limit, and retried on 429 or 5xx honoring `Retry-After`. The
2136
2160
  endpoint never reports a purge that did not happen: `202` while it is queued,
2137
2161
  `502` with `retryable` when the CDN refused it. After a mutation in app
2138
- code, `createInvalidator(&#123; store, cdn, origin &#125;).invalidate(&#123; tags &#125;)`
2162
+ code, `createInvalidator({ store, cdn, origin }).invalidate({ tags })`
2139
2163
  does the same. Staleness compounds: a page can be up to the CDN's
2140
2164
  `stale-while-revalidate` older than ISR's own window.
2141
2165
 
@@ -2318,7 +2342,7 @@ else document.addEventListener("nifra:hydrated", start, { once: true })
2318
2342
  > Add interactivity to a zero-runtime vanilla page with islands - imperative DOM enhancers, no framework runtime, no hydration. Explicit code an AI (or a human) gets right first try: mount, coordinate over a typed bus, always return cleanup.
2319
2343
 
2320
2344
  A `@nifrajs/web-vanilla` page ships zero framework runtime. When one corner needs
2321
- to be interactive, you don&apos;t turn on hydration - you mount an **island**: a
2345
+ to be interactive, you don't turn on hydration - you mount an **island**: a
2322
2346
  small, plain-DOM enhancer over a server-rendered element. Explicit imperative code with no
2323
2347
  hidden reactivity - the shape an AI agent (or a human) gets right on the first try.
2324
2348
 
@@ -2337,7 +2361,7 @@ islands for widgets on an otherwise-static page.
2337
2361
 
2338
2362
  Render a `<nifra-island>` marker in your page (props are inline JSON), then
2339
2363
  bundle one entry (in `frontend/`) that calls `mountIslands`. Load it
2340
- with the `islandScripts` export of the route&apos;s `.backend.ts` half.
2364
+ with the `islandScripts` export of the route's `.backend.ts` half.
2341
2365
 
2342
2366
  ```ts
2343
2367
  // doc-check: skip - server-rendered island marker (HTML, not a checkable module).
@@ -2375,7 +2399,7 @@ function runs on soft-nav teardown; forget it and every navigation leaks the lis
2375
2399
  ### Coordinate islands with a typed bus
2376
2400
 
2377
2401
  Islands are isolated by design - each enhances one element and shares no state. When two must
2378
- talk (an &ldquo;add to cart&rdquo; button and a cart badge), use a
2402
+ talk (an "add to cart" button and a cart badge), use a
2379
2403
  `createIslandBus`: one typed channel, created once and closed over by each
2380
2404
  enhancer. No implicit global, so concurrent renders and tests never cross-talk.
2381
2405
 
@@ -2425,7 +2449,7 @@ mountIslands({ addButton, badge })
2425
2449
 
2426
2450
  ### Pattern: filter drives results
2427
2451
 
2428
- The same shape scales to any &ldquo;one island changes, another reacts&rdquo; case. Each
2452
+ The same shape scales to any "one island changes, another reacts" case. Each
2429
2453
  island owns only its own DOM; they meet on the channel, never in a shared store.
2430
2454
 
2431
2455
  ```ts
@@ -2457,7 +2481,7 @@ mountIslands({ filter, results })
2457
2481
 
2458
2482
  ### Load strategies
2459
2483
 
2460
- A marker&apos;s `data-strategy` defers its enhancer: `load` (default),
2484
+ A marker's `data-strategy` defers its enhancer: `load` (default),
2461
2485
  `idle`, `visible` (mount when it scrolls into view), or a
2462
2486
  `media` query. An island with no matching enhancer, or an invalid strategy, stays
2463
2487
  inert server-rendered HTML - forward-compatible, never a runtime error.
@@ -2511,7 +2535,7 @@ The deps array is the whole contract, and its one failure mode is catchable: a
2511
2535
  `computed` whose body reads a signal the array omits will never recompute when that
2512
2536
  signal changes. `nifra check` flags exactly that as `NF-C023` - the
2513
2537
  check reads which signals the body calls `.get()` on and compares them to the
2514
- array. A framework&apos;s auto-tracked effect gives a tool nothing to compare, which is why
2538
+ array. A framework's auto-tracked effect gives a tool nothing to compare, which is why
2515
2539
  the equivalent lint elsewhere is a best-effort warning, not a gate.
2516
2540
 
2517
2541
  ### Bind a signal to the DOM
@@ -2536,8 +2560,8 @@ label.set("world") // the <h1> updates synchronously
2536
2560
 
2537
2561
  ### Keyed lists with bindList
2538
2562
 
2539
- `bindList` keeps a container&apos;s children in sync with an array by key - a keyed
2540
- reconcile like a framework&apos;s list diff, but you spell the key out. Add, remove, and
2563
+ `bindList` keeps a container's children in sync with an array by key - a keyed
2564
+ reconcile like a framework's list diff, but you spell the key out. Add, remove, and
2541
2565
  reorder reuse the matching node (preserving focus and scroll) instead of rebuilding the list.
2542
2566
  Key by a **stable id** on the item; keying by the array index reuses the wrong
2543
2567
  node on reorder, and `nifra check` flags it as `NF-C022`.
@@ -2563,8 +2587,8 @@ todos.set([...todos.get(), { id: crypto.randomUUID(), text: "buy milk", done: fa
2563
2587
 
2564
2588
  ### Async state with resource
2565
2589
 
2566
- `resource(fetcher, [deps])` is nano&apos;s answer to &ldquo;suspense&rdquo; - an
2567
- async cell whose value is an explicit `&#123; status, value, error &#125;` union.
2590
+ `resource(fetcher, [deps])` is nano's answer to "suspense" - an
2591
+ async cell whose value is an explicit `{ status, value, error }` union.
2568
2592
  It runs the fetcher immediately and again whenever a declared dep changes, and it handles the
2569
2593
  two things people get wrong by hand: the fetcher receives an `AbortSignal`, and a
2570
2594
  superseded request is aborted with its late result dropped, so the newest fetch always wins -
@@ -2593,7 +2617,7 @@ userId.set(2) // refetches; the deps array is what NF-C023 checks against the fe
2593
2617
  ```
2594
2618
 
2595
2619
  The deps array is checked exactly like `computed`: a `resource` whose
2596
- fetcher reads a signal the array omits won&apos;t refetch when it changes, and
2620
+ fetcher reads a signal the array omits won't refetch when it changes, and
2597
2621
  `nifra check` flags it as `NF-C023`. Bind it to the DOM with
2598
2622
  `bindResource`, which dispatches on `status` - one handler per state,
2599
2623
  `ready` required, so a still-loading value can never render as a stray
@@ -2624,7 +2648,7 @@ const off = bindResource(document.querySelector("[data-user]")!, user, {
2624
2648
  nano owns state and DOM edges; an [island](/docs/islands) owns mount and teardown.
2625
2649
  Put the signals in the enhancer, collect every disposer, and return one cleanup that calls
2626
2650
  them all. Scaffold this shape with
2627
- `nifra_scaffold &#123; path, variant: "stateful" &#125;` on a vanilla
2651
+ `nifra_scaffold { path, variant: "stateful" }` on a vanilla
2628
2652
  project - it emits the golden pattern below.
2629
2653
 
2630
2654
  ```ts
@@ -2662,9 +2686,9 @@ mountIslands({ todos })
2662
2686
 
2663
2687
  ### The three checks
2664
2688
 
2665
- nano&apos;s explicitness is the whole point: because each reactive edge is a visible call, its
2689
+ nano's explicitness is the whole point: because each reactive edge is a visible call, its
2666
2690
  three mistakes are static lints with a fix recipe - the same closed loop (`scaffold`
2667
- &rarr; `check` &rarr; `fix` &rarr; `verify`) that makes the
2691
+ -> `check` -> `fix` -> `verify`) that makes the
2668
2692
  backend AI-safe, now on the frontend.
2669
2693
 
2670
2694
  -
@@ -2741,7 +2765,7 @@ NDJSON stream settles the deferred values), and it's framework-agnostic - React
2741
2765
 
2742
2766
  For server push - live feeds, progress, notifications - `sse(c, run)` returns a
2743
2767
  `text/event-stream` response a handler returns directly. Push frames with
2744
- `stream.send(&#123;&#125;)`; the connection stays open until `run`
2768
+ `stream.send({})`; the connection stays open until `run`
2745
2769
  resolves, you call `stream.close()`, or the client disconnects (
2746
2770
  `stream.signal`). It's a Web `ReadableStream` too, so it runs on Bun,
2747
2771
  Node, Deno, and the edge - no `new Function`, no per-runtime API.
@@ -2785,9 +2809,9 @@ read, or pass `Infinity` to turn the limit off.
2785
2809
  `stream.send()` is type-checked and the typed client grows
2786
2810
  `.subscribe(onEvent)` with the same event type. A route whose schema declares a
2787
2811
  `body` is a POST stream: the body validates as on any POST, and
2788
- `.subscribe(onEvent, &#123; body &#125;)` sends it. A GET stream reconnects after a
2812
+ `.subscribe(onEvent, { body })` sends it. A GET stream reconnects after a
2789
2813
  drop and resumes with `Last-Event-ID`; a POST stream does not reconnect unless you
2790
- pass `reconnect: true`, since a reconnect sends the body again. The client&apos;s
2814
+ pass `reconnect: true`, since a reconnect sends the body again. The client's
2791
2815
  `onRequest` hook runs before each connect, so a refreshed token reaches the stream.
2792
2816
 
2793
2817
  ```ts
@@ -3035,8 +3059,8 @@ deferred boundary. Put critical page data in the route `loader`; use
3035
3059
 
3036
3060
  ### Markup outside the page
3037
3061
 
3038
- Svelte&apos;s `<svelte:head>` renders into the document&apos;s
3039
- `<head>`, after the tags from the route&apos;s `meta`. The document
3062
+ Svelte's `<svelte:head>` renders into the document's
3063
+ `<head>`, after the tags from the route's `meta`. The document
3040
3064
  always has a `<title>` of its own and a browser uses the first one, so set the
3041
3065
  title in `meta`.
3042
3066
 
@@ -3050,7 +3074,7 @@ the client, with a warning in development.
3050
3074
  ### Dev HMR support
3051
3075
 
3052
3076
  Dev HMR works for all five adapters through `createViteDevServer` and the
3053
- framework&apos;s Vite plugin. React, Preact, and Vue preserve edited component state. Solid
3077
+ framework's Vite plugin. React, Preact, and Vue preserve edited component state. Solid
3054
3078
  and Svelte update live without a full page reload, and the edited component may remount. Full
3055
3079
  matrix in [Dev & HMR](/docs/dev).
3056
3080
 
@@ -3092,9 +3116,9 @@ app
3092
3116
  app.use((a) => a.decorate("db", db).derive((c) => ({ now: Date.now() })))
3093
3117
  ```
3094
3118
 
3095
- ### What a parent&rsquo;s use() covers
3119
+ ### What a parent's use() covers
3096
3120
 
3097
- A `group()` scope inherits the parent&rsquo;s chain as it stands at the call. A
3121
+ A `group()` scope inherits the parent's chain as it stands at the call. A
3098
3122
  `merge()`d server was compiled on its own, so its routes keep _their_ chain. Only
3099
3123
  what the parent installed **before** the `group()` or `merge()` counts.
3100
3124
 
@@ -3130,14 +3154,14 @@ yes, when the route declares capabilities and has no ledger of its own
3130
3154
 
3131
3155
  yes
3132
3156
 
3133
- the merged server&rsquo;s own - a route declaring `idempotency` without one is
3157
+ the merged server's own - a route declaring `idempotency` without one is
3134
3158
  refused at registration
3135
3159
 
3136
3160
  Two checks catch the silent cases. In development and tests, `unusedScopedHooks`
3137
3161
  reports a hook followed only by `merge()` calls, and a `responseContract()`
3138
3162
  or `effectLedger()` installed after routes it would have covered.
3139
3163
  `nifra check` reports a `merge()` whose server authenticates none of its
3140
- routes while this server&rsquo;s `authenticate()` or auth plugin covers its own
3164
+ routes while this server's `authenticate()` or auth plugin covers its own
3141
3165
  (NF-C043); a module that is public on purpose takes
3142
3166
  `// nifra-expect NF-C043: <reason>` on the merge line.
3143
3167
 
@@ -3199,6 +3223,13 @@ normal response path, so the body is serialized with its content-type, and decla
3199
3223
  `responseHeaders` and every `onResponse` hook apply to it. A hand-built
3200
3224
  `Response` still works.
3201
3225
 
3226
+ An `onRequest` hook that throws or rejects (a rate-limit store that is down, say)
3227
+ fails the request the way a handler error does. Every `onError` the app
3228
+ registered sees it, in order, with a context that has no route params; the first answer is
3229
+ sent. When none answers, the error is logged and the client gets the default
3230
+ `500`. A thrown `Response` or `status()` value is sent as
3231
+ if returned.
3232
+
3202
3233
  #### Which hooks run where
3203
3234
 
3204
3235
  Where a hook is registered decides which requests it sees. `nifra routes --hooks`
@@ -3227,7 +3258,7 @@ A **WebSocket** route, listed as `WS /path`, runs the request hooks, then the
3227
3258
  authentication stages, `derive`s, `beforeHandle`s and
3228
3259
  `onError` declared before it. Its handshake runs no `around`,
3229
3260
  `afterHandle` or response hooks, but a refused handshake carries the
3230
- app&rsquo;s `responseHeaders()`.
3261
+ app's `responseHeaders()`.
3231
3262
 
3232
3263
  `nifra routes --hooks --json` writes the report; `--since <file>`
3233
3264
  prints what runs differently from a saved one. `nifra upgrade --write` saves the
@@ -3607,10 +3638,10 @@ Express, and Elysia, see [security posture, compared](/docs/security-comparison)
3607
3638
 
3608
3639
  ### Responses that cannot leak more than they declare
3609
3640
 
3610
- A `response` schema is a **lower** bound: it says &ldquo;at least these
3611
- fields&rdquo;, never &ldquo;only these&rdquo;. A handler returning a database row that satisfies
3612
- it also ships every other column, and nothing points at it - TypeScript&rsquo;s
3613
- excess-property check does not reach a handler&rsquo;s return position, and the client&rsquo;s
3641
+ A `response` schema is a **lower** bound: it says "at least these
3642
+ fields", never "only these". A handler returning a database row that satisfies
3643
+ it also ships every other column, and nothing points at it - TypeScript's
3644
+ excess-property check does not reach a handler's return position, and the client's
3614
3645
  type reports the contract rather than the bytes. So the leak is invisible from both ends, and it
3615
3646
  can appear with no code change at all: add a column, and the next deploy ships it to browsers.
3616
3647
 
@@ -3639,7 +3670,7 @@ export const app = server().use(responseContract("enforce", { extra: "strip" }))
3639
3670
  // enforce, { extra: "strip" } -> 200 {"id":"u1","name":"Ada"}
3640
3671
  ```
3641
3672
 
3642
- Not installing the plugin is &ldquo;off&rdquo;, which is exactly today&rsquo;s behaviour and
3673
+ Not installing the plugin is "off", which is exactly today's behaviour and
3643
3674
  keeps the lane out of your bundle rather than shipping a disabled branch to everyone.
3644
3675
  `"warn"` checks every response, logs the undeclared fields by name, and
3645
3676
  serves the payload **unchanged** - so turning it on in staging can never be the
@@ -3651,10 +3682,10 @@ returns it early, or `onError` answers with it; only a hand-built
3651
3682
  should cover: like
3652
3683
  `idempotency()`, the decision is made per route at registration.
3653
3684
 
3654
- By default, enforcement follows your schema&rsquo;s own semantics, because Standard Schema
3685
+ By default, enforcement follows your schema's own semantics, because Standard Schema
3655
3686
  exposes `validate` and no way to enumerate declared keys. A _stripping_ schema
3656
3687
  (Zod, Valibot) yields a cleaned value, so the extra fields are dropped. A _strict_ one
3657
- (`@nifrajs/schema`&rsquo;s `t.object`) reports them as issues, so the
3688
+ (`@nifrajs/schema`'s `t.object`) reports them as issues, so the
3658
3689
  response becomes a 500 and the detail goes to the logger, never to the caller.
3659
3690
  `{ extra: "strip" }` changes that for `t` schemas: they carry their
3660
3691
  JSON Schema, which does list the declared keys, so the payload is projected onto them - nested
@@ -3674,8 +3705,8 @@ For a metric or an alert, pass `onReport`. It receives every response the
3674
3705
  contract has something to say about: `violation` (enforce mode, a 500 went out
3675
3706
  instead), `warn` (warn mode, sent anyway, with the undeclared keys in
3676
3707
  `fields` when they are the reason) and `stripped` (enforce mode, sent
3677
- without `fields`). Each report carries the route&rsquo;s method and pattern and
3678
- the log line&rsquo;s message, never a value. A hook that throws or rejects is logged once and
3708
+ without `fields`). Each report carries the route's method and pattern and
3709
+ the log line's message, never a value. A hook that throws or rejects is logged once and
3679
3710
  changes no response.
3680
3711
 
3681
3712
  ```ts
@@ -3696,14 +3727,14 @@ export const app = server().use(
3696
3727
  )
3697
3728
  ```
3698
3729
 
3699
- A `merge()`d server&rsquo;s routes are covered by a contract the parent installed
3730
+ A `merge()`d server's routes are covered by a contract the parent installed
3700
3731
  before the merge, as long as the route declares a response and its own server installed none.
3701
- See [what a parent&rsquo;s use() covers](/docs/plugins#parent-use).
3732
+ See [what a parent's use() covers](/docs/plugins#parent-use).
3702
3733
 
3703
3734
  The check itself is essentially free: with a compiled validator it measures in the
3704
3735
  ~100ns-per-response range, and a realistic middleware-carrying route benchmarks within noise
3705
3736
  of the same route with no contract at all, on Bun and Node alike. What a contracted route
3706
- does give up is the bare-route fused lane - the check needs the handler&rsquo;s value before
3737
+ does give up is the bare-route fused lane - the check needs the handler's value before
3707
3738
  it becomes bytes - and a route with any middleware, derive, or lifecycle hook has already
3708
3739
  left that lane. If a route looks like production, the contract costs nothing: declare it.
3709
3740
 
@@ -3843,14 +3874,14 @@ app.post(
3843
3874
  ```
3844
3875
 
3845
3876
  `t.file` checks the size before it reads a byte, and `accept` is matched
3846
- against the file&rsquo;s **leading bytes**, never the type the client claimed: a script renamed
3877
+ against the file's **leading bytes**, never the type the client claimed: a script renamed
3847
3878
  `photo.png` fails validation. With `accept` set, the file the handler
3848
3879
  receives carries the detected type. A type that has no signature to check (`text/csv`,
3849
3880
  `image/svg+xml`) is refused when the schema is built, not silently let through. Text
3850
3881
  fields are coerced from their string form, a repeated field becomes a list, and a field the form
3851
3882
  does not declare fails validation unless `additionalProperties` is set.
3852
3883
 
3853
- The body is bounded before any of it is validated. The route&rsquo;s `bodyLimit` caps
3884
+ The body is bounded before any of it is validated. The route's `bodyLimit` caps
3854
3885
  the whole request; `maxFields` (100), `maxFiles` (10),
3855
3886
  `maxFieldBytes` (64 KiB) and `maxFileBytes` cap what it may carry. A request
3856
3887
  over one is answered `413` with the limit it crossed (`payload_too_large`,
@@ -3903,14 +3934,14 @@ format behind it, and `application/zip` is also what a `.docx` or
3903
3934
 
3904
3935
  -
3905
3936
  **
3906
- `file.name` is the client&rsquo;s.
3937
+ `file.name` is the client's.
3907
3938
  **
3908
3939
  Path separators and control characters are removed, and that is all. Generate the storage key;
3909
3940
  never build a path from the name.
3910
3941
 
3911
3942
  -
3912
3943
  **
3913
- Without `accept`, `file.type` is the client&rsquo;s too.
3944
+ Without `accept`, `file.type` is the client's too.
3914
3945
  **
3915
3946
  Some runtimes derive it from the file extension. Only a type that `accept` matched is
3916
3947
  one the bytes proved.
@@ -3922,9 +3953,9 @@ one the bytes proved.
3922
3953
  -
3923
3954
  **A form post is a simple cross-origin request.** A browser sends
3924
3955
  `multipart/form-data`, urlencoded and `text/plain` with cookies and no
3925
- preflight. A body-schema route refuses one whose `Origin` is another site&rsquo;s
3956
+ preflight. A body-schema route refuses one whose `Origin` is another site's
3926
3957
  with `403` before reading it; list a site that must post forms to the app in the
3927
- server&rsquo;s `formOrigins`. A request without an `Origin` passes, so
3958
+ server's `formOrigins`. A request without an `Origin` passes, so
3928
3959
  a cookie-authenticated upload route still needs `csrf()` like any other state
3929
3960
  change.
3930
3961
 
@@ -3975,14 +4006,14 @@ app.post(
3975
4006
  ```
3976
4007
 
3977
4008
  The route opts in, not the app: a parser registered once for every route would widen what each
3978
- of them accepts. Before `parse` runs, the request&rsquo;s media type has matched one
4009
+ of them accepts. Before `parse` runs, the request's media type has matched one
3979
4010
  of `types` in full (case folded, parameters set aside) and the body has been read
3980
- under the route&rsquo;s `bodyLimit`, counted on the bytes delivered. After it, and
4011
+ under the route's `bodyLimit`, counted on the bytes delivered. After it, and
3981
4012
  before the schema:
3982
4013
 
3983
4014
  -
3984
4015
  **A parser that throws is a `400`.** The answer is `invalid_body`; the
3985
- parser&rsquo;s own message is not sent.
4016
+ parser's own message is not sent.
3986
4017
 
3987
4018
  -
3988
4019
  **The value must be a tree.** An object or array reached twice is what an alias or a cycle
@@ -3998,15 +4029,15 @@ and an object whose prototype the decoder replaced with data are rejected or str
3998
4029
  JSON. An instance of a class, such as a `Date` or a `Uint8Array`, is
3999
4030
  passed through without being looked into.
4000
4031
 
4001
- What stays yours is the decoder&rsquo;s own limits: nesting depth, alias expansion, and the size
4032
+ What stays yours is the decoder's own limits: nesting depth, alias expansion, and the size
4002
4033
  of a number or a string are spent inside `parse`, before anything above can look.
4003
4034
  Configure it for untrusted input.
4004
4035
 
4005
4036
  `types` takes full media types only, and refuses four: JSON, urlencoded and multipart
4006
4037
  already have readers, and `text/plain` is a body a browser sends from any site with
4007
- the user&rsquo;s cookies and no preflight. Every type it does accept is one a browser must
4038
+ the user's cookies and no preflight. Every type it does accept is one a browser must
4008
4039
  preflight, so your CORS policy sees the request first. The generated OpenAPI document lists
4009
- each type under the operation&rsquo;s request body. The typed client keeps sending JSON, which
4040
+ each type under the operation's request body. The typed client keeps sending JSON, which
4010
4041
  the route still reads; send another format with `fetch`.
4011
4042
 
4012
4043
  ### File uploads - `@nifrajs/uploads`
@@ -4233,20 +4264,20 @@ const app = server().use(securityHeaders({
4233
4264
  Every value is fixed at construction, so the headers are declared statically rather than
4234
4265
  written by a response hook - an app whose response middleware is only this keeps the fused
4235
4266
  native response lanes. A route that sets one of these names itself keeps its own value. A
4236
- group can apply its own configuration over the app&apos;s - `admin.use(securityHeaders({ contentSecurityPolicy: "default-src 'none'" }))`
4237
- inside `app.group("/admin", ...)` - and each header it sets replaces the app&apos;s
4238
- value on the group&apos;s routes only.
4267
+ group can apply its own configuration over the app's - `admin.use(securityHeaders({ contentSecurityPolicy: "default-src 'none'" }))`
4268
+ inside `app.group("/admin", ...)` - and each header it sets replaces the app's
4269
+ value on the group's routes only.
4239
4270
 
4240
- A fixed `Content-Security-Policy` here cannot allow nifra&apos;s inline scripts by
4271
+ A fixed `Content-Security-Policy` here cannot allow nifra's inline scripts by
4241
4272
  nonce. For a strict `script-src` on web pages, give `createWebApp` a
4242
- `csp` from `createCspPolicy`: it allows the framework&apos;s constant
4273
+ `csp` from `createCspPolicy`: it allows the framework's constant
4243
4274
  scripts by hash and adds a nonce only to a page that needs one, so every other page sends the
4244
4275
  same header and stays cacheable under `withISR` or a CDN. See
4245
4276
  [A strict CSP that still caches](/docs/contract#strict-csp).
4246
4277
 
4247
4278
  ### Route assurance - prove every route is guarded
4248
4279
 
4249
- Installing security middleware is not the same as proving it covers every route. Nifra&apos;s
4280
+ Installing security middleware is not the same as proving it covers every route. Nifra's
4250
4281
  official auth, CSRF, body-limit, rate-limit, idempotency, IP-restriction, and security-header
4251
4282
  modules publish reflection-safe evidence at the hook where they enforce it. A policy then
4252
4283
  classifies every route and fails closed when evidence is missing or forbidden.
@@ -4288,7 +4319,7 @@ runs only through reflection or `nifra assure`, so requests pay no assurance cos
4288
4319
 
4289
4320
  WebSocket routes are reflected under the pseudo-method `"WS"`, so a policy classifies
4290
4321
  every socket too. A handshake runs the auth guards registered before the socket and the
4291
- app&apos;s request hooks, so a socket carries authentication and rate-limit evidence from them.
4322
+ app's request hooks, so a socket carries authentication and rate-limit evidence from them.
4292
4323
  It never claims evidence whose enforcement its message handlers bypass, such as a durable
4293
4324
  command journal. A socket declares its effects with
4294
4325
  `app.ws(path, { capabilities })`, and capability assurance checks them against
@@ -4297,7 +4328,7 @@ the module that registers it.
4297
4328
  ### Effect assurance - declared capability versus provenance
4298
4329
 
4299
4330
  Authentication does not reveal what a route can do. Capability assurance compares an exact
4300
- route declaration against every approved effect import reachable through that route&apos;s local
4331
+ route declaration against every approved effect import reachable through that route's local
4301
4332
  module graph. Static, dynamic, `require`, and re-export edges are scanned; raw provider
4302
4333
  imports fail `nifra check`. Runtime beacons add denial at owned adapters, but are never
4303
4334
  treated as a substitute for static provenance.
@@ -4596,8 +4627,8 @@ this way. So when `nifra.assurance.ts` loads the app, Nifra also records, in
4596
4627
  development, the module whose call registered each route, and the walk starts there too: a
4597
4628
  computed path, or a route on a server a helper builds, is still covered.
4598
4629
  `nifra check` still names such an expression in an NF-C036 finding, since the
4599
- route lints read the source alone. When the registering module is not where the route&apos;s
4600
- code lives, such as a shared helper that registers other modules&apos; handlers, list the
4630
+ route lints read the source alone. When the registering module is not where the route's
4631
+ code lives, such as a shared helper that registers other modules' handlers, list the
4601
4632
  right module in `provenance.routeModules`.
4602
4633
 
4603
4634
  ### Runtime beacons
@@ -4867,8 +4898,16 @@ rewritten onto, or set `trustHost` when a proxy you control fixes the host. Give
4867
4898
  `createSessions` signs the cookie (HMAC, verified constant-time) and always marks it
4868
4899
  `HttpOnly`. In **store mode** the cookie is just an opaque id and the data lives in
4869
4900
  a `SessionStore`; in **cookie mode** (no store) the data is signed into the cookie.
4870
- Stores mirror the ISR discipline: `MemorySessionStore` is prod-guarded;
4871
- `KVSessionStore` is the durable, shared production store.
4901
+ `MemorySessionStore` is prod-guarded. Production store mode needs a strongly
4902
+ consistent shared `SessionStore`, such as a transactional adapter or Durable Object.
4903
+ Every instance must observe completed writes and deletes, including revocation markers.
4904
+
4905
+ `createSessions` refuses `KVSessionStore` and any adapter declaring
4906
+ `consistency: "eventual"`. Workers KV can serve stale sessions and missing logout
4907
+ markers, allowing a revoked session to be restored. Migrate existing KV-backed sessions to a
4908
+ strongly consistent store; the KV adapter remains exported for reading legacy records.
4909
+ Custom adapters may declare `consistency: "strong"`; omitting it asserts the same
4910
+ contract. Disabling rolling renewal does not make eventually consistent logout safe.
4872
4911
 
4873
4912
  The signature covers the cookie name, so two managers that share a secret never read each
4874
4913
  other's cookies; still, give sessions a secret no other signed value uses. A cookie-mode
@@ -4886,8 +4925,8 @@ import { createSessions, MemorySessionStore } from "@nifrajs/auth"
4886
4925
 
4887
4926
  let manager: ReturnType<typeof createSessions> | undefined
4888
4927
  export const getSessions = () => (manager ??= createSessions({
4889
- secret: process.env.SESSION_SECRET!, // ≥ 16 chars; rotating it invalidates all sessions
4890
- store: new MemorySessionStore(), // prod: new KVSessionStore(env.SESSIONS)
4928
+ secret: process.env.SESSION_SECRET!, // at least 32 bytes; never reuse another signing secret
4929
+ store: new MemorySessionStore(), // production: a strongly consistent shared SessionStore
4891
4930
  // cookie: { secure: false }, // local http dev only
4892
4931
  }))
4893
4932
  ```
@@ -6085,14 +6124,16 @@ Inbound frames arrive raw (`string | Uint8Array`) by default. Add a
6085
6124
  [Standard Schema](https://standardschema.dev) (`t`, zod, valibot) - and
6086
6125
  Nifra parses each frame as JSON, validates it, and hands `message` the typed
6087
6126
  value; anything that fails goes to `onInvalidMessage` instead (so a malformed
6088
- frame can never reach your handler).
6127
+ frame can never reach your handler). `nifra check` reports
6128
+ `NF-S009` (info) for a route whose `message` calls
6129
+ `JSON.parse` itself with no `messageSchema`.
6089
6130
 
6090
6131
  ```ts
6091
6132
  // doc-check: skip - illustrative: validated inbound frames on an existing app.
6092
6133
  import { t } from "@nifrajs/schema"
6093
6134
 
6094
6135
  app.ws("/chat", {
6095
- messageSchema: t.Object({ kind: t.Literal("say"), text: t.String({ maxLength: 500 }) }),
6136
+ messageSchema: t.object({ kind: t.literal("say"), text: t.string({ maxLength: 500 }) }),
6096
6137
  message(ws, msg) {
6097
6138
  // msg is typed { kind: "say"; text: string } - already parsed + validated.
6098
6139
  app.publish("room", msg.text)
@@ -6117,7 +6158,7 @@ contract check for your own output, not an inbound security boundary; the flag r
6117
6158
  import { t } from "@nifrajs/schema"
6118
6159
 
6119
6160
  app.ws("/events", {
6120
- sendSchema: t.Object({ kind: t.Literal("ready"), id: t.String() }),
6161
+ sendSchema: t.object({ kind: t.literal("ready"), id: t.string() }),
6121
6162
  validateSend: true, // opt in; default remains type-level only
6122
6163
  open(ws) {
6123
6164
  ws.send(JSON.stringify({ kind: "ready", id: "evt-1" }))
@@ -6125,6 +6166,114 @@ app.ws("/events", {
6125
6166
  })
6126
6167
  ```
6127
6168
 
6169
+ ### Typed messages, end to end
6170
+
6171
+ Put both schemas in a module the server and the client import, each a
6172
+ `t.union` discriminated on a literal `type`. The server's
6173
+ `message` then switches over what the client sent, and the typed client's
6174
+ `.ws()` handle types `send` from `messageSchema` and every
6175
+ received frame from `sendSchema`. A `default` branch that assigns the
6176
+ frame to `never` turns a new server frame into a compile error on the client
6177
+ instead of a silently ignored message.
6178
+
6179
+ The client types received frames but does not check them unless asked: pass the
6180
+ route's `sendSchema` as `validateReceive` (the typed client
6181
+ carries the contract's types, not its schemas, so the schema is the import). A frame
6182
+ that fails is not delivered; `onError` gets a `TypeError` naming the
6183
+ issues, with the frame as its `cause`. Frames keep their arrival order, an async
6184
+ schema included.
6185
+
6186
+ ```ts
6187
+ import { client } from "@nifrajs/client"
6188
+ import { type InferOutput, server } from "@nifrajs/core/server"
6189
+ import { websocket } from "@nifrajs/core/ws"
6190
+ import { t } from "@nifrajs/schema"
6191
+
6192
+ // The contract, in a module both sides import: one discriminated union per direction.
6193
+ export const ChatIn = t.union([
6194
+ t.object({ type: t.literal("say"), text: t.string({ maxLength: 500 }) }),
6195
+ t.object({ type: t.literal("pong"), id: t.integer() }),
6196
+ ])
6197
+ export const ChatOut = t.union([
6198
+ t.object({ type: t.literal("said"), from: t.string(), text: t.string() }),
6199
+ t.object({ type: t.literal("ping"), id: t.integer() }),
6200
+ ])
6201
+ type ChatFrame = InferOutput<typeof ChatOut>
6202
+
6203
+ const frame = (value: ChatFrame): string => JSON.stringify(value)
6204
+
6205
+ // Server: a ping every 30 s; a connection that leaves two unanswered is closed.
6206
+ const app = server()
6207
+ .use(websocket())
6208
+ .ws("/chat", {
6209
+ messageSchema: ChatIn,
6210
+ sendSchema: ChatOut,
6211
+ upgrade: (c) => ({
6212
+ user: c.cookies.user ?? "guest",
6213
+ sent: 0,
6214
+ unanswered: 0,
6215
+ timer: undefined as ReturnType<typeof setInterval> | undefined,
6216
+ }),
6217
+ open(ws) {
6218
+ ws.subscribe("room")
6219
+ ws.data.timer = setInterval(() => {
6220
+ if (ws.data.unanswered >= 2) return ws.close(4000, "heartbeat timeout")
6221
+ ws.data.unanswered += 1
6222
+ ws.data.sent += 1
6223
+ ws.send(frame({ type: "ping", id: ws.data.sent }))
6224
+ }, 30_000)
6225
+ },
6226
+ message(ws, msg) {
6227
+ switch (msg.type) {
6228
+ case "say":
6229
+ app.publish("room", frame({ type: "said", from: ws.data.user, text: msg.text }))
6230
+ break
6231
+ case "pong":
6232
+ // Only an answer to a ping still outstanding counts, not any id the client makes up.
6233
+ if (msg.id > ws.data.sent - ws.data.unanswered && msg.id <= ws.data.sent) {
6234
+ ws.data.unanswered = 0
6235
+ }
6236
+ break
6237
+ }
6238
+ },
6239
+ close: (ws) => clearInterval(ws.data.timer),
6240
+ })
6241
+
6242
+ // Client: frames are typed from sendSchema, and checked against it with validateReceive.
6243
+ export async function joinChat(baseUrl: string): Promise<void> {
6244
+ const chat = client<typeof app>(baseUrl).chat.ws({
6245
+ validateReceive: ChatOut,
6246
+ onError: (error) => console.warn(error),
6247
+ })
6248
+ for await (const msg of chat.messages()) {
6249
+ switch (msg.type) {
6250
+ case "said":
6251
+ console.log(`${msg.from}: ${msg.text}`)
6252
+ break
6253
+ case "ping":
6254
+ chat.send({ type: "pong", id: msg.id }) // a frame the client must answer
6255
+ break
6256
+ default: {
6257
+ const unhandled: never = msg // a new ChatOut variant fails to compile here
6258
+ throw new Error(`unhandled frame ${JSON.stringify(unhandled)}`)
6259
+ }
6260
+ }
6261
+ }
6262
+ }
6263
+ ```
6264
+
6265
+ ### Frames the client must answer (heartbeats)
6266
+
6267
+ A server heartbeat that the application can see is an ordinary frame in the contract: a
6268
+ `ping` variant in `sendSchema` and a `pong` variant in
6269
+ `messageSchema`. The client answers it from the same switch that handles every
6270
+ other frame, so the answer is typed and the exhaustiveness check covers it; the server
6271
+ counts unanswered pings in `ws.data`, takes a `pong` only for a ping
6272
+ still outstanding, and closes a connection that stops answering, as above. Clear the timer in `close`. WebSocket protocol pings (the
6273
+ runtime's own keep-alive) are answered by the socket itself and never reach
6274
+ `messages()`; use them to keep a connection open through proxies, and a frame
6275
+ in the contract when the server needs to know the client is still running.
6276
+
6128
6277
  ### Pub/sub - app.publish
6129
6278
 
6130
6279
  `ws.subscribe(topic)` joins a topic; `app.publish(topic, data)`
@@ -6150,7 +6299,8 @@ every other runtime.
6150
6299
 
6151
6300
  ```ts
6152
6301
  // doc-check: skip - Workers entry: a Durable Object hub holds the connections.
6153
- import { createWebSocketHub, toFetchHandler } from "@nifrajs/workers"
6302
+ import { toFetchHandler } from "@nifrajs/core/server"
6303
+ import { createWebSocketHub } from "@nifrajs/workers"
6154
6304
 
6155
6305
  export const NifraWebSocketHub = createWebSocketHub(app) // bind as NIFRA_WS_HUB in wrangler.toml
6156
6306
  export default toFetchHandler(app, { webSocketHub: (env) => env.NIFRA_WS_HUB })
@@ -6419,8 +6569,8 @@ host-specific deploy step for you to fill in (Fly, a registry push, SSH, …).
6419
6569
 
6420
6570
  ### Bun (its home)
6421
6571
 
6422
- `app.listen(3000)` - the native Bun server. Sits at the raw `Bun.serve`
6423
- ceiling (see [benchmarks](/benchmarks)).
6572
+ `app.listen(3000)` - the native Bun server. Bun is the runtime where Nifra measures
6573
+ fastest (see [benchmarks](/benchmarks)).
6424
6574
 
6425
6575
  **Every core:** Bun is single-threaded per process - for multi-core boxes,
6426
6576
  spawn one process per core, each binding the same port with
@@ -6446,10 +6596,23 @@ On Cloudflare/Vercel the platform serves assets, so you don't need it there.
6446
6596
  Every file under the mount is cached as immutable by default. If the directory also holds
6447
6597
  files that keep their name across deploys, pass the build manifest's `assets` as
6448
6598
  `hashedFiles`: only those URL paths stay immutable, and every other file is sent
6449
- with its validators so the browser revalidates it. The server that
6450
- `nifra build --target bun` or `node` generates does this already. It
6451
- caches only the client build's own content-hashed outputs as immutable. A file copied from
6452
- `public/`, even under `public/assets/`, gets a one-day policy.
6599
+ with `cacheControl` when you set one. Files up to 256 KiB carry an `ETag`
6600
+ from the exact snapshot served, so a deploy that keeps timestamps still revalidates changed
6601
+ bytes. Larger files stream without an `ETag` and revalidate by
6602
+ `Last-Modified` once their last change has settled; ordinary ranges work, while
6603
+ an `If-Range` request gets the whole file. The server that
6604
+ `nifra build --target bun` or `node`
6605
+ generates does this already. It caches only the client build's own content-hashed outputs as
6606
+ immutable. A file copied from `public/`, even under `public/assets/`,
6607
+ gets a one-day policy.
6608
+
6609
+ `static` also takes an array of mounts; a path goes to the first mount that
6610
+ takes it, by its prefix and, when set, its `files`. Give a mount
6611
+ `files` to serve only those URL paths from a directory that holds other things
6612
+ too; any other path passes to the next mount, so a later mount over the same paths can still
6613
+ serve it. The generated Node server mounts `/assets` and, at
6614
+ the root, only the `public/` files the build copied, so `server.js`
6615
+ beside them is never served. Dotfiles are refused, except `/.well-known`.
6453
6616
 
6454
6617
  ### HTTPS without a proxy
6455
6618
 
@@ -6522,12 +6685,13 @@ function under `.vercel/output`.
6522
6685
 
6523
6686
  ## Nifra - CLI
6524
6687
 
6525
- > The zero-config Nifra CLI (`nifra dev`, `nifra build`, `nifra start`): true HMR and complete target-specific deploy builds.
6688
+ > Every Nifra CLI command: dev, build and start, the check and contract gates, code generation, the agent and dev-server tools, and upgrades.
6526
6689
 
6527
- `Nifra` is zero-config: it reads `routes/`, `framework.ts`, and
6528
- (optionally) `backend.ts` from your project and wires the right
6529
- `@nifrajs/web` entrypoint - no `dev.ts`/`build.ts`/
6530
- `server.ts` to hand-write. (`create-nifra` scaffolds the conventions.)
6690
+ `nifra` runs, builds, checks and upgrades an app from its project root. It reads
6691
+ `routes/`, `backend/framework.ts`, `backend/app.ts` and
6692
+ `nifra.config.ts` and wires the right `@nifrajs/web` entrypoint, so there
6693
+ is no `dev.ts`, `build.ts` or `server.ts` to write.
6694
+ `create-nifra` scaffolds the layout.
6531
6695
 
6532
6696
  ```ts
6533
6697
  nifra dev # true-HMR dev server (Bun native HMR + Nifra SSR) - http://localhost:4321
@@ -6541,13 +6705,13 @@ nifra build --target cloudflare # also: node | deno | vercel | static; add --re
6541
6705
  # --vite | --bun (dev/build) force the pipeline
6542
6706
  ```
6543
6707
 
6544
- ### The conventions
6708
+ ### The layout the CLI reads
6545
6709
 
6546
- Four conventions at the project root. `nifra dev` runs the Bun-native
6547
- [HMR dev server](/docs/dev); `nifra build` runs the Bun-native production
6548
- build (content-hashed client assets plus a target-specific server); `nifra start`
6549
- runs the default Bun output. The generated server serves assets and SSR with matched-route
6550
- chunks preloaded and route CSS linked in each `<head>`.
6710
+ `nifra dev` runs the Bun-native [HMR dev server](/docs/dev);
6711
+ `nifra build` runs the production build (content-hashed client assets plus a
6712
+ target-specific server); `nifra start` runs the default Bun output. The generated
6713
+ server serves assets and SSR with matched-route chunks preloaded and route CSS linked in each
6714
+ `<head>`.
6551
6715
 
6552
6716
  **One rule picks the bundler, and it is the same rule in both phases** - so a
6553
6717
  project can never be bundled by one toolchain in dev and the other in production. Bun runs
@@ -6561,41 +6725,50 @@ answers the same question without starting a server - see
6561
6725
 
6562
6726
  ```ts
6563
6727
  my-app/
6564
- routes/ # file-based routes (index.tsx, _layout.tsx, [id].tsx, …)
6565
- framework.ts # deploy-safe render adapter
6566
- nifra.config.ts # CLI-only client module + dev/build plugins
6567
- backend.ts # export const backend = server()... (optional - the typed contract)
6568
- ```
6569
-
6570
- These paths are **fixed**, not configurable: the CLI resolves all four from the
6571
- project root, so `backend.ts` cannot move into `src/` or be renamed -
6572
- if the file is not at the root, `nifra dev|build` simply run without a backend
6573
- (it is optional, so nothing errors). Only the entry file is pinned; the feature modules it
6574
- `.merge()`s can live in any directory. Keep `backend.ts` a pure
6575
- composition root - merging modules, registering no routes of its own - so each route's
6576
- capability reach stays its own module's (see
6577
- [Backends & API](/docs/backends) and
6578
- [Verification](/docs/verification)).
6728
+ routes/ # the URL tree: index.tsx, _layout.tsx, [id].tsx, each with an optional x.backend.ts half
6729
+ backend/
6730
+ framework.ts # the render adapter and server options - deploy-safe
6731
+ app.ts # export const backend = server()... (optional - the typed API)
6732
+ frontend/ # components and browser code
6733
+ shared/ # schemas, types and helpers both sides import
6734
+ nifra.config.ts # CLI-only: client module, deploy target, dev/build plugins
6735
+ ```
6736
+
6737
+ These paths are **fixed**: the CLI resolves them from the project root.
6738
+ `backend/app.ts` is optional; without it `nifra dev` and
6739
+ `nifra build` run the pages alone. A root `backend.ts` or
6740
+ `framework.ts`, the layout before 4.0, is refused with the command that moves it,
6741
+ and `nifra check` reports it as NF-C038: run
6742
+ `nifra migrate layout`. Only the entry file is pinned; the feature modules it
6743
+ `.merge()`s can live anywhere under `backend/`. Keep
6744
+ `backend/app.ts` a composition root - merging modules, registering no routes of
6745
+ its own - so each route's capability reach stays its own module's. What goes in each
6746
+ zone, and what the builds refuse to cross, is on
6747
+ [Project structure](/docs/structure).
6579
6748
 
6580
- ### framework.ts - naming the framework once
6749
+ ### backend/framework.ts and nifra.config.ts
6581
6750
 
6582
- Keep the render `adapter` in deploy-safe `framework.ts`. Put
6583
- `clientModule`, Vite plugins, compiler plugins, conditions, and defines in CLI-only
6584
- `nifra.config.ts`. This prevents build tooling and native dependencies from entering
6585
- generated server bundles.
6751
+ Keep the render `adapter` and the server options (`apiPrefix`,
6752
+ `mounts`, `csp`, `i18n`) in deploy-safe
6753
+ `backend/framework.ts`: the generated server entry imports it. Put
6754
+ `clientModule`, the deploy `target`, Vite plugins, compiler plugins,
6755
+ conditions, and defines in CLI-only `nifra.config.ts`, which re-exports the
6756
+ adapter. This keeps build tooling and native dependencies out of generated server bundles.
6586
6757
 
6587
6758
  ```ts
6588
- // framework.ts - deploy-safe; generated server entries import this file.
6759
+ // backend/framework.ts - deploy-safe; the generated server entry imports this file.
6589
6760
  import { reactAdapter } from "@nifrajs/web-react"
6590
6761
 
6591
6762
  export const adapter = reactAdapter
6763
+ export const apiPrefix = "" // "" keeps backend/app.ts loader-only; "/api" also serves it over HTTP
6592
6764
 
6593
6765
  // nifra.config.ts - CLI-only build/dev tooling; never imported by a deployed server.
6594
6766
  // doc-check: skip - needs the third-party @vitejs/plugin-react; install it to run this.
6595
6767
  import react from "@vitejs/plugin-react"
6596
- export { adapter } from "./framework"
6768
+ export { adapter } from "./backend/framework"
6597
6769
  export const clientModule = "@nifrajs/web-react/client"
6598
- export const vitePlugins = [react()] // dev HMR (Fast Refresh)
6770
+ export const target = "bun" // what nifra build emits; nifra target <t> switches it
6771
+ export const vitePlugins = [react()] // only if you want Vite's dev pipeline
6599
6772
  // Vue/Svelte/Solid also export:
6600
6773
  // clientPlugins = [vueBunPlugin("dom")] // compile routes for the client build
6601
6774
  // serverPlugins = [vueBunPlugin("ssr")] // compile routes into the target's server bundle
@@ -6603,6 +6776,224 @@ export const vitePlugins = [react()] // dev HMR (Fast Refresh)
6603
6776
  // define = { __VUE_OPTIONS_API__: "true", ... } // Vue feature flags
6604
6777
  ```
6605
6778
 
6779
+ ### Command reference
6780
+
6781
+ Every command `nifra --help` lists, by what it is for. Most take
6782
+ `--json` for agents and CI. `--env-file <path>` works on every
6783
+ command and may repeat (a later file wins; a variable already set in the environment is never
6784
+ overwritten), which matters because commands that reflect your app import it. A dry run is
6785
+ the default wherever a command edits files.
6786
+
6787
+ #### Run and build
6788
+
6789
+ Develop, build a deploy directory, and run it.
6790
+
6791
+ Command
6792
+ What it does
6793
+
6794
+ `nifra dev [--port <n>] [--vite | --bun] [--poll]`
6795
+
6796
+ The dev server with true HMR, on port 4321. Bun runs it unless `vitePlugins` are the app's only transforms. `--no-indicator` hides the in-page issues badge.
6797
+
6798
+ `nifra build [--target <t>] [--out <dir>] [--report]`
6799
+
6800
+ A complete deploy directory for `bun`, `node`, `deno`, `cloudflare`, `vercel` or `static`. The server entry is generated from `backend/framework.ts`, `backend/app.ts` and `routes/`. `--report` prints each chunk's size.
6801
+
6802
+ `nifra start [--port <n>] [--out <dir>]`
6803
+
6804
+ Run the Bun build at `<out>/server.js`.
6805
+
6806
+ `nifra target [<target>]`
6807
+
6808
+ Show the deploy target kept in `nifra.config.ts`, or switch it. `nifra build` emits that target when no `--target` is given.
6809
+
6810
+ #### Check and gate
6811
+
6812
+ The gates to run before calling a change done, locally and in CI.
6813
+
6814
+ Command
6815
+ What it does
6816
+
6817
+ `nifra check [--lints-only] [--json] [--sarif]`
6818
+
6819
+ Typecheck plus contract lints: a hand-rolled `fetch()` to your own API, an untyped client, backend code reached from browser code. `--lints-only` skips tsc; `--sarif` emits SARIF 2.1.0.
6820
+
6821
+ `nifra review [--diff <ref>] [--strict] [--fix] [--write]`
6822
+
6823
+ A deterministic, evidence-backed review of the project or a diff. `--fix` plans the recipes it can apply; `--fix --write` applies them.
6824
+
6825
+ `nifra fix [--code <NF-code>]`
6826
+
6827
+ Apply the registered recipe for a diagnostic, then print the diagnostics that remain.
6828
+
6829
+ `nifra doctor [--strict] [--auto-fix] [--target <t>]`
6830
+
6831
+ Find undeclared imports and duplicate copies of `@nifrajs/core`, React and other identity-sensitive packages, and print production readiness. `--auto-fix` writes the safe dependency fixes.
6832
+
6833
+ `nifra port [--target <t>] [--ci] [--strict]`
6834
+
6835
+ A feature-by-deploy-target matrix (in-memory stores, in-process cron and WebSockets, runtime globals, `node:` built-ins) with file:line evidence. `--ci` fails on a feature the target lacks.
6836
+
6837
+ `nifra routes [--json] [--modes] [--hooks] [--graph]`
6838
+
6839
+ Every page and API route with its methods. `--modes` shows each page's render mode and fails against `--target`; `--hooks` lists the hooks each route runs; `--graph` draws the routes as Mermaid.
6840
+
6841
+ `nifra smoke [--fixture <file>] [--in-process]`
6842
+
6843
+ The declared production smoke checks: SSR, the mounted API, 404s, headers, auth, contracts and hydration.
6844
+
6845
+ `nifra cdn-check <url>`
6846
+
6847
+ Check a deployed page behind a CDN: served from cache, no internal headers reaching visitors, and soft navigations getting page data rather than the cached document.
6848
+
6849
+ `nifra i18n check [entry] [--strict]`
6850
+
6851
+ Check i18n catalogs: coverage, missing and unused keys, ICU syntax, placeholder parity and plural cases. It imports the entry module.
6852
+
6853
+ `nifra verify [--release]`
6854
+
6855
+ Run the verification gate plan against the project's `package.json` scripts; a gate with no script is reported, not run. `--release` adds the build, test, coverage and cross-runtime gates.
6856
+
6857
+ #### Contracts and assurance
6858
+
6859
+ Lock the API contract, prove the security posture, and fail CI when either regresses. See Verification for the ladder these build.
6860
+
6861
+ Command
6862
+ What it does
6863
+
6864
+ `nifra snapshot [--out <file>]`
6865
+
6866
+ Write the backend's API contract (routes and schemas) as JSON, `api-snapshot.json` by default: the baseline for `nifra diff`.
6867
+
6868
+ `nifra diff [<baseline>]`
6869
+
6870
+ The breaking-change gate. A new required request field or a removed response field breaks; a new response field does not. Exits non-zero on a break.
6871
+
6872
+ `nifra contracts snapshot | check`
6873
+
6874
+ Write the deterministic route contract lock, `contracts.lock.json`, or check the current routes against it.
6875
+
6876
+ `nifra assure [--config <file>]`
6877
+
6878
+ Classify every route against `nifra.assurance.ts` and list the evidence each one is missing.
6879
+
6880
+ `nifra assure --bundle [--strict] [--hydration] [--interact]`
6881
+
6882
+ One JSON verdict over every applicable gate, each recorded as pass, fail or skip. Exits non-zero unless the verdict is green.
6883
+
6884
+ `nifra levels [--min <n>]`
6885
+
6886
+ The verification ladder: L0 typed contract, L1 route assurance, L2 capability lockfile, L3 route manifest, L4 invariant-tested. `--min` fails below a level.
6887
+
6888
+ `nifra prove [--file <path>] [--min <n>]`
6889
+
6890
+ Plan the cheapest proofs for the changed files and report a machine-checkable stop condition. Needs a fresh build.
6891
+
6892
+ `nifra capabilities snapshot | check | explain`
6893
+
6894
+ Write the capability lockfile once provenance and idempotency assurance pass; fail CI on an effect import that bypasses it, drift, a GET that writes, or an idempotency gap; explain one route's tokens with `explain <METHOD> <path>`.
6895
+
6896
+ `nifra manifest emit | diff`
6897
+
6898
+ Emit the hash-verified route trust manifest, signed with `--sign <key-ref>` through the configured KMS signer, or compare two manifests and fail on a regression.
6899
+
6900
+ `nifra replay <file>`
6901
+
6902
+ Validate a token-only verification metadata file and run it against its gate.
6903
+
6904
+ #### Generate
6905
+
6906
+ Write the files the types and clients come from.
6907
+
6908
+ Command
6909
+ What it does
6910
+
6911
+ `nifra types [--check]`
6912
+
6913
+ Each route's `./+types` module under `.nifra/types`: params, schema-typed data, and `api` typed by `backend/app.ts`. `dev`, `build` and `check` refresh them too.
6914
+
6915
+ `nifra schemas [--write] [--check]`
6916
+
6917
+ Draft `loaderOutput` and `actionOutput` from each loader's and action's return type. `--write` adds the missing ones; it also lists returned fields a hand-written schema drops.
6918
+
6919
+ `nifra sync-routes`
6920
+
6921
+ Regenerate `nifra-routes.d.ts` so `navigate({ to, search })` is typed by each route's search schema.
6922
+
6923
+ `nifra sync-manifest`
6924
+
6925
+ Regenerate a committed `server-manifest.ts` from `routes/` without a full build.
6926
+
6927
+ `nifra openapi [--format json | yaml] [--path <prefix>]`
6928
+
6929
+ The backend's OpenAPI document, including response types inferred at build time.
6930
+
6931
+ `nifra sdk --lang python | go [--out <file>]`
6932
+
6933
+ A deterministic Python or Go SDK generated from `backend/app.ts`.
6934
+
6935
+ #### Agents and the dev server
6936
+
6937
+ What a coding agent reads and runs. nifra mcp serves the same information as tools; see Coding agents.
6938
+
6939
+ Command
6940
+ What it does
6941
+
6942
+ `nifra mcp [dir]`
6943
+
6944
+ Start the project's MCP server over stdio: the route index, scaffolding, `nifra_check`, SSR rendering, the dev server's errors and logs, and the declared dev database.
6945
+
6946
+ `nifra docs-mcp [--port <n>]`
6947
+
6948
+ Serve the public docs MCP (`nifra_docs`, `nifra_example`) over HTTP, on port 8787 by default.
6949
+
6950
+ `nifra context`
6951
+
6952
+ Print the project's route index and conventions for an agent's prompt.
6953
+
6954
+ `nifra learn [<step>]`
6955
+
6956
+ Print the guided build-an-app path, or one step's goal, actions and check.
6957
+
6958
+ `nifra init-agents [--force] [--sync-mcp]`
6959
+
6960
+ Add the agent files a new app ships (`.mcp.json`, the `AGENTS.md` sections, each agent's pointer) to an existing app. `--sync-mcp` re-pins the MCP launch to the installed nifra.
6961
+
6962
+ `nifra errors [--since <n>] [--category <c>]`
6963
+
6964
+ What the running dev server caught (SSR, loader, API, build, browser and hydration errors), each a structured diagnostic. Exits 1 while errors are open.
6965
+
6966
+ `nifra logs [--level <l>] [--grep <s>]`
6967
+
6968
+ The dev server's console, server and browser, each line tagged with its request.
6969
+
6970
+ `nifra explain [<message> | <NF-code>]`
6971
+
6972
+ A structured diagnostic for an error, or what a check rule reports and how to fix it.
6973
+
6974
+ `nifra db schema | query | role | audit`
6975
+
6976
+ Read the development database declared as `devDatabase` in `nifra.config.ts`: its tables, one read-only `SELECT` (rows capped, secrets masked), the SQL for a read-only Postgres role, and a log of what ran.
6977
+
6978
+ #### Migrate and upgrade
6979
+
6980
+ Move an app between layouts and releases. Each one is a dry run until --write.
6981
+
6982
+ Command
6983
+ What it does
6984
+
6985
+ `nifra migrate layout [--write] [--zones]`
6986
+
6987
+ Move an app onto the 4.0 layout: split each route into `x.tsx` and `x.backend.ts`, fold `_middleware.ts` into `_layout.backend.ts`, move `backend.ts` and `framework.ts` under `backend/`, and zone the other modules.
6988
+
6989
+ `nifra migrate --from tailwind --to stylex`
6990
+
6991
+ Move static Tailwind classes to StyleX; see below.
6992
+
6993
+ `nifra upgrade <version> [--write] [--list]`
6994
+
6995
+ Run every release recipe between the installed version and the target; see below.
6996
+
6606
6997
  ### Tailwind to StyleX
6607
6998
 
6608
6999
  Nifra includes a conservative codemod for moving static Tailwind classes to StyleX. It is a dry
@@ -6621,7 +7012,7 @@ expressions, arbitrary values, parent-dependent variants, and unknown utilities
6621
7012
  and are reported with file/line evidence. A non-zero exit status means manual migration issues
6622
7013
  remain.
6623
7014
 
6624
- StyleX compilation is native to Nifra&apos;s Bun pipeline. Install the runtime and compiler peers,
7015
+ StyleX compilation is native to Nifra's Bun pipeline. Install the runtime and compiler peers,
6625
7016
  then register both the browser and SSR transforms:
6626
7017
 
6627
7018
  ```sh
@@ -6640,7 +7031,7 @@ export const serverPlugins = [stylexBunPlugin("ssr")]
6640
7031
  ```
6641
7032
 
6642
7033
  If the project intentionally uses Vite, add the Vite adapter alongside its existing Vite
6643
- transforms. Nifra will use Vite when `vitePlugins` are the app&apos;s only transforms:
7034
+ transforms. Nifra will use Vite when `vitePlugins` are the app's only transforms:
6644
7035
 
6645
7036
  ```ts
6646
7037
  // doc-check: skip - requires the third-party Vite React plugin
@@ -6664,7 +7055,7 @@ The pins in `overrides`, `resolutions` and
6664
7055
  `pnpm.overrides` move with them, since an override decides what installs. A
6665
7056
  `peerDependencies` range is what a library accepts, not a pin: it is raised only
6666
7057
  when it excludes the target (keeping its operator, even with `--exact`), and a
6667
- library&apos;s `">=3.1.0"` floor never sets the version the upgrade
7058
+ library's `">=3.1.0"` floor never sets the version the upgrade
6668
7059
  starts from unless nothing else, installed or declared, names one.
6669
7060
 
6670
7061
  ```bash
@@ -6679,7 +7070,7 @@ nifra doctor # afterwards: no "mixed nifra versions" advisory l
6679
7070
  It is a dry-run until `--write`, and the same run twice makes no further edits. An
6680
7071
  unknown version or a target below what is installed is refused (`--allow-downgrade`
6681
7072
  when the rollback is intended); a target newer than the running CLI prints the command for
6682
- that release&apos;s CLI. It edits files under the workspace root only: a symlinked package
7073
+ that release's CLI. It edits files under the workspace root only: a symlinked package
6683
7074
  directory or `package.json` is never followed, and a group package installed by a
6684
7075
  link from outside the root is listed under "Left alone" for you to upgrade in its
6685
7076
  own repository. The MCP launch pin in `.mcp.json`, `.cursor/mcp.json`,
@@ -6688,7 +7079,7 @@ the project declares `@nifrajs/cli` so the launch runs that install from then on
6688
7079
  the edit `nifra init-agents --sync-mcp` makes. Another version pinned outside
6689
7080
  `package.json` is listed with its line: the rest of an agent file, an MCP config
6690
7081
  elsewhere, a Dockerfile or compose file, a CI workflow, and a lockfile other than the
6691
- workspace&apos;s own (an image build&apos;s frozen lockfile, say), which you regenerate after
7082
+ workspace's own (an image build's frozen lockfile, say), which you regenerate after
6692
7083
  installing. `nifra check` reads the installed packages, so `--write`
6693
7084
  runs it (`--no-verify` skips that) only once they match the target: until the new
6694
7085
  pins are installed it would judge the release you are leaving, and the command prints the
@@ -6713,6 +7104,21 @@ the commands that move it to the target; upgrade those first, or pass
6713
7104
  targets with the notes of every release after the one you declare: what an app can observe
6714
7105
  changing on the way up.
6715
7106
 
7107
+ A release recipe names the packages its notes change. When none of them is one the project
7108
+ loads (every group package a `package.json` names, and what those depend on as
7109
+ installed), the list and the plan say so beside the release: no announced behaviour change
7110
+ for this project, with the packages it does change. A tool such as `@nifrajs/cli`
7111
+ counts when it is declared, without its own dependencies, since a release that changes what
7112
+ a tool does names the tool. A release without that list, or a declared package that is not
7113
+ installed, is never marked.
7114
+
7115
+ #### Releases and support
7116
+
7117
+ Behaviour changes ship in minor releases; fixes ship as patches of the latest version and
7118
+ change nothing an app relies on. Only the latest release is supported: security fixes and
7119
+ fixes for data loss ship as patches of it, so move to the latest with
7120
+ `nifra upgrade`. `SECURITY.md` lists the supported versions.
7121
+
6716
7122
  ### Scope
6717
7123
 
6718
7124
  `nifra build` defaults to a self-hosted Bun server. Use `--target node`,
@@ -7965,7 +8371,7 @@ start - they are the edges you can hit later, collected in one place.
7965
8371
 
7966
8372
  #### Keep the adapter out of your config file
7967
8373
 
7968
- Split `framework.ts` (the adapter, imported by your server and edge entries) from
8374
+ Split `backend/framework.ts` (the adapter, imported by your server and edge entries) from
7969
8375
  `nifra.config.ts` (the CLI's config, where the Vite plugins and SFC compilers live).
7970
8376
  If your server entry reaches the adapter _through_ the config, everything the config
7971
8377
  imports is bundled into your production server - the Vite plugin, the framework compiler, and
@@ -7974,7 +8380,7 @@ native binding, which reads like a broken install rather than a config-shape pro
7974
8380
 
7975
8381
  ```ts
7976
8382
  // doc-check: skip - fragment: two files from one app, shown together.
7977
- // framework.ts - imported by your SERVER and edge entries. Adapter only, nothing else.
8383
+ // backend/framework.ts - imported by your SERVER and edge entries. Adapter only, nothing else.
7978
8384
  import { svelteAdapter } from "@nifrajs/web-svelte"
7979
8385
  export const adapter = svelteAdapter
7980
8386
 
@@ -7982,7 +8388,7 @@ export const adapter = svelteAdapter
7982
8388
  // belong here. Re-export the adapter; never define it here, or the dev toolchain it pulls in
7983
8389
  // (Vite, the SFC compiler, their native bindings) is bundled into your production server.
7984
8390
  import { svelte } from "@sveltejs/vite-plugin-svelte"
7985
- export { adapter } from "./framework"
8391
+ export { adapter } from "./backend/framework"
7986
8392
  export const clientModule = "@nifrajs/web-svelte/client"
7987
8393
  export const vitePlugins = [svelte()]
7988
8394
  ```
@@ -8181,7 +8587,7 @@ the preflight never executes app code:
8181
8587
  {
8182
8588
  "name": "my-app",
8183
8589
  "dependencies": {
8184
- "react": "19.2.8",
8590
+ "react": "19.3.1",
8185
8591
  "@example/ui": "link:../design-system/packages/ui"
8186
8592
  },
8187
8593
  "nifra": {
@@ -8288,7 +8694,7 @@ routes added after it stay typed. See
8288
8694
  ####
8289
8695
  Call site rejects `{ query: {…} }`
8290
8696
 
8291
- If `api.thing.get(&#123; query: &#123; … &#125; &#125;)` errors, the route declares no
8697
+ If `api.thing.get({ query: { … } })` errors, the route declares no
8292
8698
  `query` schema - its query types as `never`, so the client can't accept query
8293
8699
  params. The error reads out the fix; add a schema to the route:
8294
8700
  `.get("/thing", { query: z.object({ page: z.string() }) }, h)`. Then
@@ -8417,8 +8823,11 @@ Every `@nifrajs/*` package, `nifra` and `create-nifra` ship
8417
8823
  together at one version. `nifra doctor` (and `nifra check`, as the
8418
8824
  `NF-D002` advisory) reads the versions your `package.json` files pin,
8419
8825
  the versions installed in `node_modules` - followed to their real location, so a
8420
- linked repository reports its own - and the running CLI. When they disagree it names each
8421
- version and where it came from. It only reads files, and it never fails the run.
8826
+ linked repository reports its own - the copies a `link:` or `file:`
8827
+ repository outside the root installs in its own `node_modules` (its imports load
8828
+ those, whatever the workspace installs, so two live-linked repositories that each pin one
8829
+ version still run two), and the running CLI. When they disagree it names each version and
8830
+ where it came from. It only reads files, and it never fails the run.
8422
8831
 
8423
8832
  The fix is [`nifra upgrade <highest>`](/docs/cli#upgrade), not a
8424
8833
  hand edit of the pins: it runs
@@ -8656,14 +9065,14 @@ each other. Each domain therefore owns its full absolute paths (`/api/listings`,
8656
9065
  `routes()`, OpenAPI, capability events and the effect ledger. The builder
8657
9066
  inherits this server's middleware chain as it stands at the call; what it adds stays in the
8658
9067
  group, and its `onRequest`/`onResponse` hooks run only for requests at
8659
- or under the prefix. A static header the group declares replaces the parent&apos;s value
8660
- of that name on the group&apos;s routes, so `securityHeaders()` with the group&apos;s
8661
- own configuration applies over the app&apos;s there. Any other plugin the parent already
8662
- applied stays the parent&apos;s: the group&apos;s `use()` of that same instance
9068
+ or under the prefix. A static header the group declares replaces the parent's value
9069
+ of that name on the group's routes, so `securityHeaders()` with the group's
9070
+ own configuration applies over the app's there. Any other plugin the parent already
9071
+ applied stays the parent's: the group's `use()` of that same instance
8663
9072
  does nothing, and its `use()` of another instance under the same name (another
8664
9073
  `cors()` policy) throws a `RouteConfigError` when the group is
8665
9074
  declared, rather than being dropped. A plugin the group applies still shares the
8666
- parent&apos;s copy of a plugin it `use()`s itself. The prefix is plain text (no
9075
+ parent's copy of a plugin it `use()`s itself. The prefix is plain text (no
8667
9076
  params or wildcards), and a collision throws before any group route is added.
8668
9077
 
8669
9078
  -
@@ -9867,6 +10276,91 @@ await serve(app, {
9867
10276
  })
9868
10277
  ```
9869
10278
 
10279
+ A build script that calls `buildServer` itself passes it the manifest
10280
+ `buildClient` returned. The generated `server-manifest` then exports
10281
+ `buildAssets` (a `Set` of every file the build emitted, by request path:
10282
+ the bundle and the copied `public/` files) and `isBuildAsset(pathname)`, so
10283
+ a hand-written static handler or gate can allow exactly the files that exist.
10284
+
10285
+ ```ts
10286
+ // doc-check: skip - fragment: a build script; the routes and entry paths are your app's.
10287
+ import { buildClient, buildServer } from "@nifrajs/web/build"
10288
+
10289
+ const client = await buildClient({ routesDir: "routes", outDir: "dist/assets", clientModule })
10290
+ // One option for the whole client build: entry, stylesheets, per-route CSS, copy chunks, and the
10291
+ // set of files it emitted. Forgetting `styles` used to ship unstyled pages; there is nothing to forget.
10292
+ await buildServer({ routesDir: "routes", serverEntry: "server.ts", outDir: ".build", target: "bun", client })
10293
+ ```
10294
+
10295
+ ### Hosts that serve part of the app
10296
+
10297
+ An app that also answers on domains other people point at it usually must not show all of
10298
+ itself there: such a domain should not render your sign-in page under its own certificate.
10299
+ `createHostPolicy` names, per host, the page routes it renders and the other paths
10300
+ it serves, and takes the build's own files by token, never by guessing their names. A gate that
10301
+ knows only page paths refuses the page's stylesheet and bundle, and the page answers 200 while
10302
+ rendering unstyled and never hydrating.
10303
+
10304
+ ```ts
10305
+ // doc-check: skip - fragment: adapter, manifest and build as above; ./server-manifest is generated by buildServer.
10306
+ import { createHostPolicy, createWebApp } from "@nifrajs/web"
10307
+ import { buildAssets } from "./server-manifest"
10308
+
10309
+ const ownHosts = new Set(["app.example.com", "localhost"])
10310
+
10311
+ // On every other host (a domain pointed at the app): the public pages, the API they call, and
10312
+ // exactly the files the build emitted. Nothing else renders there, the sign-in page included.
10313
+ export const hostPolicy = createHostPolicy({
10314
+ rules: [{
10315
+ hosts: (host) => !ownHosts.has(host),
10316
+ pages: ["/", "/p/:id", "/share/*"],
10317
+ paths: ["/api/public/*"],
10318
+ }],
10319
+ })
10320
+
10321
+ export const app = createWebApp({ adapter, manifest, clientEntry: build.entry, hostPolicy, buildAssets })
10322
+ ```
10323
+
10324
+ -
10325
+ **Order.** `createWebApp` checks the policy before everything it answers:
10326
+ `use` middleware, mounts, the API, prerendered pages and pages. A refused path
10327
+ gets a bare `404` with `cache-control: no-store`, or what
10328
+ `refuse` returns.
10329
+
10330
+ -
10331
+ **The build's files.** `buildAssets: true` (the default) serves on that host
10332
+ every file the build emitted. Set it to `false` and list files in
10333
+ `paths` to serve only some.
10334
+
10335
+ -
10336
+ **
10337
+ With `nifra build`.
10338
+ **
10339
+ Export `hostPolicy` from `backend/framework.ts`. The generated server
10340
+ entry passes it and `buildAssets` to `createWebApp`, and checks it
10341
+ before its own static files on Bun, Node and Deno, and before the Cloudflare worker's
10342
+ `ASSETS` fallback (the build then routes every file, the client bundle included,
10343
+ through the worker). Vercel serves files from its CDN before the function runs, so there the policy
10344
+ governs pages and the API only.
10345
+
10346
+ -
10347
+ **In development.** `nifra dev` serves the bundle and `public/`
10348
+ ahead of the app, so only pages and the API are checked there.
10349
+
10350
+ -
10351
+ **Soft navigations.** A client-side navigation fetches the page's data from the
10352
+ server, which applies the policy, so a refused page fails there as it would on a full load.
10353
+
10354
+ `nifra smoke` checks it end to end. For each entry in a fixture's `hosts`
10355
+ it renders the pages on that host, fetches every file they reference (scripts and their
10356
+ imports, stylesheets and their `url()`s, icons) on the same host and expects 200,
10357
+ then expects each `refused` path to answer 404.
10358
+
10359
+ ```ts
10360
+ // doc-check: skip - fragment: a nifra.smoke.ts fixture's hosts field.
10361
+ hosts: [{ id: "partner", host: "docs.partner.test", pages: ["/", "/p/demo"], refused: ["/login"] }]
10362
+ ```
10363
+
9870
10364
  ### A strict CSP on nifra's nonce
9871
10365
 
9872
10366
  Pass `createCspPolicy` as `csp` and nifra writes the
@@ -10434,7 +10928,7 @@ then up to 127 of `A-Z a-z 0-9 . _ : / -`), more than 32 tags, or something othe
10434
10928
  an array. Those tags were dropped, so a purge by them reaches nothing. The warning names the
10435
10929
  route, never the tag.
10436
10930
 
10437
- **Fix:** build tags from route params (`product:$&#123;params.id&#125;`),
10931
+ **Fix:** build tags from route params (`product:${params.id}`),
10438
10932
  keep to the allowed characters, and return at most 32.
10439
10933
 
10440
10934
  #### NIFRA_CDN_RATE_LIMITED
@@ -11268,7 +11762,7 @@ keeps the 4.x behavior for each.
11268
11762
  Past 5.0, 5.1 adds one change a frontend on another origin sees. A route with a
11269
11763
  `body` schema answers a urlencoded, multipart or `text/plain` body whose
11270
11764
  `Origin` names another site with `403 forbidden_origin`, before reading
11271
- it. List that frontend&rsquo;s origin, or an identity provider&rsquo;s for a
11765
+ it. List that frontend's origin, or an identity provider's for a
11272
11766
  `form_post` callback, in the `formOrigins` server option (an array of
11273
11767
  exact origins or a function; `@nifrajs/edge` takes it too). JSON bodies are
11274
11768
  unchanged. [Security](/docs/security) covers what the check leaves to
@@ -11483,6 +11977,8 @@ app.
11483
11977
 
11484
11978
  -
11485
11979
  **Much faster SSR** - the current dynamic-page snapshot reports Nifra at
11980
+ 20× the throughput of Next.js, 7× Nuxt, and
11981
+ 3.2× SvelteKit / 3.3× SolidStart, with a fraction
11486
11982
  of the client JavaScript. See [benchmarks](/benchmarks).
11487
11983
 
11488
11984
  -
@@ -11512,7 +12008,7 @@ mount small and temporary, and use typed routes for every migrated endpoint.
11512
12008
  The platform object is forwarded as the second argument when the runtime supplies one.
11513
12009
 
11514
12010
  A mounted fetch handler carries HTTP only. A WebSocket upgrade under the mount reaches it as
11515
- an ordinary request and never becomes a socket, so keep the legacy app&apos;s sockets on its own
12011
+ an ordinary request and never becomes a socket, so keep the legacy app's sockets on its own
11516
12012
  server until they move to `app.ws()` routes (see
11517
12013
  [WebSockets in a composed app](/docs/websockets#composed)).
11518
12014
 
@@ -11634,7 +12130,7 @@ and a `process <job>` consumer span per attempt. The process span is a child
11634
12130
  of the send span, plus a link to it, so one trace runs from the request to the worker even when
11635
12131
  the worker is another process. Retries are separate spans, and the attempt that dead-letters a
11636
12132
  job says so. A job store persists the trace context as an optional field;
11637
- `jobStoreCertificationProfile(&#123; traceparent: true &#125;)` checks it.
12133
+ `jobStoreCertificationProfile({ traceparent: true })` checks it.
11638
12134
 
11639
12135
  ### Event consumers
11640
12136
 
@@ -11729,7 +12225,7 @@ reads, no events, no extra frames.
11729
12225
 
11730
12226
  > A dimension-by-dimension security comparison of Nifra against the current releases of Hono, Fastify, Express, and Elysia - which hardening each framework ships by default, which is opt-in, and which is left to third-party packages.
11731
12227
 
11732
- Which hardening each framework actually ships. A dimension-by-dimension read of Nifra&rsquo;s
12228
+ Which hardening each framework actually ships. A dimension-by-dimension read of Nifra's
11733
12229
  security defaults against the **current releases** of Hono, Fastify, Express, and Elysia -
11734
12230
  what is on by default, what is opt-in, and what is left to a third-party package. For how each
11735
12231
  Nifra primitive works, see [Security & hardening](/docs/security).
@@ -11749,10 +12245,10 @@ verification, env-independent error responses, client-IP trust model.
11749
12245
  **Par with the best-in-class:** body limits (Fastify class), JSON prototype-poisoning
11750
12246
  rejection (par Fastify, default-on), schema validation (par Fastify/Elysia), CSRF (par
11751
12247
  Fastify), security headers (par Hono, first-party), cookie prefixes (par Hono), sessions,
11752
- JWT hardening, static serving, supply chain (par Hono&rsquo;s zero-dependency core).
12248
+ JWT hardening, static serving, supply chain (par Hono's zero-dependency core).
11753
12249
 
11754
12250
  **One caveat no capability table removes.** Hono, Fastify, and Express have orders of
11755
- magnitude more production exposure and more external researchers looking at them. Nifra&rsquo;s
12251
+ magnitude more production exposure and more external researchers looking at them. Nifra's
11756
12252
  protections are implementation-verified and unit-tested, but have not had that volume of
11757
12253
  adversarial attention or a third-party audit. Ongoing scrutiny is the part only time buys.
11758
12254
 
@@ -12027,10 +12523,10 @@ body is drained through a true streaming byte counter that cancels at the cap. T
12027
12523
  charged on the bytes actually **delivered**, never on the number a caller wrote in the
12028
12524
  header - so an adapter that rebuilds a request from an event envelope cannot smuggle a large
12029
12525
  payload behind a small declared length. Fastify enforces its 1 MiB default on real bytes and
12030
- is the gold standard among the four; Nifra matches it. Hono&rsquo;s `bodyLimit` is
12526
+ is the gold standard among the four; Nifra matches it. Hono's `bodyLimit` is
12031
12527
  an opt-in middleware that keys on `Content-Length`; Express relies on
12032
- body-parser&rsquo;s 100 KB default only if you mount it; Elysia inherits the runtime cap
12033
- (Bun&rsquo;s 128 MB).
12528
+ body-parser's 100 KB default only if you mount it; Elysia inherits the runtime cap
12529
+ (Bun's 128 MB).
12034
12530
 
12035
12531
  #### Prototype pollution
12036
12532
 
@@ -12040,7 +12536,7 @@ JSON body lane **rejects** the poisoning shape by default - an own `__proto__`
12040
12536
  key, or a `constructor` carrying a `prototype` - answering the same flat
12041
12537
  400 as malformed JSON, with `"strip"` and `"ignore"`
12042
12538
  as alternatives. That matches Fastify, whose `onProtoPoisoning` and
12043
- `onConstructorPoisoning` both default to `&apos;error&apos;`. Hono and
12539
+ `onConstructorPoisoning` both default to `'error'`. Hono and
12044
12540
  Express do not reject proto keys in the JSON body; Elysia strips undeclared keys only on a
12045
12541
  validated route via its schema normalization.
12046
12542
 
@@ -12050,38 +12546,38 @@ Nifra does per-route Standard Schema validation for body/query/params, and - the
12050
12546
  differentiating half - **response** schemas as an enforced upper bound:
12051
12547
  `"warn"` logs undeclared fields, `"enforce"` strips
12052
12548
  them. That kills the `passwordHash`-in-the-response class at the framework layer.
12053
- Fastify offers the same protection through a declared response schema (opt-in); Elysia&rsquo;s
12549
+ Fastify offers the same protection through a declared response schema (opt-in); Elysia's
12054
12550
  exactMirror normalization strips undeclared response fields and is its strongest default.
12055
- Hono&rsquo;s validator is opt-in with no response-side story, and Express ships nothing.
12551
+ Hono's validator is opt-in with no response-side story, and Express ships nothing.
12056
12552
 
12057
12553
  #### CORS, CSRF, and error handling
12058
12554
 
12059
- Nifra&rsquo;s `cors()` throws at construction when `credentials: true`
12555
+ Nifra's `cors()` throws at construction when `credentials: true`
12060
12556
  meets `origin: "*"`, never reflects an origin by default with credentials,
12061
12557
  and lands headers on error responses too - it is **the only one of the five where the
12062
12558
  dangerous configuration is a construction-time error**. The other four leave
12063
12559
  reflect-with-credentials configurable. CSRF is two independent layers (Origin/Referer check
12064
- plus a signed double-submit token, timing-safe); Hono&rsquo;s CSRF is an Origin /
12065
- Sec-Fetch-Site heuristic, Fastify&rsquo;s official token package is comparable, Express&rsquo;s
12560
+ plus a signed double-submit token, timing-safe); Hono's CSRF is an Origin /
12561
+ Sec-Fetch-Site heuristic, Fastify's official token package is comparable, Express's
12066
12562
  csurf is deprecated, and Elysia ships none in-tree. Uncaught errors become a flat 500
12067
- unconditionally - not env-gated - so no configuration leaks a stack to the wire; Express&rsquo;s
12563
+ unconditionally - not env-gated - so no configuration leaks a stack to the wire; Express's
12068
12564
  dev handler printing stacks when `NODE_ENV` is unset is the perennial
12069
12565
  counter-example.
12070
12566
 
12071
12567
  #### Headers, cookies, sessions, JWT
12072
12568
 
12073
12569
  Both Nifra and Hono ship a first-party security-headers middleware you add with
12074
- `use()`. Nifra&rsquo;s turns on nosniff, `X-Frame-Options: DENY`, and
12570
+ `use()`. Nifra's turns on nosniff, `X-Frame-Options: DENY`, and
12075
12571
  `Referrer-Policy: no-referrer`, and keeps the headers that can break a working app
12076
- (COOP/COEP/CORP, Permissions-Policy, CSP, HSTS) opt-in by design; Hono&rsquo;s covers a broader
12572
+ (COOP/COEP/CORP, Permissions-Policy, CSP, HSTS) opt-in by design; Hono's covers a broader
12077
12573
  list on by default once added, HSTS included. Cookie serialization enforces RFC 6265 name
12078
12574
  tokens, caps at 4096 bytes, and enforces `__Host-`/`__Secure-` prefix
12079
- preconditions at serialization time, throwing on a violation - the same behavior Hono&rsquo;s
12575
+ preconditions at serialization time, throwing on a violation - the same behavior Hono's
12080
12576
  cookie helper has, and stricter than a silent browser drop. Sessions are always HMAC-signed,
12081
12577
  HttpOnly, SameSite=Lax, fail-closed, with `regenerate()` for fixation - no
12082
12578
  competitor ships sessions in-tree. JWT verification demands an algorithm allowlist, rejects
12083
12579
  `alg: none`, blocks algorithm confusion at the key level, and requires
12084
- `exp` by default; Hono&rsquo;s JWT middleware takes a single required algorithm with
12580
+ `exp` by default; Hono's JWT middleware takes a single required algorithm with
12085
12581
  no enforced allowlist and treats `exp` as optional, so Nifra is stricter there.
12086
12582
 
12087
12583
  #### Static serving, redirects, uploads, proxying
@@ -12099,12 +12595,12 @@ bytes and strip EXIF/GPS by re-encode, where the others do size limits at best.
12099
12595
  #### Rate limiting, IP trust, load shedding
12100
12596
 
12101
12597
  The rate limiter keys on the caller IP the server resolved, never on a client-sent header, so
12102
- the &ldquo;trust proxy = spoofable keys&rdquo; footgun has no default path; with no resolvable
12598
+ the "trust proxy = spoofable keys" footgun has no default path; with no resolvable
12103
12599
  IP it fails closed instead of sharing one bucket.
12104
12600
  `X-Forwarded-For` is ignored at the default and counted from the right only when you
12105
12601
  declare trusted proxies. `c.clientIp` is the socket peer unless you pass an explicit
12106
12602
  trust config, and short chains fail closed. Admission sheds on live capacity evidence
12107
- (in-flight count plus event-loop lag). Fastify&rsquo;s under-pressure is the only peer for load
12603
+ (in-flight count plus event-loop lag). Fastify's under-pressure is the only peer for load
12108
12604
  shedding; nothing else in the field defaults to an unspoofable key or fails closed on IP trust.
12109
12605
 
12110
12606
  ### Beyond parity - what none of the four ship
@@ -12132,10 +12628,10 @@ third-party add-on for the others; Nifra ships them first-party with assurance i
12132
12628
 
12133
12629
  ### Where each alternative is still the right call
12134
12630
 
12135
- This is a security read, not a blanket &ldquo;pick Nifra&rdquo;. Hono&rsquo;s run-anywhere
12136
- minimalism and its zero-dependency core are genuinely excellent; Fastify&rsquo;s maturity,
12631
+ This is a security read, not a blanket "pick Nifra". Hono's run-anywhere
12632
+ minimalism and its zero-dependency core are genuinely excellent; Fastify's maturity,
12137
12633
  ecosystem, and years of adversarial attention are real advantages a young framework cannot
12138
- claim; Express&rsquo;s ubiquity means every hire already knows it. Nifra&rsquo;s argument is
12634
+ claim; Express's ubiquity means every hire already knows it. Nifra's argument is
12139
12635
  narrower and honest: it makes the dangerous configurations _unrepresentable_, ships the
12140
12636
  hardening primitives first-party, and lets `nifra assure` prove in CI that every
12141
12637
  route is guarded. For the full capability and throughput comparison, see
@@ -12266,6 +12762,15 @@ most specific entry decides: above, `src/ui/mailer.ts` is backend code in a
12266
12762
  frontend folder. One path listed under two sides is refused. Builds, dev servers,
12267
12763
  `nifra check` and the editor plugin all read this setting.
12268
12764
 
12765
+ `frontend/` and `backend/` keep their own rules, with one exception: a
12766
+ module there that both sides import can be declared shared where it lives, by a
12767
+ `shared` entry naming it or by a `.shared` suffix. The entry changes no
12768
+ import; the suffix renames the file. Either way the module is then held to the shared rules
12769
+ (it may import only shared code and packages, and read no private environment variable), so
12770
+ the declaration narrows what it may reach and never widens it. When backend code imports a
12771
+ frontend module, NF-C028 says whether that module can be shared as it is, or names the import
12772
+ or environment read that stops it.
12773
+
12269
12774
  A project that serves no pages has no browser, so the zones do not apply to it. Declare that
12270
12775
  in its `package.json` with `"nifra": { "kind": "api" }`:
12271
12776
  `nifra check` then skips the zone checks and the server-only import check there,
@@ -12447,7 +12952,7 @@ test("the API contract withstands hostile inputs", async () => {
12447
12952
  For every selected route, the laboratory synthesizes a valid **contract witness**. It then
12448
12953
  changes types, removes required fields, crosses numeric and length bounds, inserts unknown
12449
12954
  properties, and descends into nested objects and arrays. A mutation is sent only after the
12450
- route&apos;s own Standard Schema validator proves it invalid. Query values are proved after URL
12955
+ route's own Standard Schema validator proves it invalid. Query values are proved after URL
12451
12956
  serialization, exactly as the server receives them.
12452
12957
 
12453
12958
  Invalid inputs must produce 422 by default. A valid witness is also executed for every
@@ -12457,7 +12962,7 @@ has a different validation response.
12457
12962
 
12458
12963
  ### Assert the server keeps its own contract
12459
12964
 
12460
- A route&rsquo;s `response` schema types the handler and the client, but nothing
12965
+ A route's `response` schema types the handler and the client, but nothing
12461
12966
  re-checks the bytes that actually leave the app. `validateResponses` closes that gap
12462
12967
  in tests: every JSON response is validated against the schema declared for its status, and a
12463
12968
  mismatch throws `ResponseContractViolation` straight through the
@@ -12476,7 +12981,7 @@ const res = await api.me.get() // ResponseContractViolation if the payload dri
12476
12981
  ```
12477
12982
 
12478
12983
  Whether it catches _undeclared extra_ fields depends on your validator, not on nifra: a
12479
- strict schema (`@nifrajs/schema`&rsquo;s `t.object`) reports them and the
12984
+ strict schema (`@nifrajs/schema`'s `t.object`) reports them and the
12480
12985
  test fails, while a stripping one (Zod, Valibot) accepts them silently. To catch extras
12481
12986
  regardless, or to stop them reaching the wire in production, use
12482
12987
  [
@@ -12486,7 +12991,7 @@ regardless, or to stop them reaching the wire in production, use
12486
12991
 
12487
12992
  ### Opaque schemas stay validator-neutral
12488
12993
 
12489
- Nifra&apos;s `t` schemas carry inspectable JSON Schema, so witness generation is
12994
+ Nifra's `t` schemas carry inspectable JSON Schema, so witness generation is
12490
12995
  automatic. Other Standard Schema libraries do not have to expose structure. Supply a known-good
12491
12996
  witness; their own validator still proves every hostile mutation.
12492
12997
 
@@ -12764,7 +13269,7 @@ The tooling reads the backend `backend/app.ts` exports. An app that
12764
13269
  factory, is invisible to the contract lock and the route lints until that file serves it.
12765
13270
  `nifra check` names each implemented operation the backend does not serve
12766
13271
  (NF-C039), and counts them when there is no `backend/app.ts` at all. It reads a
12767
- contract imported from a workspace package through that package&apos;s
13272
+ contract imported from a workspace package through that package's
12768
13273
  `exports`; a package installed from a registry is never read, and the check says
12769
13274
  so rather than passing it. Export the same app built with stand-in dependencies:
12770
13275
 
@@ -13763,6 +14268,38 @@ Part of the **[nifra](https://nifra.dev)** full-stack TypeScript framework - one
13763
14268
  bun add @nifrajs/auth
13764
14269
  ```
13765
14270
 
14271
+ ## Store revocation and rotation
14272
+
14273
+ Store mode requires strongly consistent reads: every instance must observe completed writes and
14274
+ deletes, including revocation markers. `createSessions` refuses adapters declaring
14275
+ `consistency: "eventual"`. `KVSessionStore` declares this and is no longer accepted: Workers KV can
14276
+ serve a cached session and a cached missing marker after logout, allowing renewal to restore it.
14277
+ Its export remains available for reading and migrating legacy records.
14278
+
14279
+ Use a strongly consistent shared `SessionStore`, for example a transactional adapter or a Durable
14280
+ Object, in production. `MemorySessionStore` remains suitable for development or an explicitly allowed
14281
+ single-instance deployment. Custom adapters may declare `consistency: "strong"`; omitting the
14282
+ declaration preserves compatibility but asserts the same strong-consistency contract. Wrapping or
14283
+ relabeling Workers KV does not make its reads strongly consistent. No eventual-consistency opt-in is
14284
+ provided, including when rolling renewal is disabled.
14285
+
14286
+ In store mode, `destroy` revokes the entire session family, including later IDs issued by
14287
+ `regenerate`. A cookie that a rotation has already replaced does this only for 60 seconds after
14288
+ the rotation, while the rotating response may still be on its way to the browser. After that,
14289
+ logging out with it drops only that superseded ID, so a kept pre-login cookie cannot end the
14290
+ session that replaced it. Rotated IDs remain opaque signed cookie values. Store adapters must retain
14291
+ `<id>.rotated` and `<family>.revoked` marker records until their `expiresAt`, including after the
14292
+ original session record is deleted. Do not interpret markers as sessions.
14293
+ For store adapters, the family is the session's original ID: a rotated ID has the form
14294
+ `<family>~<replacement>`, and repeated rotations keep that same family prefix.
14295
+
14296
+ Adapters may implement `SessionStore.rotate(previousId, nextId, record, marker)` atomically: refuse
14297
+ when the previous record is missing, rotated, or its family is revoked; otherwise write the rotation
14298
+ marker, delete the old record, and store the replacement in one transaction. Return whether it won.
14299
+ The built-in memory store implements this operation. Adapters with only `get`/`set`/`delete` keep
14300
+ logout markers separate from rotation markers and check family revocation after writing; concurrent
14301
+ rotations can produce multiple replacement IDs, all revoked by one logout of the family.
14302
+
13766
14303
  ## Docs
13767
14304
 
13768
14305
  - Reference: <https://nifra.dev/docs>
@@ -14142,7 +14679,8 @@ is the feedback plan and reports which release gates it omits. CI and release au
14142
14679
  consumer, publish, and cross-runtime gates. Each gate runs a `package.json` script (`bun run lint`,
14143
14680
  `bun run check:docs`, ...); a gate whose script the project does not declare is reported as
14144
14681
  `undeclared` and does not fail the run. The nifra repository's own `bun run verify` and
14145
- `bun run check:release` fail that gate instead, so a renamed script cannot drop it. Run `nifra port --ci --target <target>` for an app's
14682
+ `bun run check:release` fail that gate instead, so a renamed script cannot drop it. A line on stderr
14683
+ marks each gate as it starts and finishes, with its time. Run `nifra port --ci --target <target>` for an app's
14146
14684
  resolved deployment target; CI never guesses a target when none is configured.
14147
14685
 
14148
14686
  ## `nifra check` - the drift gate (run as "done")
@@ -14406,7 +14944,9 @@ for a repository you trust.
14406
14944
 
14407
14945
  `IsolatedExtensionWorker` is an opt-in process-backed crash-containment seam for
14408
14946
  extensions. It is not a hostile-code sandbox; use OS-level isolation before
14409
- loading code you do not trust.
14947
+ loading code you do not trust. `start()` rejects, and the worker is stopped, when the
14948
+ module exits before it is ready (a clean exit included) or is not ready within
14949
+ `startTimeoutMs` (default 30 s); `timeoutMs` bounds each tool call.
14410
14950
 
14411
14951
  `NifraBackend` is a small provider port for a future native backend. It accepts
14412
14952
  an injected model implementation and bounded tools without importing a provider
@@ -15462,7 +16002,9 @@ bind it, for example to show or hide the nested island.
15462
16002
 
15463
16003
  `signal(initial)` / `computed(fn)` / `effect(fn) → dispose` / `batch(fn)` - auto-tracking with
15464
16004
  per-run re-tracking, `Object.is` skips, synchronous updates; `batch` coalesces multiple writes
15465
- into one flush. A `computed` runs on first read and stops by itself once nothing reads it: the
16005
+ into one flush. Computeds settle before any effect runs, so an effect never sees one that lags its
16006
+ inputs. A write or batch runs each affected effect once; an effect runs again only when another
16007
+ effect writes one of its inputs during that flush, and its last run sees the settled values. A `computed` runs on first read and stops by itself once nothing reads it: the
15466
16008
  next change to its inputs stops it instead of recomputing, and reading it again computes it afresh.
15467
16009
  Every effect an island's setup creates stops when `mountIslands`' disposer unmounts it; one created
15468
16010
  outside an island runs until its disposer is called. Island-scale by design: if a widget outgrows this (lists, ownership trees,
@@ -16029,10 +16571,26 @@ the check there only makes it need repeated swaps. Mutable or attacker-writable
16029
16571
  therefore outside the adapter's guarantee on those platforms. Store user-controlled files outside the static root and serve them through
16030
16572
  an application or object-storage path with its own validation policy.
16031
16573
 
16032
- Every file carries a strong `ETag` (from mtime and size), `Last-Modified`, and
16033
- `Accept-Ranges: bytes`. `If-None-Match` and `If-Modified-Since` get a bodyless 304; a single
16034
- `Range` on GET gets 206 (or 416 when unsatisfiable), gated by `If-Range`. Multi-range requests get
16035
- the whole file.
16574
+ Every file carries `Accept-Ranges: bytes`. A file up to 256 KiB is read whole and carries a strong
16575
+ `ETag` from exactly the bytes served: 128 bits of their SHA-256, the same for the same bytes on every
16576
+ instance and on `servePublicDir`. A replacement that keeps a file's size and timestamps still changes
16577
+ its tag. The tag is remembered per file version (device, inode, size, mtime and ctime): a file over
16578
+ 4 KiB reuses it without hashing when a second stat after the read shows the same version, and a
16579
+ `HEAD` or a `304` for that tag is answered from the stat without reading the file at all. A
16580
+ larger file streams without an automatic `ETag`, because an open file can be overwritten after any
16581
+ separate hash pass: an `If-Range` request for it gets the whole file, and an unguarded range still
16582
+ works. Explicit validator headers remain the caller's responsibility and must describe an immutable
16583
+ representation.
16584
+
16585
+ `Last-Modified` is sent only while the file's mtime is the time of its own last change (it matches its
16586
+ ctime), since a copy that keeps or normalizes mtimes gives a changed file the old date. A streamed
16587
+ file is dated only once that change is more than 2 s old, so a write during the stream lands in a
16588
+ later second than the date it was sent with. Explicit
16589
+ validator headers still apply. `If-None-Match` takes precedence over `If-Modified-Since`; a matching
16590
+ condition gets a bodyless 304. `Range` on GET is parsed by a copy of `@nifrajs/core/range`, the parser
16591
+ `servePublicDir` uses, and gated by `If-Range`: it must name the file's strong tag, or its exact date
16592
+ when the file has no strong tag. One range (overlapping or adjacent ones merge into one) gets 206, a
16593
+ range-set that selects nothing gets 416, and several disjoint ranges get the whole file.
16036
16594
 
16037
16595
  ## Graceful shutdown on signals
16038
16596
 
@@ -16692,6 +17250,8 @@ import { assertSafeKey, StorageKeyError } from "@nifrajs/storage"
16692
17250
  - `new MemoryStorage()` · `new FileStorage(root)` · `new R2Storage(bucket)`.
16693
17251
  - `put(key, data, { contentType?, metadata? })` - `data` is `Uint8Array | ArrayBuffer | string`.
16694
17252
  - `get(key)` → `{ body, size, contentType?, metadata? } | null` · `delete(key)` · `exists(key)` · `list({ prefix?, limit? })`.
17253
+ `FileStorage.list` reads and sorts each directory it enters, so even `limit: 1` costs time in
17254
+ proportion to those directories' entries; split a very large store across key prefixes.
16695
17255
  - `assertSafeKey(key)` / `StorageKeyError` · `toBytes(data)`.
16696
17256
  - `assertStorageAdapterConformance({ createAdapter })` - dependency-free executable adapter contract.
16697
17257
  - Optional interfaces: `PagedStorageAdapter` · `PresignableStorageAdapter` · `MovableStorageAdapter`.
@@ -17503,7 +18063,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
17503
18063
 
17504
18064
  ## @nifrajs/agent-app
17505
18065
 
17506
- `AGENT_APP_FEATURES`, `AgentAppClient`, `AgentAppClientOptions`, `AgentAppError`, `AgentEventView`, `AgentTransport`, `AgentTransportError`, `AgentTransportRequest`, `ApprovalRequiredView`, `ApprovalResolvedView`, `AssistantChunkView`, `AuthProvider`, `BoundaryDecisionResult`, `BoundaryItemView`, `BoundaryStateView`, `CommandOutcome`, `ContextUsageView`, `CreateSessionInput`, `EvalComparisonView`, `EvidenceTimelineView`, `ExtensionEventView`, `ExtensionReloadedView`, `FaultInjectionView`, `HandoffView`, `HttpAgentTransport`, `HttpAgentTransportOptions`, `MemoryCompactedView`, `OrderedEventBuffer`, `PendingApprovalView`, `PlanUpdatedView`, `ReasoningDeltaView`, `RegistryCapabilityView`, `RepairRequiredView`, `ReplayEntryView`, `ReplayResult`, `ResolveHandoffInput`, `ResumeInput`, `ReviewView`, `ReviewViewCheck`, `ReviewViewEvidence`, `ReviewViewFinding`, `ReviewViewStatus`, `RunStudioNodeState`, `RunStudioNodeView`, `RunStudioView`, `RunView`, `SessionFailedView`, `SessionLifecycleView`, `SessionStoppedView`, `SessionView`, `ToolCompletedView`, `ToolDeltaView`, `ToolStartedView`, `TurnStartedView`, `VerificationCompletedView`, `boundaryCommands`, `boundaryIsStale`, `parseEventStream`, `toEvalComparisonView`, `toEventView`, `toEvidenceTimelineView`, `toFaultInjectionViews`, `toHandoffView`, `toRegistryCapabilityView`, `toReviewView`, `toRunStudioView`, `toRunView`, `toSessionView`, `virtualizeEvidenceRows`
18066
+ `AGENT_APP_FEATURES`, `AgentAppClient`, `AgentAppClientOptions`, `AgentAppError`, `AgentEventView`, `AgentTransport`, `AgentTransportError`, `AgentTransportRequest`, `AgentTurnError`, `ApprovalRequiredView`, `ApprovalResolvedView`, `AssistantChunkView`, `AuthProvider`, `BoundaryDecisionResult`, `BoundaryItemView`, `BoundaryStateView`, `CommandOutcome`, `ContextUsageView`, `CreateSessionInput`, `EvalComparisonView`, `EvidenceTimelineView`, `ExtensionEventView`, `ExtensionReloadedView`, `FaultInjectionView`, `HandoffView`, `HttpAgentTransport`, `HttpAgentTransportOptions`, `MemoryCompactedView`, `OrderedEventBuffer`, `PendingApprovalView`, `PlanUpdatedView`, `ReasoningDeltaView`, `RegistryCapabilityView`, `RepairRequiredView`, `ReplayEntryView`, `ReplayResult`, `ResolveHandoffInput`, `ResumeInput`, `ReviewView`, `ReviewViewCheck`, `ReviewViewEvidence`, `ReviewViewFinding`, `ReviewViewStatus`, `RunStudioNodeState`, `RunStudioNodeView`, `RunStudioView`, `RunView`, `SessionFailedView`, `SessionLifecycleView`, `SessionStoppedView`, `SessionView`, `ToolCompletedView`, `ToolDeltaView`, `ToolStartedView`, `TurnStartedView`, `VerificationCompletedView`, `boundaryCommands`, `boundaryIsStale`, `parseEventStream`, `toEvalComparisonView`, `toEventView`, `toEvidenceTimelineView`, `toFaultInjectionViews`, `toHandoffView`, `toRegistryCapabilityView`, `toReviewView`, `toRunStudioView`, `toRunView`, `toSessionView`, `virtualizeEvidenceRows`
17507
18067
 
17508
18068
  ## @nifrajs/agent-protocol
17509
18069
 
@@ -17539,7 +18099,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
17539
18099
 
17540
18100
  ## @nifrajs/client
17541
18101
 
17542
- `ActionArgs`, `ActionData`, `ApiError`, `ApiProxy`, `ClientOptions`, `ClientRetryOptions`, `FetchFn`, `InProcessClient`, `InProcessClientOptions`, `InputOf`, `Jsonify`, `LoaderArgs`, `LoaderData`, `LoaderResponseControls`, `OutputOf`, `RESERVED_EXACT_KEYS`, `RESERVED_KEY_READOUT`, `RESERVED_VERB_KEYS`, `Register`, `RegisteredBackend`, `RegisteredEnv`, `RegistryOf`, `ResponseContractViolation`, `Result`, `RouteActionReturn`, `RouteLoaderArgs`, `RouteLoaderReturn`, `SearchSchemaOf`, `SubscribeOptions`, `Subscription`, `TestClientOptions`, `Treaty`, `TreatyFromRegistry`, `WsCallOptions`, `WsHandle`, `client`, `inProcessClient`, `reservedKeyFor`, `testClient`
18102
+ `ActionArgs`, `ActionData`, `ApiError`, `ApiProxy`, `ClientOptions`, `ClientRetryOptions`, `FetchFn`, `InProcessClient`, `InProcessClientOptions`, `InputOf`, `Jsonify`, `LoaderArgs`, `LoaderData`, `LoaderResponseControls`, `NAMESPACED_KEYS`, `OutputOf`, `RESERVED_EXACT_KEYS`, `RESERVED_KEY_READOUT`, `RESERVED_VERB_KEYS`, `Register`, `RegisteredBackend`, `RegisteredEnv`, `RegistryOf`, `ResponseContractViolation`, `Result`, `RouteActionReturn`, `RouteLoaderArgs`, `RouteLoaderReturn`, `SearchSchemaOf`, `SubscribeOptions`, `Subscription`, `TestClientOptions`, `Treaty`, `TreatyFromRegistry`, `WsCallOptions`, `WsHandle`, `client`, `inProcessClient`, `reservedKeyFor`, `testClient`
17543
18103
 
17544
18104
  ## @nifrajs/coding-agent
17545
18105
 
@@ -17659,11 +18219,11 @@ done-gate, or `nifra mcp` to give the agent live project tools.
17659
18219
 
17660
18220
  ## @nifrajs/uploads
17661
18221
 
17662
- `DETECTABLE_MIME_TYPES`, `FILE_TYPE_PREFIX_BYTES`, `FileType`, `ImageReencoder`, `SignDownloadUrlOptions`, `StripImageMetadataOptions`, `UploadResult`, `ValidateUploadOptions`, `detectFileType`, `signDownloadUrl`, `stripImageMetadata`, `validateUpload`, `verifyDownloadUrl`
18222
+ `DETECTABLE_MIME_TYPES`, `FILE_TYPE_PREFIX_BYTES`, `FileType`, `ImagePixelLimitError`, `ImageReencoder`, `SignDownloadUrlOptions`, `StripImageMetadataOptions`, `UploadResult`, `ValidateUploadOptions`, `detectFileType`, `signDownloadUrl`, `stripImageMetadata`, `validateUpload`, `verifyDownloadUrl`
17663
18223
 
17664
18224
  ## @nifrajs/web
17665
18225
 
17666
- `ACTION_GLOBAL`, `Action`, `BOUNDARY_GLOBAL`, `BackendOnly`, `Blocker`, `BlockerController`, `BlockerFunction`, `BlockerLocation`, `BlockerState`, `Boundary`, `BoundaryDescriptor`, `BoundaryError`, `BoundaryMode`, `BoundaryRegistration`, `BoundaryRequestCtx`, `BoundaryState`, `BoundaryStates`, `BoundaryStatus`, `BrowserNavigate`, `CacheStore`, `CachedResponse`, `CdnPurgeOutcome`, `CdnPurgeTarget`, `ClientAction`, `ClientActionArgs`, `ClientActionResult`, `ClientLoader`, `ClientLoaderArgs`, `ClientRequestBody`, `ClientRouteHooks`, `ClientRouter`, `ClientRouterOptions`, `CreateCspPolicyOptions`, `CreateNonceResolverOptions`, `CreateWebAppOptions`, `CspHeaderContext`, `CspPolicy`, `CssLoadingMode`, `DATA_GLOBAL`, `DATA_HEADER`, `DEFAULT_CSS_LOADING`, `DEFAULT_DEV_PORT`, `DRAFT_COOKIE`, `Deferred`, `DehydratedState`, `DocumentParts`, `DraftCookieControls`, `DynamicBoundary`, `DynamicBoundaryBatch`, `EnableDraftOptions`, `FetchRouteData`, `Fetcher`, `FetcherState`, `FontDisplay`, `FontFace`, `FontPreloadInput`, `FontSource`, `GenerateClientEntryOptions`, `GenerateRouteSearchTypesOptions`, `GenerateServerManifestOptions`, `GetStaticPaths`, `HANDOVER_ID`, `HtmlSanitizer`, `IDLE_BLOCKER`, `ISRApp`, `ISROptions`, `ISRPlatform`, `ISRQuery`, `ISRStoreOp`, `ISR_REVALIDATE_HEADER`, `ISR_REVALIDATE_TAGS_HEADER`, `ISR_STATUS_HEADER`, `InertScriptType`, `InfiniteData`, `InfiniteQueryHandle`, `InfiniteQueryOptions`, `InterceptBoundary`, `KVCacheStore`, `KVCacheStoreOptions`, `KVNamespaceLike`, `LAYOUT_DATA_GLOBAL`, `LOCALES_GLOBAL`, `LayoutEntry`, `LinkDescriptor`, `Loader`, `LoaderContext`, `LoaderResponseControls`, `LoadingEntry`, `Manifest`, `MatchChain`, `MemoryCacheStore`, `MemoryCacheStoreOptions`, `MemoryStaticBoundaryCache`, `Meta`, `MetaArgs`, `MetaDescriptor`, `MetaInput`, `MiddlewareOutcome`, `MountRouterOptions`, `MutationCallbacks`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NavigateSearchOf`, `NavigateTargetInput`, `NonceContext`, `NonceGenerator`, `NonceHeader`, `NonceHeaderContext`, `NonceResolver`, `NotFoundEntry`, `NotFoundScope`, `OpenGraphInput`, `PRE_HYDRATION_GUARD`, `PageLocale`, `PageLocales`, `PendingBoundary`, `PrefetchMode`, `PrerenderedPageReaderOptions`, `PrerenderedPages`, `PreviewEndpointOptions`, `PublicDirCache`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `QueryOptions`, `QueryState`, `QueryStatus`, `REDIRECT_HEADER`, `RETAIN_HEADER`, `REVALIDATE_HEADER`, `ROOT_ATTRIBUTE`, `ROUTE_GLOBAL`, `RedirectOptions`, `RenderAdapter`, `RenderAdapterConformanceError`, `RenderAdapterConformanceFixture`, `RenderAssemblyCache`, `RenderPageInput`, `RenderPageOptions`, `RenderProps`, `RenderStreamOptions`, `RenderedPage`, `RevalidateEndpointOptions`, `RevalidateResult`, `RevalidateTags`, `RevalidateTagsInput`, `RouteEntry`, `RouteMatch`, `RouteMiddleware`, `RouteModule`, `RoutePattern`, `RouteSearch`, `RouterState`, `SERVER_FN_MODULE`, `STATUS_HEADER`, `SanitizedHtml`, `ScriptDescriptor`, `SearchOf`, `ServePublicDirOptions`, `ShouldRevalidate`, `ShouldRevalidateArgs`, `SsrModuleLoader`, `StaticBoundary`, `StaticBoundaryCache`, `StaticBoundaryImportEdge`, `StaticBoundaryRoot`, `StaticCtx`, `StaticPath`, `StaticPaths`, `StaticRoutes`, `StatusPageOptions`, `Submission`, `SubmitOptions`, `TrustedHtml`, `UIMatch`, `UnsafeScriptDescriptor`, `WebAppI18n`, `assertCssLoadingCompatible`, `assertRenderAdapterConformance`, `assertStaticBoundaryImports`, `boundaryDescriptors`, `boundaryModeKey`, `buildManifest`, `canonical`, `createClientRouter`, `createCspPolicy`, `createMatcher`, `createMutation`, `createNonceResolver`, `createQueryClient`, `createWebApp`, `defer`, `disableDraft`, `enableDraft`, `enumerateStaticRoutes`, `filePathToPattern`, `filePathToPatterns`, `fontFace`, `fontPreload`, `generateClientEntry`, `generateRouteSearchTypes`, `generateServerManifest`, `getBrowserNavigate`, `gone`, `hashQueryKey`, `isCacheablePage`, `isDraftEnabled`, `jsonLd`, `localeOfProps`, `mergeHeads`, `nifraScriptHashes`, `normalizeCssLoading`, `notFound`, `openGraph`, `pageLocaleIn`, `prerenderedPageReader`, `previewEndpoint`, `redirect`, `registerBlocker`, `renderPage`, `renderPageResult`, `resolveChainMeta`, `resolveDynamicBoundaries`, `resolveMeta`, `resolveNavigate`, `resolvePublicPath`, `resolveStaticBoundaries`, `revalidate`, `revalidateEndpoint`, `sanitizeHtml`, `sanitizedHtml`, `searchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `servePublicDir`, `setBlockerController`, `setBrowserNavigate`, `setSsrModuleLoader`, `ssrModuleLoader`, `startDynamicBoundaries`, `statusPage`, `trustHtml`, `unsafeInlineScript`, `webProjectEvidence`, `withISR`
18226
+ `ACTION_GLOBAL`, `Action`, `BOUNDARY_GLOBAL`, `BackendOnly`, `Blocker`, `BlockerController`, `BlockerFunction`, `BlockerLocation`, `BlockerState`, `Boundary`, `BoundaryDescriptor`, `BoundaryError`, `BoundaryMode`, `BoundaryRegistration`, `BoundaryRequestCtx`, `BoundaryState`, `BoundaryStates`, `BoundaryStatus`, `BrowserNavigate`, `BuildAssetSet`, `CacheStore`, `CachedResponse`, `CdnPurgeOutcome`, `CdnPurgeTarget`, `ClientAction`, `ClientActionArgs`, `ClientActionResult`, `ClientLoader`, `ClientLoaderArgs`, `ClientRequestBody`, `ClientRouteHooks`, `ClientRouter`, `ClientRouterOptions`, `CreateCspPolicyOptions`, `CreateNonceResolverOptions`, `CreateWebAppOptions`, `CspHeaderContext`, `CspPolicy`, `CssLoadingMode`, `DATA_GLOBAL`, `DATA_HEADER`, `DEFAULT_CSS_LOADING`, `DEFAULT_DEV_PORT`, `DRAFT_COOKIE`, `Deferred`, `DehydratedState`, `DocumentParts`, `DraftCookieControls`, `DynamicBoundary`, `DynamicBoundaryBatch`, `EnableDraftOptions`, `FetchRouteData`, `Fetcher`, `FetcherState`, `FontDisplay`, `FontFace`, `FontPreloadInput`, `FontSource`, `GenerateClientEntryOptions`, `GenerateRouteSearchTypesOptions`, `GenerateServerManifestOptions`, `GetStaticPaths`, `HANDOVER_ID`, `HostPolicy`, `HostPolicyOptions`, `HostPolicyRule`, `HtmlSanitizer`, `IDLE_BLOCKER`, `ISRApp`, `ISROptions`, `ISRPlatform`, `ISRQuery`, `ISRStoreOp`, `ISR_REVALIDATE_HEADER`, `ISR_REVALIDATE_TAGS_HEADER`, `ISR_STATUS_HEADER`, `InertScriptType`, `InfiniteData`, `InfiniteQueryHandle`, `InfiniteQueryOptions`, `InterceptBoundary`, `KVCacheStore`, `KVCacheStoreOptions`, `KVNamespaceLike`, `LAYOUT_DATA_GLOBAL`, `LOCALES_GLOBAL`, `LayoutEntry`, `LinkDescriptor`, `Loader`, `LoaderContext`, `LoaderResponseControls`, `LoadingEntry`, `Manifest`, `MatchChain`, `MemoryCacheStore`, `MemoryCacheStoreOptions`, `MemoryStaticBoundaryCache`, `Meta`, `MetaArgs`, `MetaDescriptor`, `MetaInput`, `MiddlewareOutcome`, `MountRouterOptions`, `MutationCallbacks`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NavigateSearchOf`, `NavigateTargetInput`, `NonceContext`, `NonceGenerator`, `NonceHeader`, `NonceHeaderContext`, `NonceResolver`, `NotFoundEntry`, `NotFoundScope`, `OpenGraphInput`, `PRE_HYDRATION_GUARD`, `PageLocale`, `PageLocales`, `PendingBoundary`, `PrefetchMode`, `PrerenderedPageReaderOptions`, `PrerenderedPages`, `PreviewEndpointOptions`, `PublicDirCache`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `QueryOptions`, `QueryState`, `QueryStatus`, `REDIRECT_HEADER`, `RETAIN_HEADER`, `REVALIDATE_HEADER`, `ROOT_ATTRIBUTE`, `ROUTE_GLOBAL`, `RedirectOptions`, `RenderAdapter`, `RenderAdapterConformanceError`, `RenderAdapterConformanceFixture`, `RenderAssemblyCache`, `RenderPageInput`, `RenderPageOptions`, `RenderProps`, `RenderStreamOptions`, `RenderedPage`, `RevalidateEndpointOptions`, `RevalidateResult`, `RevalidateTags`, `RevalidateTagsInput`, `RouteEntry`, `RouteMatch`, `RouteMiddleware`, `RouteModule`, `RoutePattern`, `RouteSearch`, `RouterState`, `SERVER_FN_MODULE`, `STATUS_HEADER`, `SanitizedHtml`, `ScriptDescriptor`, `SearchOf`, `ServePublicDirOptions`, `ShouldRevalidate`, `ShouldRevalidateArgs`, `SsrModuleLoader`, `StaticBoundary`, `StaticBoundaryCache`, `StaticBoundaryImportEdge`, `StaticBoundaryRoot`, `StaticCtx`, `StaticPath`, `StaticPaths`, `StaticRoutes`, `StatusPageOptions`, `Submission`, `SubmitOptions`, `TrustedHtml`, `UIMatch`, `UnsafeScriptDescriptor`, `WebAppI18n`, `assertCssLoadingCompatible`, `assertRenderAdapterConformance`, `assertStaticBoundaryImports`, `boundaryDescriptors`, `boundaryModeKey`, `buildManifest`, `canonical`, `createClientRouter`, `createCspPolicy`, `createHostPolicy`, `createMatcher`, `createMutation`, `createNonceResolver`, `createQueryClient`, `createWebApp`, `defer`, `disableDraft`, `enableDraft`, `enumerateStaticRoutes`, `filePathToPattern`, `filePathToPatterns`, `fontFace`, `fontPreload`, `generateClientEntry`, `generateRouteSearchTypes`, `generateServerManifest`, `getBrowserNavigate`, `gone`, `hashQueryKey`, `isCacheablePage`, `isDraftEnabled`, `isHostPolicy`, `jsonLd`, `localeOfProps`, `mergeHeads`, `nifraScriptHashes`, `normalizeCssLoading`, `notFound`, `openGraph`, `pageLocaleIn`, `prerenderedPageReader`, `previewEndpoint`, `redirect`, `registerBlocker`, `renderPage`, `renderPageResult`, `resolveChainMeta`, `resolveDynamicBoundaries`, `resolveMeta`, `resolveNavigate`, `resolvePublicPath`, `resolveStaticBoundaries`, `revalidate`, `revalidateEndpoint`, `sanitizeHtml`, `sanitizedHtml`, `searchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `servePublicDir`, `setBlockerController`, `setBrowserNavigate`, `setSsrModuleLoader`, `ssrModuleLoader`, `startDynamicBoundaries`, `statusPage`, `trustHtml`, `unsafeInlineScript`, `webProjectEvidence`, `withISR`
17667
18227
 
17668
18228
  ## @nifrajs/web-preact
17669
18229