Skip to main content

cf-common

CI License: MIT

Typed TypeScript wrappers and helpers for working with Cloudflare bindings and APIs — in the spirit of js-common and browser-common.

Each module is a thin, well-typed convenience layer over a Cloudflare service — not a framework. Tree-shakeable subpath exports, zero required runtime dependencies.

  • Typed end-to-end — strict types over every binding; no any at the edges.
  • Tree-shakeable — named subpath exports; import only the service you use.
  • Thin, not a framework — a convenience layer, never a wrapper you fight.
  • Workers-native — pure helpers over the runtime APIs you already have.

Install

npm install @rtorcato/cf-common

Requirements: a Cloudflare Workers project (Wrangler). TypeScript ≥ 5.0 is recommended — every public API ships with strict types and JSDoc.

Status

Foundations and storage are published; the rest land incrementally — track progress in the roadmap, the Beta milestone, and the issues list.

AreaModulesStatus
Foundationserrors, env✅ Shipped
Storagekv, r2, d1✅ Shipped
Web essentialshttp, request🚧 Beta target
Messaging & Computequeues, do, cache, rpc, cron, workflowsPlanned
Security & authaccess, turnstile, ratelimitPlanned
AI & Dataai, vectorize, hyperdrive, ai-gatewayPlanned
Integrationsemail, analytics, imagesPlanned
REST API clientapiPlanned

See the API Reference for the shipped modules.

Design principles

  • Thin over a service, never a framework. Each module covers one Cloudflare binding. If something needs heavy machinery, reach for a dedicated library.
  • Subpath imports are the contract. You always import from @rtorcato/cf-common/<module> so tree-shaking is automatic.
  • Strict TS, no implicit any in public APIs. Generic helpers preserve narrow types through the call.

Next steps

Project