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, d1 | ✅ Shipped |
| Web essentials | http, request | 🚧 Beta target |
| Messaging & Compute | queues, do, cache, rpc, cron, workflows | Planned |
| Security & auth | access, turnstile, ratelimit | Planned |
| AI & Data | ai, vectorize, hyperdrive, ai-gateway | Planned |
| Integrations | email, analytics, images | Planned |
| REST API client | api | Planned |
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.
- Roadmap — what ships when.
Project
- Source: github.com/rtorcato/cf-common
- npm: @rtorcato/cf-common
- License: MIT
- Issues: GitHub Issues