Skip to content

the-codegen-project/cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

The Codegen Project banner

⚑️The Codegen Project⚑️

License Npm latest version NPM Downloads GitHub Actions Workflow Status GitHub last commit GitHub Downloads (specific asset, all releases) GitHub Downloads (specific asset, all releases) GitHub Downloads (specific asset, all releases) GitHub Downloads (specific asset, all releases) GitHub Downloads (specific asset, all releases) GitHub Downloads (specific asset, all releases) homebrew downloads Chocolatey Downloads All Contributors

Generate payload models, parameters, headers, messages, communication support functions, testing functions, and more, across programming languages such as TypeScript, and soon more...

Read the Docs | View Demos

Core Features

  • πŸ“ƒ Generate payload representations from your AsyncAPI document (including Protobuf, RAML, OpenAPI Schema)
  • πŸ“Š Customize the generators output to your hearts desire
  • πŸ’« Regenerate once the input changes
  • πŸ‘€ Integrate it into any project (such as Next.JS, etc.)
  • πŸ’… Create custom generators (read more)
  • πŸ—„οΈ Protocol agnostic generator (docs)
  • ⭐ And much more...

How it works

The Codegen Project is a generator that is built to live along side your projects to help you save time in the development phase, ensuring you spend as much time on the business logic as possible. It works by using your configuration file to know what it needs to generate.

Each input has different generates and all of them can be customized, or you can build your own generator right in the configuration file.

export default {
  inputType: 'asyncapi',
  inputPath: './asyncapi.json',
  language: 'typescript',
  generators: [
    {
      preset: 'payloads',
      outputPath: './src/payloads',
      serializationType: 'json', 
    },
    ...
  ]
};

In this example, the generator will read the AsyncAPI document located in same directory as the configuration file, and generate TypeScript models for all the payload including code to serialize the models to JSON.

Getting started

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 manager MacOS x64 MacOS arm64 Windows x64 Windows x32 Linux (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

Symlink

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

Generate

With your configuration file in hand, time to generate the code and use it! This can be done manually or integrate into your build process. Checkout all the examples for inspiration how to do it.

codegen generate

πŸ‘€ Goals

Besides the milestones, we have certain goals that we want to reach for various reasons;

  • ⭐ Reach 50 stars - So we can publish the CLI on Brew and Chocolatey
  • πŸ“ƒ 3 Published resources (blog post, video, etc)

πŸ“ƒ Resources

People who have been so kind to write or talk about The Codegen Project;

  • Write one!

Contribution Guidelines

We have made quite a comprehensive contribution guide to give you a lending hand in how the project is structured and how to contribute to it.

Contributors

Thanks go out to these wonderful people (emoji key):

Jonas Lagoni
Jonas Lagoni

πŸ› πŸ’» πŸ“– πŸ€” 🚧 πŸ’¬ ⚠️ πŸ‘€
Lagoni
Lagoni

πŸ› 🚧 πŸ“† πŸ‘€

This project follows the all-contributors specification. Contributions of any kind are welcome!