https://github.com/kasperrt/wiretyped
A universal fetch-based, typed HTTP client with error-first ergonomics, retries, caching, SSE, and Standard Schema validation.
https://github.com/kasperrt/wiretyped
api-client cache error-first error-handling fetch fetch-api fetch-client http-client rest-client retry schema-validation sse standard-schema type-safe typecript universal
Last synced: 18 days ago
JSON representation
A universal fetch-based, typed HTTP client with error-first ergonomics, retries, caching, SSE, and Standard Schema validation.
- Host: GitHub
- URL: https://github.com/kasperrt/wiretyped
- Owner: kasperrt
- License: mit
- Created: 2025-12-01T22:19:41.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-02-03T10:00:22.000Z (about 1 month ago)
- Last Synced: 2026-02-03T22:29:41.628Z (about 1 month ago)
- Topics: api-client, cache, error-first, error-handling, fetch, fetch-api, fetch-client, http-client, rest-client, retry, schema-validation, sse, standard-schema, type-safe, typecript, universal
- Language: TypeScript
- Homepage: https://wiretyped.io/
- Size: 852 KB
- Stars: 5
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# WireTyped
> Small and easy-to-use fetch based client with runtime validation
[](https://github.com/kasperrt/wiretyped/actions/workflows/ci.yml)
[](https://codecov.io/gh/kasperrt/wiretyped)
[](https://bundlejs.com/?q=wiretyped@latest)
[](https://www.npmjs.com/package/wiretyped) [](https://jsr.io/@kasperrt/wiretyped)
Universal fetch-based, typed HTTP client with error-first ergonomics, retries, caching, SSE, and Standard Schema validation.
https://wiretyped.io
## Installation
```sh
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
```ts
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);
```
## Guide
- [Getting Started](https://wiretyped.io/guide/getting-started)
- [Endpoints](https://wiretyped.io/guide/endpoints)
- [Client](https://wiretyped.io/guide/client)
- [Methods](https://wiretyped.io/guide/methods)
- [Caching](https://wiretyped.io/guide/caching)
- [Retries](https://wiretyped.io/guide/retries)
- [SSE](https://wiretyped.io/guide/sse)
- [Error Handling](https://wiretyped.io/guide/errors)
- [FAQ](https://wiretyped.io/faq)
- [Changelog](https://wiretyped.io/changelog)