Skip to content

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:

  1. Manually from the Control Plane admin UI.
  2. Automatically on route or plugin changes via the core-platform event queue.

Compile steps

  1. Fetch config — Control plane reads the tenant’s products and routes from D1.
  2. Build manifestgateway-contract-kit serialises the config into a typed manifest JSON.
  3. Generate Worker script — A template Worker is hydrated with the manifest.
  4. Deploy via Wrangler API — The Worker is deployed to the tenant’s Cloudflare account (or sub-account).
  5. Confirm — The control plane marks the gateway version as active in 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.