Skip to content

About

Official Node.js SDK for Fabriqo

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Fabriqo Node.js SDK

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.

Installation

npm install @usefabriqo/sdk

Quickstart

Set 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);

Pagination

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.

Errors

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;
  }
}

Idempotency and retries

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.

Raw API access

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 },
});

Requirements

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.

Development

npm ci
npm run check

See the development guide for individual checks and package verification.

SDK generation

Bindings and models are generated from Fabriqo's OpenAPI contract.

npm run generate

To refresh the OpenAPI snapshot before generation:

npm run sdk:generate

Generated source must not be edited manually. See the generation guide.

Contributing

Report SDK issues in usefabriqo/fabriqo-node.

Read CONTRIBUTING.md before submitting a pull request.

License

MIT

About

Official Node.js SDK for Fabriqo

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages