You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.2 KiB

+++ title = "[TRIAGE] Cloudflare Workers WASM size limit — free tier 1MB limit may require paid plan for Rust binary" priority = 9 status = "done" ticket_type = "task" dependencies = [] +++

This is a triage decision ticket. It must be resolved before dependent implementation tickets can proceed. Cloudflare Workers WASM size limit: the free tier has a 1MB Worker script size limit. A Rust binary compiled for workers-rs may exceed this. Does this project require a paid Workers plan? 1. **Paid Workers plan** — removes the 1MB limit ($5/month). Simplest solution. 2. **Optimise binary size** — use `opt-level = "z"`, `lto = true`, `strip = true`, `wasm-opt`, and minimise dependencies. May bring the binary under 1MB. 3. **Split the Worker** — serve static assets from Pages and keep the Worker API-only (fewer dependencies). **The 1 MB limit in this ticket is outdated.** The current Cloudflare Workers limits (as of 2026) are: - Workers Free: **3 MB after gzip compression**, 64 MB before compression - Workers Paid: **10 MB after gzip**, 64 MB before compression

Chosen approach: Free tier + binary size optimisation (no paid plan required).

Rationale:

  • The API Worker only handles API routes — no Yew/UI code is bundled into it (UI is on Pages).
  • The database layer uses workers-rs native D1 bindings (not SQLx) per ticket e8a330 — this eliminates a heavy dependency.
  • The Cargo.toml release profile already has opt-level = "z", lto = true, strip = true, codegen-units = 1.
  • wrangler applies wasm-opt automatically during deploy, further reducing WASM size.
  • A simple CRUD API with these optimisations gzips well under 3 MB.
  • Verification command: wrangler deploy --outdir bundled/ --dry-run (shows gzip: X KiB).

Implementation ticket created: see ticket for binary size verification after Cargo.toml dependencies are added (1f5bb5).

If the binary somehow exceeds 3 MB, fallback options are: further dependency pruning, or Workers Paid at $5/month.

`chore(quotesdb): resolve triage — cloudflare-workers-wasm-size-limit-free-tier-1mb-limit-may-r`