Moose automatically generates OpenAPI specifications for all your APIs, enabling you to create type-safe client SDKs in any language. This allows you to integrate your Moose APIs into any application with full type safety and IntelliSense support.
While moose dev is running, Moose emits an OpenAPI spec at .moose/openapi.yaml covering:
Every time you make a change to your Moose APIs, the OpenAPI spec is updated automatically.
You can use your preferred generator to create a client from that spec. Below are minimal, tool-agnostic examples you can copy into your project scripts.
The following example uses Kubb to generate the SDK. Kubb can be installed into your project without any dependencies on the Java runtime (unlike the OpenAPI Generator which requires Java).
Follow the setup instructions for Kubb here.
Then, in your project's package.json, add the following script:
{ "scripts": { "generate-sdk": "kubb generate" }}Finally, configure the on_reload_complete_script hook in your moose.config.toml:
[http_server_config]on_reload_complete_script = "npm run generate-sdk"This will trigger the generation CLI command after each reload.
The on_reload_complete_script hook is available in your moose.config.toml file. It runs after each dev server reload when code/infra changes have been fully applied. This allows you to keep your SDKs continuously up to date as you make changes to your Moose APIs.
Notes:
$SHELL (falls back to /bin/sh)..moose/openapi.yaml and ./generated/... are relative to the project root.&& (as shown) or split into a shell script if preferred.These hooks only affect local development (moose dev). The reload hook runs after Moose finishes applying your changes, ensuring .moose/openapi.yaml is fresh before regeneration.
Import from the output path your generator writes to (see your chosen example repo). The Moose side is unchanged: the spec lives at .moose/openapi.yaml during moose dev.
Use any OpenAPI-compatible generator: