Overview
Overview
Section titled βOverviewβThe Nx Plugin OpenAPI brings first-class support for generating API client code from OpenAPI specifications within your Nx workspace, leveraging all the powerful features of the Nx task pipeline.
Plugin Architecture
Section titled βPlugin ArchitectureβThe project is structured as a modular plugin system, allowing you to choose the code generator that best fits your needs:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ @nx-plugin-openapi/core ββ Executor, Plugin Loader, Auto-Installation ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β βββββββββββββββββββββ΄ββββββββββββββββββββ βΌ βΌββββββββββββββββββββββββββ βββββββββββββββββββββββββββ plugin-openapi β β plugin-hey-api ββ (OpenAPI Generator) β β (hey-api/openapi-ts) βββββββββββββββββββββββββββ ββββββββββββββββββββββββββAvailable Generators
Section titled βAvailable Generatorsβ| Generator | Plugin | Description |
|---|---|---|
openapi-tools | @nx-plugin-openapi/plugin-openapi | Uses OpenAPI Generator - supports 50+ languages including TypeScript Angular |
hey-api | @nx-plugin-openapi/plugin-hey-api | Uses hey-api/openapi-ts - modern TypeScript-first client generation |
Key Benefits
Section titled βKey Benefitsβπ Nx Native Integration
Section titled βπ Nx Native Integrationβ- Uses standard Nx executors and configuration
- Integrates with Nxβs dependency graph
- Supports Nxβs powerful caching system
- Works with Nx Cloud for distributed caching
β‘ Smart Caching
Section titled ββ‘ Smart Cachingβ- Only regenerates when OpenAPI specs change
- Supports both local and remote OpenAPI specifications
- Caches based on file content, not timestamps
- Dramatically speeds up builds in large monorepos
π§ Flexible Plugin System
Section titled βπ§ Flexible Plugin Systemβ- Choose the generator that fits your project needs
- Plugins are auto-installed when first used
- Pass generator-specific options via
generatorOptions - Support for multiple OpenAPI specifications in a single target
- Create custom plugins for any OpenAPI generator
π¦ Production Ready
Section titled βπ¦ Production Readyβ- Battle-tested generators used in thousands of production applications
- Comprehensive configuration options for customization
- TypeScript-safe configuration through JSON schema
Choosing a Generator
Section titled βChoosing a GeneratorβOpenAPI Generator (openapi-tools)
Section titled βOpenAPI Generator (openapi-tools)βBest for:
- Angular applications needing injectable services
- Projects requiring specific OpenAPI Generator templates
- Teams familiar with OpenAPI Generator ecosystem
- Supporting multiple languages/frameworks
hey-api (hey-api)
Section titled βhey-api (hey-api)βBest for:
- Modern TypeScript/JavaScript projects
- Projects prioritizing type safety
- Fetch-based HTTP clients
- Simpler, more lightweight generated code
Extensibility
Section titled βExtensibilityβNeed to integrate a different OpenAPI generator? The plugin architecture makes it easy to create custom plugins for any code generator. See our Creating Custom Plugins guide for a complete walkthrough.
Next Steps
Section titled βNext StepsβReady to get started? Letβs install the plugin in your Nx workspace.