npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

advanced-client-fetch

v1.1.8

Published

πŸš€ Modern HTTP client with fetch-first design, plugin architecture, and security features. Works across all platforms with automatic cookie management and SSRF protection.

Readme

Advanced Client Fetch

npm version npm downloads License: MIT TypeScript Node.js

πŸš€ Modern HTTP client with fetch-first design, plugin architecture, and security features. Works across all platforms with automatic cookie management and SSRF protection.

✨ Features

  • 🌐 Universal: Works on Node.js, Browser, Edge runtimes, Deno, and Bun
  • πŸ”Œ Plugin Architecture: Extensible middleware system with built-in plugins
  • ⚑ Performance: Fetch-first design with optimized request handling
  • πŸ›‘οΈ Security: Built-in SSRF protection and security features
  • πŸͺ Cookie Management: Automatic cookie handling across requests
  • πŸ”„ Axios Compatible: Drop-in replacement for Axios
  • πŸ“Š Metrics: Built-in performance monitoring and metrics
  • πŸ”„ Retry Logic: Smart retry with exponential backoff and jitter
  • ⏱️ Timeout: Configurable timeouts with per-attempt and total timeout
  • πŸ’Ύ Caching: RFC 9111 compliant HTTP caching
  • 🚦 Rate Limiting: Token bucket and sliding window rate limiting
  • πŸ”Œ Circuit Breaker: Fault tolerance with circuit breaker pattern
  • πŸ”— Deduplication: Request deduplication to prevent duplicate calls
  • πŸ“ˆ Monitoring: Comprehensive metrics and performance monitoring

πŸš€ Quick Start

Installation

# npm
npm install advanced-client-fetch

# pnpm
pnpm add advanced-client-fetch

# yarn
yarn add advanced-client-fetch

# bun
bun add advanced-client-fetch

Basic Usage

import { createClient } from 'advanced-client-fetch';

// Create a client
const client = createClient({
  baseURL: 'https://api.example.com',
  headers: {
    'Authorization': 'Bearer your-token'
  }
});

// Make requests
const users = await client.get('/users');
const user = await client.post('/users', { name: 'John', email: '[email protected]' });

With Plugins

import { createClient, retry, timeout, cache, metrics } from 'advanced-client-fetch';

const client = createClient({
  baseURL: 'https://api.example.com',
  plugins: [
    retry({ retries: 3, minDelay: 100, maxDelay: 2000 }),
    timeout(30000),
    cache({ ttl: 300000 }),
    metrics({ enabled: true })
  ]
});

Platform-Specific Presets

import { 
  createNodeClient, 
  createEdgeClient, 
  createBrowserClient,
  createDenoClient,
  createBunClient 
} from 'advanced-client-fetch';

// Node.js optimized
const nodeClient = createNodeClient({
  baseURL: 'https://api.example.com'
});

// Edge runtime optimized
const edgeClient = createEdgeClient({
  baseURL: 'https://api.example.com'
});

// Browser optimized
const browserClient = createBrowserClient({
  baseURL: 'https://api.example.com'
});

Axios Compatibility

import { createAxiosAdapter } from 'advanced-client-fetch';

const axios = createAxiosAdapter({
  baseURL: 'https://api.example.com',
  timeout: 5000
});

// Use exactly like Axios
const response = await axios.get('/users');

πŸ“š Documentation

Core Concepts

Plugins

Presets

  • Node.js - Node.js runtime optimizations
  • Edge - Edge runtime optimizations
  • Browser - Browser environment optimizations
  • Deno - Deno runtime optimizations
  • Bun - Bun runtime optimizations

πŸ”Œ Plugins

Built-in Plugins

import { 
  retry, 
  timeout, 
  cache, 
  rateLimit, 
  circuitBreaker, 
  dedupe, 
  metrics 
} from 'advanced-client-fetch';

const client = createClient({
  plugins: [
    // Retry failed requests
    retry({
      retries: 3,
      minDelay: 100,
      maxDelay: 2000,
      jitter: true
    }),
    
    // Set request timeout
    timeout(30000),
    
    // Cache responses
    cache({
      ttl: 300000, // 5 minutes
      cacheOnlyGET: true
    }),
    
    // Rate limiting
    rateLimit({
      requests: 100,
      window: 60000 // 1 minute
    }),
    
    // Circuit breaker
    circuitBreaker({
      failureThreshold: 5,
      window: 60000,
      resetTimeout: 30000
    }),
    
    // Request deduplication
    dedupe({
      maxAge: 30000
    }),
    
    // Performance metrics
    metrics({
      enabled: true
    })
  ]
});

Custom Plugins

import { createClient, type Middleware } from 'advanced-client-fetch';

const customPlugin: Middleware = async (ctx, next) => {
  console.log(`Making request to ${ctx.req.url}`);
  
  try {
    await next();
    console.log(`Request completed with status ${ctx.res?.status}`);
  } catch (error) {
    console.error(`Request failed: ${error.message}`);
    throw error;
  }
};

const client = createClient({
  plugins: [customPlugin]
});

🌍 Platform Support

Node.js

import { createNodeClient } from 'advanced-client-fetch';

const client = createNodeClient({
  baseURL: 'https://api.example.com'
});

Edge Runtimes

import { createEdgeClient } from 'advanced-client-fetch';

const client = createEdgeClient({
  baseURL: 'https://api.example.com'
});

Browser

import { createBrowserClient } from 'advanced-client-fetch';

const client = createBrowserClient({
  baseURL: 'https://api.example.com'
});

Deno

import { createDenoClient } from 'advanced-client-fetch';

const client = createDenoClient({
  baseURL: 'https://api.example.com'
});

Bun

import { createBunClient } from 'advanced-client-fetch';

const client = createBunClient({
  baseURL: 'https://api.example.com'
});

πŸ”„ Migration from Axios

Advanced Client Fetch provides a drop-in replacement for Axios:

// Before (Axios)
import axios from 'axios';

const response = await axios.get('/api/users');

// After (Advanced Client Fetch)
import { createAxiosAdapter } from 'advanced-client-fetch';

const axios = createAxiosAdapter();
const response = await axios.get('/api/users');

πŸ›‘οΈ Security Features

  • SSRF Protection: Prevents Server-Side Request Forgery attacks
  • Host Validation: Validates allowed/blocked hosts
  • Request Size Limits: Configurable request and response size limits
  • Redirect Limits: Prevents infinite redirect loops
  • Cookie Security: Secure cookie handling with proper flags

πŸ“Š Performance

  • Fetch-First: Uses native fetch API for optimal performance
  • Tree Shaking: Optimized bundle size with tree shaking
  • Lazy Loading: Plugins are loaded only when needed
  • Connection Pooling: Efficient connection management
  • Request Deduplication: Prevents duplicate requests

πŸ§ͺ Testing

# Run tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run tests with coverage
pnpm test:coverage

πŸ“¦ Bundle Analysis

# Analyze bundle size
pnpm build
pnpm analyze

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

πŸ“„ License

MIT License - see LICENSE for details.

πŸ™ Acknowledgments

  • Inspired by Axios for its excellent API design
  • Built on top of the native Fetch API
  • Plugin architecture inspired by Koa

πŸ“ž Support


Made with ❀️ by Yasar Tahir Kose# CI Test