Skip to content

Example app

dev/examples/commerce is a small storefront plus JSON API. It exists so you can click every binding without writing a Worker first.

Seed it

bash
./dev/scripts/reset.sh   # optional, clean slate
./dev/scripts/up.sh
./dev/scripts/seed-commerce-store.sh
  • Storefront: use preview_url from API or Dashboard (e.g. http://v1.commerce-store.ingress.local:8787/) — see Preview
  • Dashboard: http://127.0.0.1:5190/projects/commerce-store

Bindings used

Declared in wrangler.jsonc; used from index.js. Copy those two files as a template. How to declare your own: Configure bindings. How to seed: Platform data.

BindingIn the app
D1Products, orders, inventory, audit log
KVCart + store banner
QueueFulfillment after checkout
WorkflowRevenue report
R2Text asset uploads
CronHourly heartbeat written to KV (prod only)

HTTP surface

MethodPathPurpose
GET/Interactive UI
GET/healthLiveness
GET/statsRow counts
GET / POST/api/productsCatalog
POST/api/ordersPlace order (D1 + queue)
GET / PUT/api/kv/cartKV cart
GET / PUT/api/kv/bannerKV banner
POST/api/queue/enqueueManual queue message
POST/api/workflow/reportStart workflow
POST/api/r2/uploadUpload a text object

What to try

  1. Add a product and place an order on the storefront.
  2. Open Dashboard → Storage → D1 and see the new rows.
  3. Deploy a child version: copy wrangler.jsonc (+ index.js / storefront.js) to dev/data/artifacts/commerce-store/<new-id>/, then POST /versions with "parent_version_id":"v1". Confirm preview data forked while v1 stayed put. simulate-cd.sh cannot do this (it always posts parent_version_id: null).
  4. Later versions need promote before the prod Host serves them. The first ready version is already production.

This example is the fastest way to feel “App + Data, same version.”

Self-hosted Workers control plane. Not affiliated with Cloudflare or Vercel.