Gateway Compile Pipeline
Overview
The Gateway Compiler turns a tenant’s API product configuration (routes, plugins, plans) into a Cloudflare Worker deployment manifest. It is triggered:
- Manually from the Control Plane admin UI.
- Automatically on route or plugin changes via the
core-platformevent queue.
Compile steps
- Fetch config — Control plane reads the tenant’s products and routes from D1.
- Build manifest —
gateway-contract-kitserialises the config into a typed manifest JSON. - Generate Worker script — A template Worker is hydrated with the manifest.
- Deploy via Wrangler API — The Worker is deployed to the tenant’s Cloudflare account (or sub-account).
- Confirm — The control plane marks the gateway version as
activein D1.
Rollback
If a new manifest causes errors, the previous version hash is stored in D1. Rollback is a single API call to the control plane that re-deploys the previous manifest.