Skip to content

TypeScript SDK

@heela/sdk is a thin, zero-dependency TypeScript client for the Hee control plane. Works in Node.js 18+, Deno, Bun, and Cloudflare Workers.

Terminal window
npm install @heela/sdk
# or
yarn add @heela/sdk
# or
bun add @heela/sdk
import { HeeClient } from "@heela/sdk";
const hee = new HeeClient({
token: process.env.HEE_API_TOKEN!,
// optional:
// baseUrl: "https://api.hee.la", // default
// timeoutMs: 5000, // default
});
const domain = await hee.domains.register({
hostname: "docs.customer.com",
metadata: {
workspaceId: "ws_abc123",
theme: "dark",
},
});
console.log(domain);
// {
// hostname: "docs.customer.com",
// projectSlug: "acme-saas",
// verified: false,
// verifiedAt: null,
// createdAt: "2026-04-20T21:47:38.000Z",
// metadata: { workspaceId: "ws_abc123", theme: "dark" }
// }

Registering the same hostname twice is idempotent — the second call returns the existing record. If you pass new metadata, it’s merged in.

const domains = await hee.domains.list();
// Returns all domains owned by this token's project.
await hee.domains.remove("docs.customer.com");
// Soft delete. Cert retained for 24h in case of re-add.

All errors are instances of HeeError:

import { HeeError } from "@heela/sdk";
try {
await hee.domains.register({ hostname: "docs.customer.com" });
} catch (err) {
if (err instanceof HeeError) {
if (err.status === 409) {
// hostname is claimed by another project
} else if (err.status === 402) {
// project is over its plan limit
} else {
// network / server issue
}
}
}
StatusMeaning
200Success
204Success (no body, e.g. DELETE)
400Invalid hostname format
401Invalid or revoked token
402Over plan limit
403Token not authorized for this project
404Hostname not found (on remove)
409Hostname claimed by another project
5xxControl plane outage — retry with backoff

The SDK does not retry automatically — that’s your caller’s responsibility. Recommended pattern:

async function registerWithRetry(input: { hostname: string }) {
for (let attempt = 0; attempt < 3; attempt++) {
try {
return await hee.domains.register(input);
} catch (err) {
if (err instanceof HeeError && err.status < 500) throw err; // don't retry 4xx
await new Promise((r) => setTimeout(r, 2 ** attempt * 1000));
}
}
throw new Error("Hee registration failed after 3 attempts");
}

Pass your own fetch implementation for testing or non-standard runtimes:

import { HeeClient } from "@heela/sdk";
const hee = new HeeClient({
token: "hee_test_...",
fetch: customFetch, // e.g. undici, node-fetch, mocked fetch
});

github.com/shekhardtu/heela/tree/main/packages/sdk