Files
mizan/docs/PSR_VS_EDGE.md

48 lines
1.7 KiB
Markdown

# PSR vs Edge Delivery
Two distinct layers that prior conversations have conflated. They are
independent.
## 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.
> Current state: the Edge manifest records each context's
> `render_strategy` (`"psr"` for public, `"dynamic_cached"` for
> user-scoped) — see `mizan/export/` and the `export_edge_manifest`
> management command — and the SSR bridge can render a component to
> HTML. The render-on-mutation orchestration that wires those together
> (mutation → trigger local render → store HTML) is not yet present in
> the open-source backends; it is the manifest-driven behavior the
> Edge layer consumes.
## 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 must not couple to Cloudflare-specific APIs. PSR must work
without any cloud infrastructure. Edge delivery extends PSR; it does
not replace it.