Skip to content

WireTypedTyped HTTP client for fetch runtimes

Universal fetch-based, typed HTTP client with error-first ergonomics, retries, caching, SSE, and Standard Schema validation.

WireTyped

What is it?

Small and easy-to-use fetch based client with runtime validation

CI   Coverage   minzip

npm   JSR

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.

It keeps a tiny runtime surface area: one dependency, @standard-schema/spec, so you can bring your own validator (Zod, Valibot, ArkType, etc.) without dragging in a whole framework or a pile of transitive deps.

I built it because I got tired of the same three problems: surprise runtime errors, wrapping every request in try/catch, and threading schemas + type inference through every call just to keep types strict and consistent. WireTyped centralizes that work in your endpoint definitions, so using the client stays predictable and pretty.

Basic example

Define your endpoints once, then call them with a consistent [err, data] shape with convenient type-narrowing:

ts
import { RequestClient, type RequestDefinitions } from 'wiretyped';
import { z } from 'zod'; // Or your standard-schema/spec of choice

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);

Okay, wow

If you’re nodding along and want to keep moving, jump into the quickstart: /guide/getting-started

lil' guy says hi