High-Level Components
- Web Layer: Astro static pages for marketing, docs, pricing, and demo navigation.
- API Layer: Pages Functions under
functions/api/*. - Persistence: D1 for products, orders, deliveries, and download tracking.
- Artifact Storage: R2 bucket for source package assets delivered to paid users.
- Third-Party Services: PayPal payment APIs and optional Resend email delivery.
Runtime Boundaries
- Public pages are static and served from
dist. - Business operations execute in Pages Functions runtime.
- Sensitive values remain in runtime bindings/environment variables.
- No client-side secret handling for payment capture or artifact access.
Core Request Flows
- User initiates checkout via pricing page.
/api/checkout creates payment order and writes pending order record in D1. - After return,
/api/paypal/capture confirms payment and creates delivery token. - Optional delivery email is sent with secure download URL.
/api/download validates token, reads package from R2, and updates download counters.