Skip to content

Plugins Overview

The Nx Plugin OpenAPI ecosystem provides a modular plugin architecture, allowing you to choose the code generator that best fits your project’s needs.

PluginPackageGenerator ValueDescription
OpenAPI Generator@nx-plugin-openapi/plugin-openapiopenapi-toolsUses the battle-tested OpenAPI Generator
hey-api@nx-plugin-openapi/plugin-hey-apihey-apiUses hey-api/openapi-ts for modern TypeScript clients

The plugin system is built around a core package that provides:

  • The generate-api executor
  • Plugin loading and auto-installation
  • Common configuration handling
┌─────────────────────────────────────────────────────────────┐
│ @nx-plugin-openapi/core │
│ Executor, Plugin Loader, Auto-Installation │
└─────────────────────────────────────────────────────────────┘
┌───────────────────┼───────────────────┐
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ plugin-openapi │ │ plugin-hey-api │ │ Custom Plugins │
│ (OpenAPI Gen) │ │ (hey-api) │ │ (Your own!) │
└──────────────────┘ └──────────────────┘ └──────────────────┘

Best for:

  • Angular applications needing injectable services
  • Projects requiring specific OpenAPI Generator templates
  • Teams familiar with the OpenAPI Generator ecosystem
  • Supporting multiple languages/frameworks from a single spec

Features:

  • 50+ language/framework generators
  • Extensive customization via templates
  • Mature, battle-tested tooling

Best for:

  • Modern TypeScript/JavaScript projects
  • Projects prioritizing type safety and tree-shaking
  • Fetch-based or Axios HTTP clients
  • Simpler, more lightweight generated code

Features:

  • TypeScript-first approach
  • Excellent type inference
  • Plugin-based architecture for customization
  • Modern ESM output

You can use different generators for different projects in your monorepo:

libs/angular-client/project.json
{
"targets": {
"generate-api": {
"executor": "@nx-plugin-openapi/core:generate-api",
"options": {
"generator": "openapi-tools",
"inputSpec": "specs/api.yaml",
"outputPath": "libs/angular-client/src/generated"
}
}
}
}
libs/ts-client/project.json
{
"targets": {
"generate-api": {
"executor": "@nx-plugin-openapi/core:generate-api",
"options": {
"generator": "hey-api",
"inputSpec": "specs/api.yaml",
"outputPath": "libs/ts-client/src/generated"
}
}
}
}

Need to integrate a different OpenAPI generator? The plugin architecture makes it easy to create custom plugins. See our Creating Custom Plugins guide for a complete walkthrough.