Skip to main content
ByteKit is designed for teams that want a typed HTTP layer, async control primitives, and production helpers without stacking several small runtime libraries.

Build reliable networked apps with fewer dependencies

ByteKit gives you a typed HTTP client, async primitives, and production-focused helpers in one package.

Quickstart

Install bytekit and make your first request.

HTTP client

Learn the core ApiClient patterns.

Async toolkit

Control retries, concurrency, timing, and flow.

Reference

Review modules, exports, and import paths.

Why ByteKit

  • Isomorphic HTTP client for Node.js 18+ and modern browsers
  • Built-in resilience with retries, circuit breaker support, caching, and deduplication
  • Async utilities such as retry, parallel, race, timeout, debounceAsync, and throttleAsync
  • Zero runtime dependencies
  • Modular exports so you can import only what you need

What you can build with it

Typed API layer

Centralize headers, validation, timeouts, and request policies in one client.

Failure-tolerant integrations

Add retries, circuit breaker behavior, rate limiting, and cache-aware patterns.

Heavy async workflows

Coordinate concurrency, backoff, timeouts, and cancellation-friendly flows.

Realtime and streaming flows

Consume NDJSON streams, SSE endpoints, and streamed downloads.

Core modules at a glance

AreaWhat it coversStart here
HTTPApiClient, request config, typed responses, schema validation/guides/http-client
ResilienceRetryPolicy, RateLimiter, RequestCache, RequestDeduplicator/guides/resilience
Asyncretry, parallel, sequential, race, timeout, sleep/guides/async-toolkit
ObservabilityLogger, Profiler, debug helpers/reference/overview
HelpersStreaming, WebSocket, crypto, storage, cache, env helpers/reference/overview

Typical starting point

1

Create one shared client

Put ApiClient behind a small app-specific wrapper so your base URL, auth headers, timeout policy, and interceptors live in one place.
2

Validate risky boundaries

Use zodAdapter or valibotAdapter on requests where a malformed backend response would break your UI or job.
3

Add resilience where failures are expensive

Turn on retries, circuit breaking, and rate limiting for external APIs or unstable internal services.
4

Pull in narrow entrypoints

Import from bytekit/api-client, bytekit/async, or bytekit/logger when you want smaller and clearer module boundaries.

Example setup

import { ApiClient, createLogger, zodAdapter } from "bytekit";
import { z } from "zod";

const logger = createLogger({ namespace: "billing-api" });

const InvoiceSchema = z.object({
  id: z.string(),
  status: z.enum(["draft", "paid", "void"]),
});

const api = new ApiClient({
  baseUrl: "https://api.example.com",
  timeoutMs: 10_000,
  logger,
  retryPolicy: {
    maxAttempts: 3,
    initialDelayMs: 200,
  },
});

const invoice = await api.get("/invoices/123", {
  validateResponse: zodAdapter(InvoiceSchema),
});

Start with the right guide

Resilience patterns

Combine retries, caching, deduplication, and rate limiting.

Streaming and realtime

Work with NDJSON streams, SSE, and streamed downloads.

Local development

Preview docs locally and validate links before publishing.

Import paths

See the public module entrypoints exposed by the package.

Choose the right import surface

  • Use bytekit if you want convenience and a single import surface.
  • Use bytekit/api-client when you only need HTTP features.
  • Use bytekit/async when you only need flow-control utilities.
  • Use focused helper entrypoints when you want explicit boundaries in a larger codebase.
If you are evaluating the library, read Quickstart, then HTTP client, and then Reference overview.