axcelerate-client
v0.1.9
Published
A TypeScript client for the aXcelerate API. Provides a simple, typed wrapper around aXcelerate's REST endpoints (contacts, courses, enrolments, and more) for Node.js server-side applications.
Maintainers
Readme
aXcelerate Client
A fully typed Node.js client for the aXcelerate REST API. The library wraps vendor endpoints with ts-rest contracts and Zod schemas so requests and responses are validated at runtime and inferred at compile time.
- API docs: https://app.axcelerate.com/apidocs/home
- Requires: Node 18 or newer (server-only usage)
Features
- End-to-end typing — Request bodies, params, and responses are all backed by Zod schemas.
- Typed resources — Covers contacts and courses, including enrolments and course instances.
- Runtime validation — Normalised error handling surfaces upstream changes early.
- Dual bundles — Ships ESM & CJS builds with generated declaration files.
Installation
pnpm add axcelerate-client
# or
npm install axcelerate-client
yarn add axcelerate-clientQuick Start
import { createAxcelerateClient } from "axcelerate-client";
const axc = createAxcelerateClient({
baseUrl: "https://yourorg.api.axcelerate.com.au/api/",
apiToken: process.env.AXCELERATE_API_TOKEN!,
wsToken: process.env.AXCELERATE_WS_TOKEN!,
});
const result = await axc.courses.get({
query: { current: true, public: true },
});
if (result.status === 200) {
result.body.forEach((course) => {
console.log(`${course.name} (${course.type})`);
});
}Every router method enforces the contract defined in src/contract. If the upstream API changes shape, Zod validation surfaces the mismatch immediately.
Available Endpoints
Courses
courses.getcourses.instance.getcourses.enrolcourses.enrolMultiplecourses.detail.get
Contacts
contacts.create,contacts.update,contacts.getcontacts.searchcontacts.verifyUsicontacts.note.create
Organisations
organisations.search
Each action is defined in its own file under src/contract/modules/**, with its request/response schemas colocated in src/schemas/**. Query and mutation schemas conform to the shared QueryEndpointSchemas and MutationEndpointSchemas types defined in src/schemas/meta.ts, keeping endpoint definitions consistent across the client.
See the fixtures and specs in tests/ for concrete request/response examples.
Development
pnpm install # install dependencies
pnpm build # emit dist/ (ESM + CJS)
pnpm test # run the Vitest suite (uses undici MockAgent)
pnpm lint # eslint .
pnpm format # prettier . --write
pnpm dev # tsup watch modeReleasing
tsup bundles the library and prepare runs the build automatically. Bump the version, run pnpm build, then publish with your package manager of choice.
Contributing
Bug reports and pull requests are welcome. Please:
- Discuss large changes in an issue first.
- Add or update tests for behavioural changes.
- Run
pnpm lintandpnpm testbefore submitting.
License
Licensed under the MIT License.
