🔒 Type Safety
Full TypeScript support with type inference for requests and responses
🔒 Type Safety
Full TypeScript support with type inference for requests and responses
✅ Schema Validation
Response validation using any Standard Schema compatible library (Zod, Valibot, etc.)
🎯 Error Handling
Structured error handling with typed error responses and custom error classes
🚀 Familiar API
Extended RequestInit interface - works exactly like fetch with extra features
📦 Tiny Bundle
Minimal dependencies and tiny bundle size for optimal performance
🔧 Framework Agnostic
Works with any JavaScript framework or vanilla TypeScript/JavaScript
import { fetcher } from '@shkumbinhsn/fetcher';import { z } from 'zod';
const UserSchema = z.object({ id: z.string(), name: z.string(), email: z.string().email()});
// Fully typed responseconst user = await fetcher('/api/users/123', { schema: UserSchema});
console.log(user.name); // TypeScript knows this is a string