nx-openapi-codegen
v0.0.29
Published
Built on top of [Kubb](https://www.kubb.dev), **nx-openapi-codegen** transforms an OpenAPI spec into a fully scoped NX monorepo for your GitHub organization or repository. Provide a URL or local path to your spec, and instantly generate.
Readme
nx-openapi-codegen
Built on top of Kubb, nx-openapi-codegen transforms an OpenAPI spec into a fully scoped NX monorepo for your GitHub organization or repository. Provide a URL or local path to your spec, and instantly generate.
Note
This is useful for now, but if it were to be a real CLI, there would be a ton of things to change - there is a checklist for this in docs/todo.md. Hard dependencies on nx should be reconsidered for example.
Autogenerated SDKs
- TypeScript Types
- Mocks
- Faker mocks (constant or randomized)
- MSW handlers (constant or randomized responses)
- HTTP Clients
- Validation
- Definitions
- OpenAPI Schema JSON definitions
You’ll also get publishable GitHub npm packages for TypeScript (publishing setup is currently limited to TypeScript), and optional Swift & Kotlin (Android) scaffolds are available for multi-platform projects (publishing not yet configured).
Automatic GitHub Workflows
By default, the tool creates helpful GitHub Actions workflows to streamline development:
- main.yml:
Runs on pushes to
main(basic CI steps). - pull-request.yml: Validates pull requests (linting, code generation, docs).
- release.yml:
Manually triggers (via
workflow_dispatch) for publishing TypeScript packages. - update-models.yml: Periodically (on a cron schedule) regenerates all models and opens a pull request with any changes—perfect for a spec that has changed (usefu for open api docs that are deployed and change on a regular basis.
Prerequisites
- Bun (>=v1.2 recommended)
Usage
bunx nx-openapi-codegenFollow the interactive prompts to specify your GitHub organization, repository, and OpenAPI spec path (remote or local). nx-openapi-codegen will take care of the rest—so you can focus on building applications, not boilerplate.
