SDK
npm i @forgecommerce/sdkimport { createClient } from '@forgecommerce/sdk';
const forge = createClient({ baseUrl: 'https://<your-instance>', token: process.env.FORGE_TOKEN });
const created = await forge.call('catalog.product.create', { /* typed against the registry */ });if (!created.ok) throw new Error(created.error.code); // 'forbidden', 'conflict', …
const products = await forge.read('products', { store: 'str_…' });const orders = await forge.readInternal('orders_admin', { /* … */ });Three methods, because there are three faces: call writes through the single command port, read asks the
public face (no credential — the store resolves the tenant), readInternal asks the operator face with the
client’s own token. There is no fourth method and no per-resource client — 184 commands and 91 read
capabilities are reached by NAME, and the names are the same ones the API, the CLI and MCP use.
★ Nothing throws. Every method returns { ok: true, value } or { ok: false, error }, so a refusal is a
value the compiler makes you handle — see errors and refusals.
The types are generated from the same JSON Schemas the kernel validates against, so a wrong field is a
compile error rather than a 400 at runtime. forge.commands, forge.reads and forge.internalReads carry
the name lists, if you need to enumerate them at runtime.