2.3 Deployment & Cloudflare Integrations

“Redundant processing is a failure of architecture.” — Standard Technical Directives, 2026

The @stnd/cloudflare package governs the deployment phase and edge-level integrations. It ensures that Astro applications adhere strictly to Cloudflare Pages specifications while eliminating unnecessary build-time processing.

1. Automated Function Provisioning

Cloudflare Pages expects auxiliary backend routes (such as publication APIs or external webhooks) to reside within a specific /functions directory at the project root.

To maintain the integrity of the Vertical Slice Architecture—where all code must remain inside packages/modules/—the @stnd/cloudflare package implements a build-time hook (astro:build:done).

Execution Protocol:

  1. Upon successful completion of the Astro build process, the integration automatically scans the modules.
  2. It detects defined edge API endpoints.
  3. It provisions the root /functions/api directory by seamlessly copying the requisite handlers.
  4. This ensures that the developer experience remains encapsulated within the src directory, while fulfilling Cloudflare’s rigid deployment requirements.

2. Edge Image Optimization

Traditional static site generators perform heavy image processing (resizing, WebP conversion via Sharp) during the build phase or server-side. This is classified as a gross inefficiency.

The Standard Framework strictly delegates all image transformations to Cloudflare’s native Image Resizing API (CDN-level).

Architectural Benefits

Implementation

The <CloudflareImage> and <CloudflarePicture> components generate specific URL structures (/cdn-cgi/image/width=...) that automatically trigger edge transformations. Do not attempt to bypass this protocol with custom Node.js image libraries.

Are you absolutely sure?

This action cannot be undone.