Rebasely Beta: data may be purged

examples/storefront Public

YAML · 70 lines · 3.1 KiB · at 75e565d

components:  storefront-api:    kind: worker    description: >-      The public HTTP API (wrangler.jsonc, Worker storefront-api). Shoppers browse and search 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:      - { to: db, via: d1 }      - { to: search, via: d1 }      - { to: images, via: r2 }      - { to: stripe, via: https }      - { to: order-events, via: queue }  stripe-webhook:    kind: worker    description: >-      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:      - { to: storefront-api, via: rpc }      - { to: stripe, via: webhooks }  fulfilment:    kind: worker    description: >-      Worker storefront-fulfilment (workers/fulfilment). Consumes order-events, sends each paid      order to the warehouse's shipments API and records the shipment through OrdersService.      Failed messages retry with backoff and end in order-events-dlq after six attempts.    owns: [workers/fulfilment/**]    talks_to:      - { to: storefront-api, via: rpc }  db:    kind: d1    description: >-      The storefront database: products, carts, orders and their lines. Every schema change is a numbered      file in migrations/, applied with wrangler d1 migrations apply.    binding: DB    owns: [migrations/**]  search:    kind: d1    description: >-      Database storefront-search: an FTS5 index of the names and descriptions of active products,      for GET /search. Derived from the catalog in db, updated on every product write and refilled      by POST /admin/search/rebuild, so it can be dropped and rebuilt at any time. Kept apart from      db so search reads never queue behind checkout's writes. Schema in search/migrations/.    binding: SEARCH    owns: [search/**]  images:    kind: r2-bucket    description: >-      Bucket storefront-images: product images under products/<product>/<hash>.<ext>. A key is      never overwritten, so every image URL can be cached for a year. Public on its custom domain      (IMAGES_URL), where browsers load the images; storefront-api only writes to it.    binding: IMAGES  order-events:    kind: queue    description: >-      Queue order-events: order.paid and order.cancelled, sent by OrdersService when an order      changes state. Consumed by fulfilment (queues.consumers in its wrangler.jsonc). At least      once, so consumers dedupe by order id.    binding: ORDER_EVENTS  stripe:    kind: external    description: >-      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