Node SDK
TypeScript and Node.js client for the Halo REST API.
The @halo/sdk package wraps the REST API with typed methods and pagination helpers. Works in Node 20+, Bun, Deno, and edge runtimes.
Install
npm
bashnpm install @halo/sdkbun
bashbun add @halo/sdkAuthenticate
import { Halo } from "@halo/sdk";
const halo = new Halo({ token: process.env.HALO_TOKEN });HALO_TOKEN is read automatically if you don’t pass token.
Deploy
const deployment = await halo.deployments.create({
project_id: "prj_abc123",
files: { "index.html": "abc...", "app.js": "def..." },
target: "production",
});
console.log(deployment.url);List with pagination
for await (const dep of halo.deployments.list({ project_id: "prj_abc123" })) {
console.log(dep.id, dep.status);
}The async iterator transparently follows next_cursor.
Streaming logs
const stream = halo.logs.stream({ project_id: "prj_abc123" });
for await (const line of stream) {
console.log(line.timestamp, line.message);
}Backed by a long-poll WebSocket. Reconnects with backoff on network blips.
Errors
import { HaloError } from "@halo/sdk";
try {
await halo.deployments.get("dpl_does_not_exist");
} catch (err) {
if (err instanceof HaloError && err.code === "deployment_not_found") {
// ...
}
throw err;
}Every error carries code, message, and doc_url from the API.
Last updated
Edit this page