Skip to content

Request Path

Layer sequence

Consumer → Edge API Gateway Worker
→ Plugin chain (auth, rate-limit, transform)
→ Upstream API
→ Response transform
→ Consumer

Within a Worker

route → handler → service → repository → D1 / KV
  • Route: HTTP path + method wiring only
  • Handler: validate input, call service, return JSON
  • Service: business logic and orchestration
  • Repository: Drizzle queries against D1 or KV reads

Inter-service calls

Workers call each other using trust-kit HMAC-signed internal requests over fetch(). No public internet hop.

Auth flow

  1. Consumer sends Authorization: Bearer <api-key>
  2. Gateway verifies key against core-platform KV cache
  3. On miss, calls core-platform /internal/api-keys/verify
  4. Result is cached in KV with 60s TTL