Platform Entries
Rezo provides six platform-specific entry points, each preconfigured with the optimal HTTP adapter for that runtime. Instead of auto-detecting your environment at import time, you pick the right entry point and get a client that is tuned for your platform with no unnecessary code.
Available Platforms
| Platform | Import Path | Adapter | Best For |
|---|---|---|---|
| Node.js | rezo/platform/node | HTTP (native http/https) | Server applications, CLIs, scripts |
| Bun | rezo/platform/bun | HTTP (Bun’s Node.js compat) | Bun server applications |
| Deno | rezo/platform/deno | HTTP (Deno’s Node.js compat) | Deno server applications |
| Browser | rezo/platform/browser | Fetch (native fetch) | SPAs, web applications |
| React Native | rezo/platform/react-native | React Native adapter | Mobile applications |
| Worker | rezo/platform/worker | Fetch (native fetch) | Edge functions, Cloudflare Workers |
Node.js
The Node.js entry uses the native HTTP adapter, which provides the most features:
import rezo, { Rezo, RezoError } from 'rezo/platform/node';
// Default instance (ready to use)
const { data } = await rezo.get('https://api.example.com/users');
// Custom instance
const client = new Rezo({
baseURL: 'https://api.example.com',
timeout: 5000,
});
const users = await client.getJson('/users'); Node.js Adapter Features
- Cookie jar integration with automatic persistence
- Proxy support (HTTP, HTTPS, SOCKS4, SOCKS5)
- Streaming responses with backpressure handling
- Compression (gzip, deflate, brotli, zstd)
- Upload/download progress tracking
- TLS/SSL configuration and certificate pinning
- Socket telemetry and connection reuse
- HTTP/2 support (via separate
rezo/adapters/http2import)
Bun
The Bun entry also uses the HTTP adapter, leveraging Bun’s Node.js compatibility layer:
import rezo, { Rezo, RezoError } from 'rezo/platform/bun';
const { data } = await rezo.get('https://api.example.com/users');
const client = new Rezo({
baseURL: 'https://api.example.com',
timeout: 5000,
}); Bun Advantages
- Full Node.js
http/httpssupport - BoringSSL backend produces Chrome-like TLS fingerprints (great for stealth)
- Cookie jar integration
- Proxy support
- Streaming and compression
Deno
The Deno entry uses the HTTP adapter via Deno’s Node.js compatibility:
import rezo, { Rezo, RezoError } from 'rezo/platform/deno';
const { data } = await rezo.get('https://api.example.com/users'); Note: Deno requires --allow-net permission for network access.
Deno Features
- Cookie jar integration
- Proxy support (HTTP/HTTPS/SOCKS)
- Streaming responses
- Compression (gzip, deflate, brotli, zstd)
- Upload/download progress
Browser
The browser entry uses the Fetch adapter for minimal bundle size:
import rezo, { Rezo, RezoError } from 'rezo/platform/browser';
const { data } = await rezo.get('https://api.example.com/users');
const client = new Rezo({
baseURL: 'https://api.example.com',
timeout: 5000,
}); Browser Adapter Features
- Native
fetchAPI with modern browser support AbortControllertimeout support- Automatic content-type handling
- CORS support
- Minimal bundle size (no Node.js APIs)
React Native
The React Native entry uses a dedicated adapter optimized for mobile:
import rezo, { Rezo, RezoError } from 'rezo/platform/react-native';
const { data } = await rezo.get('https://api.example.com/users');
const client = new Rezo({
baseURL: 'https://api.example.com',
timeout: 5000,
}); React Native Adapter Features
- Optimized for React Native environment
- Manual cookie header handling (no native jar in RN)
react-native-fsdownload support (optional)- Platform-specific guards (iOS/Android)
- FormData and file upload support
Worker (Edge)
The worker entry uses the Fetch adapter for edge runtimes:
import rezo, { Rezo, RezoError } from 'rezo/platform/worker';
export default {
async fetch(request: Request): Promise<Response> {
const { data } = await rezo.get('https://api.example.com/data');
return new Response(JSON.stringify(data));
},
}; Edge Runtime Features
- Native
fetchAPI (edge-compatible) AbortControllertimeout support- Automatic content-type handling
- No Node.js APIs required
- Minimal cold start overhead
Compatible with: Cloudflare Workers, Vercel Edge Functions, Deno Deploy, Netlify Edge Functions.
What Each Entry Exports
Every platform entry exports the same set of symbols:
// Default export: pre-configured instance
export default rezo;
// Classes
export { Rezo, RezoError, RezoErrorCode };
export { RezoHeaders, RezoFormData, RezoCookieJar, Cookie };
export { createDefaultHooks, mergeHooks };
// Utilities
export { isRezoError, isCancel, Cancel, CancelToken, all, spread };
// Version
export { VERSION };
// Types
export type {
RezoInstance, RezoResponse, RezoDefaultOptions,
RezoRequestConfig, RezoConfig, HttpMethod,
ResponseType, RezoHooks, CacheOption,
}; How to Choose
| Your Runtime | Recommended Import |
|---|---|
| Node.js server | rezo/platform/node |
| Bun server | rezo/platform/bun |
| Deno server | rezo/platform/deno |
| React/Vue/Angular SPA | rezo/platform/browser |
| React Native mobile app | rezo/platform/react-native |
| Cloudflare Worker | rezo/platform/worker |
| Vercel Edge Function | rezo/platform/worker |
| Deno Deploy | rezo/platform/worker or rezo/platform/deno |
| Universal/isomorphic | Use the default rezo import (auto-detects) |
Default Import vs Platform Import
The default import rezo from 'rezo' uses the HTTP adapter and assumes a Node.js environment. For other runtimes, use the platform-specific import:
// Default - assumes Node.js
import rezo from 'rezo';
// Explicit platform - guaranteed correct adapter
import rezo from 'rezo/platform/browser'; The platform imports are preferred because:
- They are explicit about which adapter is used
- They enable better tree-shaking (bundlers can exclude unused adapters)
- They avoid runtime environment detection overhead
- They work correctly in edge cases where auto-detection fails