Skip to main content

What this group covers

The HTTP modules handle everything between your application code and the network: typed requests, response validation, schema integration, and URL manipulation.

ApiClient

Core HTTP client with interceptors, retries, circuit breaker, and typed responses.

ResponseValidator

Framework-agnostic response validation against structural schemas.

Schema adapters

Zod and Valibot adapters for response validation.

UrlHelper

URL parsing, building, query-string helpers, and slugification.

Quick example

import { ApiClient, zodAdapter } from "bytekit";
import { UrlHelper } from "bytekit/url-helper";
import { z } from "zod";

const api = new ApiClient({
  baseUrl: "https://api.example.com",
  timeoutMs: 10_000,
});

const UserSchema = z.object({ id: z.number(), name: z.string() });

// Typed + validated request
const user = await api.get("/users/1", {
  validateResponse: zodAdapter(UserSchema),
});

// Build a URL with query params
const url = UrlHelper.setQueryParams("/search", { q: "bytekit", page: "1" });
Start with ApiClient for the full constructor config, methods, and error-handling reference.