examples/storefront Public
Architecture
From .rebasely/architecture/system.yaml at 94db762: 4 components, 4 connections in this view.
Everything a checkout touches, from the cart to the charge.
Select a component to see what it talks to.
storefront-api
The public HTTP API (wrangler.jsonc, Worker storefront-api). Shoppers browse the catalog, fill carts and check out; the merchant edits products and uploads their images with the admin token. Its OrdersService entrypoint is how the other Workers change orders: it is the only Worker with the database binding. A cron trigger expires unpaid orders every five minutes.
- Owns
- src/**
- Talks to
- db (d1), stripe (https)
- Used by
- stripe-webhook (rpc)
Components
- storefront-api Worker
The public HTTP API (wrangler.jsonc, Worker storefront-api). Shoppers browse the catalog, fill carts and check out; the merchant edits products and uploads their images with the admin token. Its OrdersService entrypoint is how the other Workers change orders: it is the only Worker with the database binding. A cron trigger expires unpaid orders every five minutes.
- Owns
- src/**
- Talks to
- db (d1), stripe (https)
- Used by
- stripe-webhook (rpc)
- stripe-webhook Worker
Worker storefront-stripe-webhook (workers/stripe-webhook). Verifies Stripe's webhook signatures and settles the order of each PaymentIntent through OrdersService.
- Owns
- workers/stripe-webhook/**
- Talks to
- storefront-api (rpc), stripe (webhooks)
- db D1 database
The storefront database: products, carts, orders and their lines. Every schema change is a numbered file in migrations/, applied with wrangler d1 migrations apply.
- Owns
- migrations/**
- Binding
- DB
- Used by
- storefront-api (d1)
- stripe External
Stripe, through the stripe npm package. storefront-api creates a PaymentIntent per order with the secret key; the shopper confirms it in the browser with the Payment Element, and Stripe reports the outcome to stripe-webhook.
- Package
- stripe
- Used by
- storefront-api (https), stripe-webhook (webhooks)