@eddlondon/rentant-store-api
The storefront data layer for the RentAnt Public API: generated API models,
a typed ApiClient + EcommerceApiService/AuthApiService, hostname →
tenant resolution, and React Query hooks. Consumed in-repo as
workspace:* TypeScript source, and published to npm as compiled
ESM + d.ts for standalone storefronts (see
docs/tenant-website-handover.md).
Built for RentAnt storefronts. Published publicly (MIT) for the convenience of tenant deployments — no support is offered outside that context, and 0.x versions track the RentAnt Public API without notice.
Entry points
| Import | Contents |
|---|---|
@eddlondon/rentant-store-api |
generated models, ApiClient, services, tenant config/resolution |
@eddlondon/rentant-store-api/react |
React Query hooks (useCart, useCheckout, …), TenantProvider, AuthProvider, useAuth, useTenant |
Peer dependencies: react (18 or 19), axios ^1, @tanstack/react-query ^5
(the /react entry only).
Consuming the published package
The package is public on registry.npmjs.org — no registry configuration or token is needed:
pnpm add @eddlondon/rentant-store-api
Configuration is env-driven (NEXT_PUBLIC_API_BASE_URL,
NEXT_PUBLIC_DEFAULT_TENANT_ID, optional NEXT_PUBLIC_TENANT_CONFIG_JSON
for multi-domain setups — see apps/frontend/docs/TENANT_CONFIGURATION.md).
The tenant id is sent verbatim as the API Tenant header and is
case-sensitive on the backend.
Versioning
The package is 0.x — minor bumps may break (semver 0.x rules); pin and upgrade deliberately. Breaking HTTP-contract changes are absorbed here and released as a version bump, with coordination for anything that needs an API deploy.
Regenerating after API changes
Run from the repo root:
pnpm sync-api # build-time OpenAPI export → swagger.json → regenerate clients
Do not edit src/generated/** by hand. CI enforces both directions of drift:
tests.yml fails when swagger.json no longer matches the backend contract,
and frontend.yml fails when the generated client no longer matches
swagger.json.
Publishing
- Bump
versioninpackage.json(with the contract change, in the same PR). - Tag the merge commit
store-api-v<version>and push the tag. .github/workflows/publish-store-api.ymlverifies the tag matches the package version, builds with tsdown (ESM + d.ts intodist/,publishConfigrepoints the exports), and publishes to registry.npmjs.org using theNPM_PUBLISH_TOKENrepo secret (an npm granular automation token with publish rights for the@eddlondonscope). It can also be run manually viaworkflow_dispatch(dry_rundefaults to true). Once the package exists on npm, the token can be replaced with npm trusted publishing (OIDC from GitHub Actions — supported natively by pnpm ≥10.9): configure the trusted publisher in the npm package settings, addid-token: writeto the workflow permissions, and drop the secret.
Versions ≤0.3.1 were published to GitHub Packages (token-gated); they remain there but new versions go to npm only.