Modern Web & Node.js Guide

Deploying across Chrome, Safari, Next.js Server Components, Cloudflare Workers, Bun, and Node.js 18+.


True Universal Runtime

Despite having "react-native" in its name, react-native-fetch-client is a pure universal Fetch library. Because it avoids any React Native native dependencies, it runs identically in:

  • Modern Web Browsers (Chrome, Firefox, Safari, Edge)
  • Next.js (App Router, Server Actions, Route Handlers, Edge Runtime)
  • Node.js 18, 20, 22+ (native globalThis.fetch)
  • Bun and Deno
  • Cloudflare Workers and Vercel Edge Functions

Enterprise Node.js Proxies with fetchImpl

In corporate backend environments requiring forward proxies or custom TLS certificate authorities, provide a custom fetchImpl:

node-service.ts
typescript
import { createClient } from 'react-native-fetch-client';
import { ProxyAgent } from 'undici';

// For enterprise Node.js environments behind corporate proxies:
const dispatcher = new ProxyAgent('http://proxy.internal.corp:8080');

export const api = createClient({
  baseURL: 'https://api.external-vendor.com',
  // Custom fetch implementation with Node dispatcher:
  fetchImpl: (url, init) => {
    return fetch(url, {
      ...init,
      // @ts-ignore Node undici dispatcher
      dispatcher,
    });
  },
});