Plugins let you extend EdgeCart without running code inside the main Worker. A plugin is a signed JavaScript bundle that executes in a Dynamic Worker sandbox and talks to the host through a narrow bridge.
How a plugin runs
- A publisher signs a bundle and publishes a release.
- An operator reviews and approves the release in the plugin registry.
- A merchant installs it with full-capability consent.
- The kernel invokes the plugin for its declared hooks.
- The host validates every result and recalculates totals; the plugin never supplies a trusted total.
The plugin code runs in the edgecart-plugins Worker with its own D1 access,
R2 bundle bucket, and LOADER binding. The main app reaches it through the
PLUGIN_KERNEL service binding. Dynamic Workers require the Workers Paid plan
in production.
What a plugin can do
| Surface | How it works |
|---|---|
| Cart and checkout | Synchronous hooks such as cart:calculate and checkout:validate propose adjustments or decisions. |
| Orders and refunds | Async action hooks (order:created, order:paid, refund:created) delivered through the outbox. |
| Admin UI | Declarative Block Kit pages and order panels rendered by the host. |
| Storefront | Declarative blocks in fixed slots, plus iframes and forms. |
| Storage and settings | Per-install settings (including encrypted secrets) and key-value storage. |
| Network | ctx.http.fetch with host allow-lists and secret-header injection. |
Read next
- Build your first plugin — the loyalty discount example from manifest to install.
- Plugin manifest — every field and the bundle contract.
- Capabilities and hooks — the full permission and hook reference.
- PluginContext — the API available inside a plugin.
- Settings, secrets and storage.
- Admin UI with Block Kit.
- Storefront slots and blocks.
- CLI and registry publishing.