Installation
The Cloudflare TypeScript SDK is available on npm and can be installed using your preferred package manager.Package managers
Requirements
Before installing the SDK, ensure your environment meets these requirements:TypeScript version
TypeScript >= 4.5 is required for full type safety and modern language features.Runtime environment
The SDK supports the following JavaScript runtimes:- Node.js: 18 LTS or later (non-EOL versions)
- Deno: v1.28.0 or higher
- Bun: 1.0 or later
- Browsers: Up-to-date Chrome, Firefox, Safari, Edge, and more
- Cloudflare Workers: All versions
- Vercel Edge Runtime: All versions
- Jest: 28 or greater with the
"node"environment - Nitro: v2.6 or greater
Package information
The installed package includes:- Full TypeScript type definitions
- CommonJS and ES Module builds
- Tree-shakeable exports for optimal bundle size
- Runtime-specific shims for Node.js, Deno, Bun, and browsers
Package details
Runtime-specific configuration
Using web fetch in Node.js
By default, the SDK usesnode-fetch in Node.js environments. If you prefer to use the global web-standard fetch function (available with --experimental-fetch or in frameworks like Next.js), add this import before importing the SDK:
Using Node.js fetch explicitly
To explicitly use Node.js polyfills (which does import polyfills), use:Bundle size
The SDK is optimized for minimal bundle size with tree-shaking support. The minified and gzipped size is shown in the npm badge on the GitHub repository.Verifying installation
After installation, verify the SDK is working by running a simple test:Next steps
Quick start
Make your first API call in minutes
Authentication
Set up your API credentials