AstroBaaS

Integrations & channels

CDN Integration

Paid pluginsize Mplanned, not built

Indicative price, not an offer: €34/mo; credential: we manage CDN (Cloudflare/Fastly), cache optimization

Generated from docs/plan/paid/cdn-integration/PLAN.md in the AstroBaaS repository. Nothing described below is implemented — it is the written plan for it.

Merchants accelerate image delivery globally by integrating with a CDN (Cloudflare, Fastly). Product images, storefronts, and static assets are cached at edge locations, improving performance for customers in Australia, Asia, and other distant regions. The paid pack manages CDN configuration, cache keys, and purge strategies; core owns the asset URL interface.

The problem

Customers in Australia or Asia experience slow image loads when servers are in Greece. A CDN is needed, but integration requires configuration expertise and ongoing cache management.

What it does

  • CDN provider integration: Cloudflare or Fastly (merchant chooses)
  • Image serving: all product images (catalog, detail pages) served from CDN
  • Asset caching: CSS, JavaScript, fonts cached at edge for 30 days
  • Cache key optimization: URLs include cache-busting params (version hash) so updates bypass old cache
  • Purge on update: when product image is updated in AstroBaaS, CDN cache is purged within 5 minutes
  • Edge functions: optional support for image resizing at edge (resize on-demand for mobile, tablet, desktop)
  • Analytics: admin sees CDN hit rate, bandwidth savings, cache efficiency
  • Test mode: validate CDN setup without affecting production

What it deliberately does NOT do

Each boundary carries its reason. A boundary without a reason gets crossed by the next person who reads this.

  • Video hosting: videos are served from video CDN (Cloudinary, Mux); not part of image CDN.
  • Dynamic content caching: HTML pages are not cached (each user needs personalized content); only static assets.
  • DDoS protection: CDN provides some DDoS mitigation, but full protection requires additional config (not AstroBaaS).
  • SSL/TLS management: CDN provides SSL; certificate management is CDN’s responsibility.

Data model

New setting: cdn_provider (string: cloudflare or fastly), cdn_api_key (encrypted), cdn_zone_id (string). New document: cdn_cache_event { assetUrl, action (cached, purged), timestamp }.

API

  • POST /api/cdn/config { provider, apiKey, zoneId } (admin only)
  • GET /api/cdn/status -> { provider, connected, lastPurge, hitRate, bandwidthSaved }
  • POST /api/cdn/purge-all (admin only, clears entire cache)
  • POST /api/cdn/purge-url { url } (admin only, clears one URL)
  • GET /api/cdn/analytics?from=2026-09-01&to=2026-09-03 (admin only)

Every route added here must also appear in src/pages/openapi.json.ts — a test fails the build if it does not.

Admin

Admin sees: CDN connection status, provider (Cloudflare/Fastly), cache hit rate, bandwidth savings (GB), purge history, cache efficiency graph, edge function status.

The seam — why this is paid

Core owns the asset URL interface and cache invalidation. Paid pack owns: CDN provider integration (Cloudflare/Fastly), cache key strategy, edge function deployment.

Support commitment: CDN configuration, cache-key optimization, edge-function support

Dependencies

  • asset subsystem (existing; serves images and static files)

Acceptance checks

Each of these must be able to fail. Before claiming this is done, break the code deliberately and watch each one go red.

  • Admin configures Cloudflare zone; images are served from cdn.example.com (CNAME setup)
  • A customer in Australia loads product images in under 2 seconds (vs. 5 seconds without CDN)
  • Admin analytics show 70% cache hit rate; bandwidth saved is 500 GB/month
  • Product image is updated in AstroBaaS; CDN cache is purged within 5 minutes
  • Admin clicks ‘Purge all’; entire cache is cleared; next request is slow (uncached)
  • Edge function resizes image to 300px for mobile; desktop gets full-size from cache

Risks

If CDN API key is logged unencrypted, attacker can purge cache or modify rules. If cache-busting is not used, old images are shown for days. If cache purge is not atomic, some customers see old image while others see new. If CDN is misconfigured, all images 404 (outage). If bandwidth limit is hit, overages are charged unexpectedly.

Commercial context

Suggested price€34/mo; credential: we manage CDN (Cloudflare/Fastly), cache optimization
Rival anchorCloudflare: €20-200/mo; Fastly: €50-500/mo; custom: €2000+

The anchor is what the nearest equivalent charges on Shopify or Magento today. It is context for a pricing decision, not the decision.


Generated from the commerce plan. See docs/COMMERCE-PLAN.md for the full catalogue and ../../AI-GUIDE.md for how to work on this repository.