EdgeCart deploys as a small set of Cloudflare Workers that share one D1 database. The main Worker serves the storefront, the admin, and the API; the plugin and outbox Workers handle work that should not run in the request path.
Workers
| Worker | Responsibility |
|---|---|
edgecart |
Storefront, admin, Hono API, Better Auth, D1 access, image uploads. |
edgecart-plugins |
Plugin kernel: releases, installs, settings, and Dynamic Worker execution. |
edgecart-plugin-assets |
Serves plugin assets from R2 with strict content and framing rules. |
edgecart-outbox |
Queue consumer for webhooks, email, and async plugin hooks; runs a one-minute cron. |
Bindings on the main Worker
| Binding | Type | Use |
|---|---|---|
DB |
D1 | Commerce, auth, plugin control-plane, and outbox data. |
UPLOADS |
R2 | Product and store images. |
OUTBOX_QUEUE |
Queue producer | Writes events for the outbox worker. |
PLUGIN_KERNEL |
Service binding | Calls the plugin kernel over RPC. |
| Rate limiters | Cloudflare rate limiting | Basic (100/min) and strict (3/min) route limits. |
The plugin kernel has its own DB (the same D1 database), an R2 bucket for
plugin bundles, and a LOADER binding for Dynamic Workers. Dynamic Workers
require the Workers Paid plan in production.
Request flow
Browser
│
├─ / → storefront shell → Storefront API → D1
├─ /admin → admin console → Admin API → D1
└─ /api/* → Hono routes → commerce packages → D1
│
├─ R2 (uploads)
├─ Queue (outbox)
└─ Service binding (plugin kernel)- The storefront loads
/api/storefront-configfirst to get the store profile, locale, region, and publishable key, then calls the keyed Store API. - Admin requests carry the Better Auth session cookie and an
x-store-idheader. - Mutations write audit and outbox rows in the same transaction; the outbox worker delivers webhooks, email, and plugin hooks asynchronously.
Commerce packages
Commerce behavior is split into narrow packages with an enforced dependency direction:
commerce-core
├─ commerce-sales, commerce-catalog
├─ commerce-cart, commerce-storefront
├─ commerce-orders
├─ commerce-payments
├─ commerce-order-changes
└─ commerce-observabilityThe public Commerce modules section explains each domain; the
package boundaries page covers the implementation
rules. packages/commerce is a compatibility facade for existing imports.
What runs where
- Request path — the main Worker and the commerce packages. No plugin code runs in the main Worker.
- Plugin execution — the plugin kernel invokes a plugin bundle in a Dynamic Worker; the host validates and applies the result.
- Background work — the outbox worker consumes the queue on a one-minute cron and on queue delivery.