Official Node.js SDK for Fabriqo.
@usefabriqo/sdk provides typed access to Fabriqo from Node.js.
For complete SDK and API documentation, visit docs.fabriqo.app.
npm install @usefabriqo/sdkSet FABRIQO_API_KEY to your Fabriqo API token.
import { Fabriqo } from '@usefabriqo/sdk';
const fabriqo = new Fabriqo({
apiKey: process.env.FABRIQO_API_KEY!,
});
const products = await fabriqo.products.list();
for (const product of products.items) {
console.log(product.id, product.name);
}The SDK provides typed resources for products, materials, inventory, purchasing, sales, manufacturing, traceability, and more.
import type { Product } from '@usefabriqo/sdk';
const product: Product = await fabriqo.products.get(123);Fabriqo uses cursor pagination. Use listAll to iterate through pages automatically:
for await (const product of fabriqo.products.listAll({ limit: 100 })) {
console.log(product.id, product.name);
}See the Fabriqo documentation for manual and nested pagination.
API failures are exposed as FabriqoError:
import { FabriqoError } from '@usefabriqo/sdk';
try {
await fabriqo.products.get(123);
} catch (error) {
if (error instanceof FabriqoError) {
console.error(error.status, error.code, error.message);
console.error(error.requestId);
} else {
throw error;
}
}Create operations use caller-supplied idempotency keys:
const product = await fabriqo.products.create(
{
name: 'Widget',
sku: 'WIDGET-001',
unit: 'pcs',
},
{
idempotencyKey: crypto.randomUUID(),
},
);The SDK never generates idempotency keys automatically. Writes are never automatically retried.
Eligible read requests may be retried automatically with bounded backoff. See the Fabriqo documentation for retry and idempotency behavior.
The resource facade is recommended for most applications. Lower-level generated operations remain available through .raw:
await fabriqo.raw.products.get({
path: { product_id: 123 },
});Node.js 22.18 or newer.
The package includes ESM and CommonJS builds, TypeScript declarations, and source maps. It uses native Fetch and has no runtime dependencies.
npm ci
npm run checkSee the development guide for individual checks and package verification.
Bindings and models are generated from Fabriqo's OpenAPI contract.
npm run generateTo refresh the OpenAPI snapshot before generation:
npm run sdk:generateGenerated source must not be edited manually. See the generation guide.
Report SDK issues in usefabriqo/fabriqo-node.
Read CONTRIBUTING.md before submitting a pull request.