This directory contains practical examples demonstrating how to use The Codegen Project for different use cases.
A complete example showing how to generate a TypeScript library from OpenAPI specifications.
An example demonstrating integration with Next.js applications.
A comprehensive example showing how to generate TypeScript payload models from AsyncAPI specifications for an e-commerce order processing system.
A comprehensive example showing how to generate TypeScript parameter models from AsyncAPI specifications for dynamic channel routing in an e-commerce messaging system.
A comprehensive example showing how to generate TypeScript header models from AsyncAPI specifications for an e-commerce messaging system, covering authentication, tracing, routing, and metadata management.
A focused example showing how to generate protocol-specific messaging functions from AsyncAPI specifications for order lifecycle management in an e-commerce system.
An example demonstrating how to generate complete, type-safe client SDKs for NATS messaging with order lifecycle management, including connection management and JetStream integration.
A comprehensive example showing how to generate TypeScript types from AsyncAPI specifications for an e-commerce messaging system.
A minimal, self-contained example of generating a type-safe HTTP client from an OpenAPI document — and how to consume it: building request bodies, supplying path parameters, and reading typed responses.
The other side of the same document: generating typed Express handler stubs with the http_server protocol, and driving them with the http_client generated from that same document.
A minimal example of the root-config filter option: generate code for only a subset of an OpenAPI document's paths/operations, with orphaned component schemas pruned automatically.
- Choose an example that matches your use case
- Copy the relevant files to your project
- Modify the configuration to match your specifications
- Run the generator
- Integrate the generated code into your application
For active development, most examples include watch mode scripts for automatic code regeneration:
# For TypeScript Library example
npm run dev
# For Next.js example
npm run generate:watch
# Or use the CLI directly
codegen generate --watchWatch mode automatically regenerates your code when input files change, keeping your generated code in sync during development.
For more detailed information, see the documentation.