Skip to content

HTTP Client (base)

@theholocron/http-client is the base layer for all other clients in this monorepo. It provides a thin fetch-based REST client with normalised error handling.

Terminal window
pnpm add @theholocron/http-client
import { createRestClient, ProviderApiError } from "@theholocron/http-client";
const rest = createRestClient({
baseUrl: "https://api.example.com/v1",
token: process.env.API_TOKEN,
vendor: "ExampleAPI",
});
try {
const data = await rest.get<MyResponse>("/resource");
} catch (err) {
if (err instanceof ProviderApiError) {
console.error(err.status, err.message);
}
}

Token finding is not part of this package; it lives in @theholocron/kyber/secrets.

The full API reference is generated from the package’s TSDoc comments.