Kshitij Lauria wanted his painting website to serve ready-made pages while letting him edit tags and locations through a web interface. His solution renders HTML on demand in a Cloudflare Worker and caches it for 30 days. Editing content invalidates all cached pages.

  • Store the small catalog together. One JSON file in R2 object storage holds the metadata used to render pages and initialize interactive views.
  • Resize at upload time. Lauria’s browser generates three smaller image sizes and uploads them with the originals. Known thumbnail sizes make request-time resizing unnecessary.
  • Cache the rendered result. Readers usually receive HTML through Cloudflare’s content delivery network. Maps and timelines add client-side interaction where needed.
  • Invalidate everything on edits. Tracking which tag, location or related-piece page depends on each change would introduce more ways to serve a half-updated site.

Low traffic and infrequent writes make broad invalidation a reasonable price for simpler correctness. Astro supplies the framework, but the design rests on when work happens and how cached results are retired.

A larger catalog or heavier write load would change the trade-off. For one painter sharing work with friends and family, precomputing image sizes and accepting extra page regeneration keeps the system understandable.