Node.js + TypeScript SDKs for the ProductCraft APIs — Heimdall (auth-as-a-service), Envoi (transactional email), Rally (waitlists), Agora (social), and Platform-Auth (workspace identity).
Five per-product packages plus a productcraft umbrella. Install just the one you need.
Status: v0 — every endpoint reachable via the typed
openapi-fetchclient; Stripe-style ergonomic resource wrappers ship in v0.1+.
Pick the package(s) you need:
# Just one product
npm install @productcraft/heimdall
npm install @productcraft/envoi
npm install @productcraft/rally
npm install @productcraft/agora
npm install @productcraft/platform-auth
# Or the all-in-one umbrella
npm install productcraftRequires Node 18+.
import { Envoi } from "@productcraft/envoi";
const envoi = new Envoi({
auth: { type: "apiKey", key: process.env.PRODUCTCRAFT_API_KEY! },
});
const { data, error } = await envoi.client.POST(
"/v1/mailboxes/{mailboxId}/messages/send",
{
params: { path: { mailboxId: "mb_123" } },
body: { to: "alice@example.com", subject: "Welcome", body: "..." },
},
);
if (error) throw error;
console.log(data.id);import { ProductCraft } from "productcraft";
const pc = new ProductCraft({
auth: { type: "apiKey", key: process.env.PRODUCTCRAFT_API_KEY! },
});
await pc.envoi.client.POST("/v1/mailboxes/{mailboxId}/messages/send", { ... });
await pc.heimdall.client.POST("/v1/auth/signin", { ... });The Stripe-style ergonomic surface (envoi.messages.send({ to, subject, body })) ships in v0.1+. Until then, the typed underlying client guarantees every endpoint is reachable from day one.
| Package | Default URL |
|---|---|
@productcraft/heimdall — Heimdall Consumer + Admin |
https://api.heimdall.productcraft.co |
@productcraft/envoi — Envoi (mailbox-api) |
https://api.mail.productcraft.co |
@productcraft/rally — Rally (waitlists) |
https://api.rally.productcraft.co |
@productcraft/agora — Agora (social) |
https://agora.productcraft.co |
@productcraft/platform-auth — Platform-Auth (workspaces) |
https://api.auth.productcraft.co |
@productcraft/core — shared auth + transport (dep of all the above) |
— |
productcraft — convenience umbrella, depends on all five |
— |
type PCAuth =
| { type: "apiKey"; key: string } // pcft_live_* — server-side only
| { type: "bearer"; token: string } // pre-resolved JWT
| { type: "cookie"; value: string } // dev / E2EAuth is added as Authorization: Bearer … (or Cookie: auth_token=…) on every outbound request via an openapi-fetch middleware.
The SDKs are generated from the live OpenAPI specs at each prod API's /docs-json endpoint:
- Specs vendored under
Specs/<surface>.jsonat the repo root. openapi-typescriptgeneratespackages/<surface>/src/_generated.d.ts(types only — no runtime).- A thin hand-written class per surface wires
openapi-fetchwith the generatedpathstypes + auth + base URL. - CI cron (
.github/workflows/spec-refresh.yml) refetches specs nightly. When a surface's spec changes, it emits a Changesets entry that triggers a patch bump for just that package.
This means: per-product packages move independently; consumers only see version bumps for the surfaces they use.
git clone https://github.com/clauderanelagh/productcraft-node
cd productcraft-node
pnpm install
pnpm run refresh-specs # pull /docs-json from prod into Specs/
pnpm run codegen # regenerate packages/<surface>/src/_generated.d.ts
pnpm run build
pnpm run test
pnpm run lintPer-package SemVer. Spec-refresh PRs add a Changesets entry that triggers a patch bump on just the affected surface (and a cascading patch on the productcraft umbrella). The release workflow opens a "Version Packages" PR collecting pending bumps; merging it publishes the affected packages to npm via Trusted Publishing (OIDC, no token).
MIT.