Small and easy-to-use fetch based client with runtime validation
Universal fetch-based, typed HTTP client with error-first ergonomics, retries, caching, SSE, and Standard Schema validation.
Installation
pnpm add wiretyped # or: npm install wiretyped # or: npx jsr add @kasperrt/wiretyped
What is it?
WireTyped is a small, composable HTTP client for fetch-based runtimes (browser, Node, Bun, Deno, workers). You define your API as typed endpoint definitions and call it with a consistent, error-first API.
Quick taste
import { z } from 'zod'; // Or your standard-schema/spec of choice import { RequestClient, type RequestDefinitions } from 'wiretyped'; const endpoints = { '/users/{id}': { get: { response: z.object({ id: z.string(), name: z.string() }) }, }, } satisfies RequestDefinitions; const client = new RequestClient({ hostname: 'https://api.example.com', baseUrl: '/api', endpoints, validation: true, }); const [err, user] = await client.get('/users/{id}', { id: '123' }); if (err) { return err; } console.log(user.name);
