OpenAPI spec → Cloudflare Worker service binding.
capa generates deployable Workers from OpenAPI specs, so another Worker can call them through a service binding instead of hand-writing an API wrapper.
Every method returns the upstream result plus a JSON evidence bundle:
const { result, evidence } = await env.STRIPE.charges.create({ amount: 1000, currency: "usd", source: "tok_visa", }); if (evidence.verdict === "fail") { return Response.json({ error: "verification failed", evidence }, { status: 502 }); } return Response.json({ chargeId: result.id, evidence });
Bindings are generated from OpenAPI specs. The hand-written layer is src/index.ts plus optional evidence overrides in src/overrides.ts.
Repo
| Path | Purpose |
|---|---|
SPEC.md |
Method, evidence, and capability contract |
tools/codegen/ |
OpenAPI -> capability generator |
capabilities/<name>/capa.manifest.json |
Generated capability metadata |
capabilities/<name>/src/generated/ |
Generated binding code |
capabilities/<name>/src/index.ts |
Worker entrypoint |
capabilities/<name>/src/overrides.ts |
Per-method evidence overrides |
tests/harness/ |
Real capability smoke-test Worker |
docs/ |
Expanded docs site |
Generated bindings
| Capability | Operations | Namespaces | Auth | Body |
|---|---|---|---|---|
| blooio | 54 | 8 | bearer | json |
| box | 294 | 56 | bearer | json |
| discord | 233 | 16 | bearer | json |
| github | 1,182 | 36 | bearer | json |
| gitlab | 1,047 | 51 | private-token | json |
| jira | 601 | 76 | basic | json |
| kubernetes | 1,111 | 6 | bearer | json |
| sentry | 209 | 6 | bearer | json |
| slack | 174 | 174 | bearer | form |
| stripe | 534 | 73 | bearer | form |
| twilio-messaging | 58 | 5 | basic | form |
| twilio-verify | 57 | 5 | basic | form |
| twilio | 197 | 2 | basic | form |
| twitch | 144 | 30 | bearer | json |
| zoom | 155 | 14 | bearer | json |
Validate
bun install bun run check
bun run check is the fast, credential-free gate: regenerate known specs, typecheck every capability + harness, and run wrangler deploy --dry-run for every Worker. Live API smoke tests are opt-in via tests/harness/.
A weekly GitHub Action also runs bun run spec:watch. It only fetches and hashes registered upstream OpenAPI specs; if one changed, the action fails with a Markdown report artifact so a maintainer can regenerate deliberately.
Use a binding
Deploy a capability, set its upstream secret, then bind it from another Worker.
cd capabilities/stripe
wrangler secret put STRIPE_API_KEY
wrangler deployconst { result, evidence } = await env.STRIPE.charges.create({ amount: 1000, currency: "usd", source: "tok_visa", });
Generate a binding
You can generate a binding locally and keep it private. If the API is broadly useful, contributions to this repo are welcome. Maintainers can also use Actions → Add Capability to feed a new public spec into main and get a generated capability scaffold.