This guide deploys EdgeCart to your own Cloudflare account. A static docs site does not need this; this is for a self-hosted store.
Before you start
- A Cloudflare account with Wrangler authenticated:
pnpm --filter edgecart exec wrangler login. - A Workers Paid plan if you want plugin Dynamic Workers.
- A domain you can attach to the main Worker.
1. Create the D1 database
pnpm --filter edgecart exec wrangler d1 create edgecartCopy the returned database_id into:
apps/edgecart/wrangler.jsoncapps/edgecart-plugins/wrangler.jsoncapps/edgecart/workers/outbox/wrangler.jsonc
pnpm bootstrap can create the database and patch the main config for you. The
plugin and outbox configs still need the same ID.
Apply the schema to the remote database:
pnpm db:migrate:remote2. Create R2 buckets
pnpm --filter edgecart exec wrangler r2 bucket create edgecart-uploads
pnpm --filter edgecart exec wrangler r2 bucket create edgecart-plugin-bundles
pnpm --filter edgecart exec wrangler r2 bucket create edgecart-plugin-assetsThe main app uses edgecart-uploads; the plugin kernel uses
edgecart-plugin-bundles; the assets Worker uses edgecart-plugin-assets.
3. Create the queues
pnpm --filter edgecart exec wrangler queues create edgecart-outbox
pnpm --filter edgecart exec wrangler queues create edgecart-outbox-dlqThe outbox consumer retries five times before sending a message to the DLQ.
4. Set secrets
Set the main app’s secrets from apps/edgecart:
cd apps/edgecart
pnpm exec wrangler secret put BETTER_AUTH_SECRET
pnpm exec wrangler secret put TRUSTED_ORIGINS
pnpm exec wrangler secret put STRIPE_SECRET_KEY
pnpm exec wrangler secret put STRIPE_PUBLISHABLE_KEY
pnpm exec wrangler secret put STRIPE_WEBHOOK_SECRET
pnpm exec wrangler secret put PLUGIN_ASSETS_ORIGIN
pnpm exec wrangler secret put PLUGIN_ENCRYPTION_KEY
pnpm exec wrangler secret put PLATFORM_ADMIN_EMAILSAdd SMTP values and EMAIL_FROM for the outbox Worker. See
Configuration & secrets for the full list.
5. Deploy the Workers
# Main app (build + wrangler deploy)
pnpm deploy
# Plugin kernel
pnpm --filter @edgecart/plugin-kernel deploy
# Plugin assets
pnpm --filter @edgecart/plugin-assets deploy
# Outbox worker
pnpm --filter edgecart outbox:deployDeploy the plugin kernel before plugins are installed. The outbox Worker can be deployed after the main app, but webhooks and order email stay pending until it runs.
6. Attach the domain and verify
- Attach your domain to the
edgecartWorker in the Cloudflare dashboard. - Update
TRUSTED_ORIGINSto include the storefront and admin origins. - Open
/and/admin; create the first account and claim the store. - Add a product, a shipping option, and a tax rate.
- Send a test webhook and confirm a delivery attempt appears.
Production checklist
- D1
database_idmatches in all three Worker configs. - Remote migrations applied.
- R2 buckets and both queues exist.
-
BETTER_AUTH_SECRETis a strong random value. -
TRUSTED_ORIGINSlists only your origins. - Stripe keys are from the same account; webhook secret is set.
- Outbox Worker is deployed with email configuration.
- Plugin kernel and assets Workers are deployed if plugins are used.
- Workers Paid plan is active for Dynamic Workers.
- Custom domain is attached and serving.