Files
mizan/docs/PSR_VS_EDGE.md
Ryth Azhur e00b3a177e Docs carry the shape of the system, not its status
MIZAN.md's phase-numbered implementation order, PRODUCT_ARCHITECTURE's
"Deferred until Render revenue funds it" and "Shipped in", PSR_VS_EDGE's
current-state section, and the READMEs' passing-test counts were all reporting
where the work stood rather than what the system is. OWED_SURFACE keeps its
subject — surface that is specified but unbuilt — stated as the shape each unit
owes.

The channel sections follow the renamed slots: Params / ClientMessage /
ServerMessage, and Channel as the base class on both backends.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 14:03:29 -04:00

48 lines
1.7 KiB
Markdown

# PSR vs Edge Delivery
Two distinct layers. They are independent, and conflating them
misreads both.
## PSR — Preemptive Static Rendering
**Protocol feature.** Render HTML on mutation, not on request.
Mechanism: `@client` fires mutation → backend adapter triggers local
render runtime → HTML stored locally.
Works on a $5 VPS with local Bun. **No Edge required.** PSR is part
of the protocol; it's available to every Mizan deployment regardless
of hosting.
The strategy is manifest-driven rather than hand-wired per view. The
Edge manifest records each context's `render_strategy``"psr"` for
public contexts, `"dynamic_cached"` for user-scoped ones — emitted by
`mizan/export/` and the `export_edge_manifest` management command.
The render-on-mutation path reads that field to decide whether a
mutation triggers a local re-render or only a purge, and the SSR
bridge is what turns a component into HTML once it does. The Edge
layer consumes the same field for the same decision.
## Edge Delivery — Mizan Render (Paid Product)
Pre-rendered HTML cached globally on Cloudflare CDN.
Uses `fetch()` to a render Worker on a separate domain
(`render.mizan.cloud`) instead of `cache.put()`, because Workers
Cache API is per-datacenter only. `fetch()` across zones goes through
the global CDN cache path with Tiered Cache.
This layer is the paid Mizan Render product.
## Caching modes
- **Public content** — preemptive (render on mutation)
- **User-scoped content** — reactive only (purge on mutation, render
on next request)
## Invariant
PSR logic does not couple to Cloudflare-specific APIs. PSR works
without any cloud infrastructure. Edge delivery extends PSR; it does
not replace it.