javascript-clients is an Nx monorepo that auto-generates TypeScript API clients for Red Hat Hybrid Cloud Console (HCC) services. Each service gets its own npm package (@redhat-cloud-services/<service>-client) published independently.
Instead of using the stock typescript-axios generator, this repo uses a custom Java-based generator (typescript-axios-webpack-module-federation) that creates one folder per API endpoint. This enables tree-shaking in webpack module federation environments — consumers only bundle the endpoints they import.
- Generator source:
src/main/java/.../TypescriptAxiosWebpackModuleFederationGenerator.java - Mustache templates:
src/main/resources/typescript-axios-webpack-module-federation/ - Built via Maven:
npm run build:generator(runsmvn clean package) - Output JAR:
target/typescript-axios-webpack-module-federation-openapi-generator-1.0.0.jar
Two custom executors in packages/build-utils:
client-generator— Orchestrates spec validation + code generation. Supports multiple spec versions per client (e.g., v1/v2). Uses Zod for options validation.builder— Compiles TypeScript to dual CJS+ESM output. Copies package metadata todist/.
Each package is versioned and released independently via Nx Release with conventional commits. A change to rbac-client doesn't bump patch-client. Version tags follow {packageName}-{version} format.
Consumer App
|
v
@redhat-cloud-services/<service>-client (generated client)
|
v
@redhat-cloud-services/javascript-clients-shared (APIFactory, interceptors)
|
v
axios (HTTP client)
build-utils is a dev-time dependency only — it provides the Nx executors for generating and building clients.
OpenAPI Spec (remote URL / local file)
|
v
Spec Validation (openapi-generator-cli validate)
|
v
Code Generation (custom JAR + Mustache templates)
|
v
Post-Processing (postProcess.sh — sed cleanups)
|
v
TypeScript source in packages/<client>/src/
TypeScript source (src/)
|
+---------+----------+
| |
v v
tsconfig.cjs.json tsconfig.esm.json
| |
v v
dist/ (CJS) dist/esm/ (ESM)
Push/PR to main
|
v
install → [lint, test, integration, build] (parallel, affected only)
|
v (main branch, all pass)
release → nx release → npm publish (per changed package)
| Path | Purpose |
|---|---|
packages/<client>/ |
Individual client packages (generated + config) |
packages/build-utils/ |
Custom Nx executors (client-generator, builder) |
packages/shared/ |
Shared runtime utilities (APIFactory, interceptors) |
apps/test-app/ |
React demo app for testing clients |
src/main/java/ |
Custom OpenAPI generator (Java) |
src/main/resources/ |
Mustache templates for code generation |
utils/nx-base/ |
Template for scaffolding new client packages |
bin/serve.sh |
Prism mock server launcher |
- Generated code in
src/is never manually edited — changes go through templates or postProcess.sh - All clients share the same
sharedpackage for HTTP configuration - Dual CJS/ESM builds are required for all published packages
- Spec URLs must be
console.redhat.com(not legacycloud.redhat.com) - Package names follow
@redhat-cloud-services/<service>-clientconvention - Nx caching is enabled by default; use
--skip-nx-cachewhen debugging build issues