Monorepo for Commerce Layer's JavaScript SDKs. Each API surface is published as its own package, and both are generated by one shared generator from that API's own published schema.
| Package | npm | Description |
|---|---|---|
packages/core-sdk |
@commercelayer/sdk |
SDK for the Core API |
packages/provisioning-sdk |
@commercelayer/provisioning-sdk |
SDK for the Provisioning API |
packages/sdk-generator |
— | Templates and generation logic. Not published |
packages/sdk-runtime |
— | Shared runtime the generated code depends on. Not published |
Each published package has zero runtime dependencies. For installation and usage, see the package READMEs — the two SDKs have separate documentation because they wrap different APIs.
Both SDKs are generated from the API's own /api/public/resources payload, which describes every resource, field, relationship and action. The generator turns that into resource classes, model interfaces, query types and specs.
The runtime is hand-written and shared: HTTP client, resource adapter, query building, JSON:API handling, errors and interceptors. The generator is the templates and the logic that drives them. Neither is published.
Everything generated lives under a package's gen/ directory, and nothing hand-written does. Deleting that directory and regenerating reproduces it exactly, which CI enforces on every pull request — so generated and hand-written code can never be confused, and stale output cannot survive review.
Facts a schema cannot express — the API host, client class names, resources to hide, custom actions — live in each package's sdk.config.ts.
Requires Node >= 20 and pnpm 10.
pnpm install| Command | What it does |
|---|---|
pnpm generate |
Regenerate both SDKs from the live schemas |
pnpm build |
Build both packages |
pnpm test |
Run both test suites |
pnpm lint |
Check formatting and lint rules |
pnpm ts:check |
Type-check every package |
To regenerate from the committed schema snapshot instead of the live API — branch-agnostic, and what the drift check uses:
pnpm -r generate-localVersioning is independent: each package releases on its own cadence, so each owns a tag namespace matching its directory name — core-sdk-v8.0.0, provisioning-sdk-v3.0.0.
pnpm release:versionPrompts for each package's new version, then commits the bumps and creates the tags. Private packages are left at their existing version, and the commit contains nothing but the published packages' manifests. Nothing is pushed.
git push origin HEAD
git push origin core-sdk-v<version> provisioning-sdk-v<version>The exact tag names are printed by the previous step. Pushing a tag drafts a GitHub release — it does not publish anything.
Review the generated notes on the draft release and publish it. That is the only irreversible step, and it is deliberately a human one.
Publishing a draft runs the build, packaging checks and both test suites, then publishes to npm with OIDC trusted publishing — every version carries provenance, and no long-lived token exists.
Important
Publishing either draft publishes both packages: the publish step releases every package whose version is missing from the registry, not just the one whose draft you published. Publish one draft per batch. If a publish fails part-way it is safe to re-run, because anything already on the registry is skipped — but wait until the first version is visible on npm, since a version still in npm's automated review looks unpublished and will be retried.
Notes are generated from pull request titles, grouped by label. Each package has its own notes configuration, and the core-sdk / provisioning-sdk labels are applied automatically from the paths a pull request touches. A change to the runtime or the generator is labelled for both, since it affects both SDKs.
-
Fork this repository.
-
Clone your fork and install:
git clone https://github.com/<your username>/commercelayer-sdk.git && cd commercelayer-sdk pnpm install
-
Make your changes. If you touch the generator or a target config, run
pnpm generateand commit the regenerated output — CI fails ifgen/is stale or hand-edited. -
Open a pull request. Lint, types, both test suites and the reproducibility check run automatically.
- Join Commerce Layer's Discord community.
- Ping us on Bluesky, X (formerly Twitter), or LinkedIn.
- Is there a bug? Create an issue on this repository.
This repository is published under the MIT license.