every.channel/evolution/proposals/ECP-0044-cloudflare-workers-static-site.md
2026-02-15 16:17:27 -05:00

34 lines
1.3 KiB
Markdown

# ECP-0044: Cloudflare Workers Static Site Deployment
## Why
We want a fast, globally cached, no-backend website at `every.channel` that:
- serves the viewer UI (PWA-capable),
- can be deployed reproducibly from this repo,
- does not require a centralized application server.
Cloudflare Workers + static Assets gives us:
- global edge caching and TLS,
- a simple deploy story (`wrangler deploy`),
- the option to add small edge logic later (redirects, headers, SPA fallback).
## Proposal
- Treat `apps/tauri/ui` as the canonical website source (Dioxus web build).
- Treat `apps/tauri/dist` as the deployment artifact.
- Add a Cloudflare Worker project under `deploy/cloudflare-worker/` that serves `apps/tauri/dist`.
- Implement SPA fallback: if an asset path 404s, serve `/index.html`.
- Keep deployment logic in a script:
- build: `trunk build --release`
- deploy: `wrangler deploy`
## Scope (initial)
- One worker that only serves static assets + SPA fallback.
- No API, no auth, no server-side state.
- Domain mapping to `every.channel` is declared in `wrangler.toml` via Workers Custom Domains.
- This requires appropriate Cloudflare account permissions for `wrangler deploy` to attach the domain.
## Reversibility
High. The worker is a thin wrapper over static assets. We can migrate to Pages, another CDN, or self-hosted static with minimal changes.