Skip to content

Latest commit

 

History

2,395 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fetcher

中文 · Documentation · Skills · Storybook · npm

Fetcher is a TypeScript HTTP-client ecosystem built around the platform fetch API. Start with typed requests, interceptors, timeouts, and streaming; add React, OpenAPI generation, authentication, Wow CQRS, or data-viewer packages only when the application needs them.

Install

pnpm add @ahoo-wang/fetcher

Node.js 18.20.8 or newer is required.

Your first request

import { Fetcher, FetcherError } from '@ahoo-wang/fetcher';

interface User {
  id: string;
  name: string;
}

const api = new Fetcher({
  baseURL: 'https://api.example.com',
  timeout: 10_000,
});

try {
  const response = await api.get('/users/{id}', {
    urlParams: {
      path: { id: 'u-42' },
      query: { include: 'team' },
    },
  });
  const user: User = await response.json();
  console.log(user.name);
} catch (error) {
  if (error instanceof FetcherError) {
    console.error(error.message);
  }
}

Choose packages by job

Job Package
HTTP client and interceptors @ahoo-wang/fetcher
Declarative service classes @ahoo-wang/fetcher-decorator
Typed events @ahoo-wang/fetcher-eventbus
Server-Sent Events @ahoo-wang/fetcher-eventstream
OpenAI Chat Completions @ahoo-wang/fetcher-openai
OpenAPI TypeScript types @ahoo-wang/fetcher-openapi
OpenAPI client generation @ahoo-wang/fetcher-generator
React hooks @ahoo-wang/fetcher-react
Typed storage @ahoo-wang/fetcher-storage
CoSec authentication @ahoo-wang/fetcher-cosec
Wow commands and queries @ahoo-wang/fetcher-wow
Data views (new projects) @ahoo-wang/fetcher-view-engine
Legacy Viewer (maintenance mode, deprecated) @ahoo-wang/fetcher-viewer

Choose packages explains peer dependencies and the smallest useful combination.

Learn and build

Contribute

pnpm install --frozen-lockfile
pnpm build
VITEST_MAX_WORKERS=4 pnpm test:unit
pnpm lint
pnpm verify:view-engine

See the contributor guide for focused package, integration, Wiki, and Storybook checks.

License

Apache License 2.0

About

Fetcher is not just another HTTP client—it's a complete ecosystem designed for modern web development with native LLM streaming API support. Built on the native Fetch API, Fetcher provides an Axios-like experience with powerful features while maintaining an incredibly small footprint.

Topics

Resources

Stars

15 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages