Files
mizan/docs/PRODUCT_ARCHITECTURE.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

60 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Product Architecture
Mizan's surface splits into a free framework and two paid products.
The split is drawn along one line: what runs on the developer's own
infrastructure versus what Mizan operates for them.
## Mizan Render — paid
**$20/seat/month.**
Protocol-aware Edge caching + PSR delivery via Cloudflare + render
Workers + TS backend hosting via Workers for Platforms.
The developer's stack is their backend + database. Cloudflare handles
read traffic, rendering, and caching. The compliance surface is
entirely Cloudflare Workers plus a management API (Django/Postgres):
- GDPR DPA + privacy policy + subprocessor list — ~$5001K legal
- DMCA — $6
- No NIS2, no gVisor, no KMS
## Mizan Deploy — paid, IaaS-shaped
Django hosting is a different product because it is a different
compliance surface: gVisor, KMS, NIS2, multi-state privacy, ~$58K
legal. Hosting a customer's Python process is IaaS; serving cached
HTML from a CDN is not.
TS "Deploy" is the Workers-for-Platforms case, which carries no
additional compliance cost — it falls inside Render's surface rather
than Deploy's.
## Origin-side cache (`mizan.cache`) — free
`mizan_core.cache` (re-exported as `mizan.cache` from the Django
adapter) implements the **full cache protocol locally** — the same
HMAC key derivation and purge semantics as Edge.
Two backends behind a `CacheBackend` protocol:
- `MemoryCache` — in-memory dict (testing)
- `RedisCache` — production
This carries two consequences: the free framework is complete on its
own (PSR + typed hooks + invalidation + caching at zero cost), and
every cache mechanic is unit-testable without Cloudflare in the loop.
## Spec surface
- `@client(cache=False)` — uncacheable; emits `Cache-Control: no-store`.
- Cache ABI (`mizan.cache`): `cache_get(secret, backend, context, params)`,
`cache_put(...)`, `cache_purge(backend, context, params=…, secret=…)`.
## Invariant
The paid surface is Cloudflare-shaped and the free surface depends on
nothing Cloudflare provides. The origin cache implements the protocol
in full locally, so Edge is an accelerator over a complete framework,
never a missing piece of one.