TypeScript SDK

Installation & Setup

How to install and initialize `@cloudizero/sdk` across Node.js, modern web frameworks, and browser environments.

Installation

Install the package via your preferred package manager. The SDK comes pre-bundled with complete TypeScript definitions and zero heavy external runtime dependencies:

pnpm add @cloudizero/sdk

Initializing the Client

Import Cloudizero and instantiate the client with your configuration options:

lib/cloudizero.ts
import { Cloudizero } from "@cloudizero/sdk";

// Initialize the master SDK instance
export const cz = new Cloudizero({
  apiKey: process.env.CLOUDIZERO_API_KEY!,
  baseUrl: process.env.CLOUDIZERO_BASE_URL || "https://cloudizero.wismannur.pro",
  cdnUrl: "https://cdn-cloudizero.wismannur.pro", // Optional custom R2 CDN domain
});

Configuration Options (`CloudizeroConfig`)

Constructor options accepted when instantiating new Cloudizero(config):

PropertyTypeDefaultDescription
apiKey*requiredstring—Secret API Key starting with cz_live_ created from the Cloudizero console.
baseUrlstringhttps://cloudizero.comBase API URL of your Cloudizero deployment or local development server.
cdnUrlstringundefinedCustom public CDN domain for Cloudflare R2 delivery. If set, asset results will return an absolute cdnUrl.

Runtime Compatibility

@cloudizero/sdk uses standard web APIs (fetch, FormData, XMLHttpRequest / Uint8Array), making it fully compatible with:

  • Node.js 18+ (Native fetch support)
  • Next.js 14, 15 & 16 (Both Server Components and Client Components)
  • Cloudflare Workers & Vercel Edge Runtime
  • Modern Browsers (Chrome, Safari, Firefox, Edge)