Skip to main content

Getting Started in 5 minutes

Its simple, install the CLI into your project or machine, setup the Codegen configuration file to include all the code your heart desire, customize it, and generate it at build time or whenever you feel like it.

Install

Installing the CLI can be done inside a project or within your system.

Package managerMacOS x64MacOS arm64Windows x64Windows x32Linux (Debian)Linux (Others)

NPM

npm install --save-dev @the-codegen-project/cli

npm install -g @the-codegen-project/cli

Yarn

yarn add @the-codegen-project/cli

Pnpm

pnpm add @the-codegen-project/cli

Bun

bun add @the-codegen-project/cli

Download

curl -OL https://github.com/the-codegen-project/cli/releases/latest/download/codegen.x64.pkg

Install

sudo installer -pkg codegen.x64.pkg -target /

Download

curl -OL https://github.com/the-codegen-project/cli/releases/latest/download/codegen.arm64.pkg

Install

sudo installer -pkg codegen.arm64.pkg -target /

Download

curl -OL https://github.com/the-codegen-project/cli/releases/latest/download/codegen.deb

Install

sudo apt install ./codegen.deb

Download

curl -OL https://github.com/the-codegen-project/cli/releases/latest/download/codegen.tar.gz

Install

tar -xzf codegen.tar.gz
ln -s <absolute-path>/bin/codegen /usr/local/bin/codegen

You can find all the possible commands in the usage documentation.

Initialize

Add a configuration file, either manually or through the CLI;

codegen init

Initialize The Codegen Project

Customize it to your heart's desire! Each generator has unique set of options

Integrate

With your configuration file in hand, time to integrate it into your project and generate some code! Checkout all the integrations for inspiration how to do it.

Generate Code

One-time Generation

# Generate code once
codegen generate

# Generate with specific config file
codegen generate ./my-config.js

Development with Watch Mode

For active development, use watch mode to automatically regenerate code when your input files change:

# Watch for changes in the input file specified in your config
codegen generate --watch

# Watch for changes in a specific file or directory
codegen generate --watch --watchPath ./my-asyncapi.yaml

# Short form
codegen generate -w -p ./schemas/

Pro tip: Use watch mode during development to keep your generated code in sync with your API specifications. Press Ctrl+C to stop watching.