cf-common
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
anyat 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-commonRequirements: 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.
| Area | Modules | Status |
|---|---|---|
| Foundations | errors, env | ✅ Shipped |
| Storage | kv, r2, r2-presign, d1, cache | ✅ Shipped |
| Web essentials | http, request, assets | 🚧 Beta target (assets shipped) |
| Messaging & Compute | queues, do, ws, rpc, cron, workflows | Planned (queues, do, ws, rpc, cron, workflows shipped) |
| Security & auth | access, turnstile, ratelimit | Planned (access, ratelimit, secrets shipped) |
| AI & Data | ai, vectorize, hyperdrive, ai-gateway | Planned (ai, vectorize, hyperdrive, ai-gateway shipped) |
| Integrations | email, analytics, images, browser, pipelines | Planned (email, analytics, images, browser, pipelines shipped) |
| REST API client | api | ✅ Shipped |
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
anyin public APIs. Generic helpers preserve narrow types through the call.
Next steps
- Getting started — install and wire your first binding.
- Examples — KV caching, R2 uploads, D1 queries, and a runnable Worker.
- Roadmap — what ships when.
Project
- Source: github.com/rtorcato/cf-common
- npm: @rtorcato/cf-common
- License: MIT
- Issues: GitHub Issues