examples/storefront Public
---id: local-devtype: guideowner: justindescribes: - wrangler.jsonc - workers/*/wrangler.jsonc - scripts/seed.sqlreviewed: 2026-10-16---# Running the shop locallyYou need Node 24 and, for checkout, a Stripe account in test mode. Everything else runs in wrangler's local mode.## The API```bashnpm installnpm run db:migrate # applies migrations/ and search/migrations/ to the local D1snpm run db:seed # six products, one of them out of stockecho 'ADMIN_TOKEN=dev-admin-token' > .dev.varsnpm run dev # storefront-api on localhost:8787```The seed writes straight to the database, so the search index is empty until you rebuild it:```bashcurl -X POST localhost:8787/admin/search/rebuild -H 'authorization: Bearer dev-admin-token'curl 'localhost:8787/search?q=linen'````curl localhost:8787/products` lists all six; the candle is out of stock, so adding it to a cart fails. Add `STRIPE_SECRET_KEY` (a test mode secret key) to `.dev.vars` to try checkout.Image URLs point at `IMAGES_URL` from `wrangler.jsonc`. Locally the upload works but the URL does not resolve, because the custom domain serves the production bucket ([[product-images]]). Set `IMAGES_URL` in `.dev.vars` to another origin if you want working links.## The other WorkersEach has its own config, so run it in a second terminal from the repository root:```bashnpx wrangler dev -c workers/stripe-webhook/wrangler.jsonc --port 8788npx wrangler dev -c workers/fulfilment/wrangler.jsonc --port 8789```wrangler connects the `ORDERS` service bindings to the storefront-api you started first, and the `order-events` queue between storefront-api and fulfilment. See [[payment-webhook]] for forwarding Stripe's test events and [[fulfilment]] for the warehouse settings.## CronThe unpaid order expiry runs on a cron trigger. To run it once by hand:```bashnpx wrangler dev --test-scheduledcurl 'localhost:8787/__scheduled?cron=*/5+*+*+*+*'```## TestsThe tests need none of this; see [[testing]].