Skip to content

nest-combo is a CLI tool designed to supercharge your NestJS development workflow. Define your entire project structure in a project.yml file, create a new project and open automagically it on vscode, generate modules, controllers, services, and more with a single command.

License

Notifications You must be signed in to change notification settings

vinisalves/nest-combo

Repository files navigation

NestJS Combo CLI

npm npm CI

A CLI tool to generate NestJS Projects, modules, controllers, services, and other components in a single line command.


Table of Contents


Motivation

The motivation is here.


How It Works

How Nest-Combo Works with NestJS CLI

If you have the NestJS CLI installed globally, nest-combo will automatically detect and use it to execute commands. This ensures compatibility with your existing global setup.

If the NestJS CLI is not installed globally, don't worry! nest-combo comes bundled with its own local version of the NestJS CLI. It will seamlessly fall back to this cached version to ensure smooth operation without requiring any additional setup from you.


Features

  • Load a full project from a YAML file.
  • Create a new project and automatically open VsCode
  • Generate NestJS modules, controllers, services, gateways, middleware, and interceptors with a single-line command.
  • Support for optional flags like --no-spec and --dry-run.
  • Colorful and user-friendly output using chalk.
  • Easy-to-use command-line interface.

Installation

Install the package globally using npm:

npm install -g nest-combo

Verify the installation by checking the version:

nest-combo --version

Usage

Run the CLI tool with the desired module name and options:

nest-combo <<project|module>-name> [options]

Example Commands

Create a project

nest-combo my-amazing-project -new # "VSCode will open by default once it's done. If you don't want it just add -no-vscode"

Create a Module, Controller, Service, Intercepetor, Gateway and Middleware in a Single Line Command

nest-combo users -m -c -s -itc -g -mw # if you don't want spcec files, just add -ns or --no-spec

Create a Full Project from a YAML File

nest-combo -f project.yml

Options

Flag Description
-m, --module Generate a module
-c, --controller Generate a controller
-s, --service Generate a service
-g, --gateway Generate a gateway
-mw, --middleware Generate middleware
-itc, --interceptor Generate an interceptor
-ns, --no-spec Do not generate .spec.ts test files
-dr, --dry-run Report actions that would be taken without writing out results
-f, --file Create a project from a YAML file

YAML Example for Loading a Full Project from Scratch

# YML example for loading a full project from scratch
nest-combo:
  project-name: my-new-project
  open-vscode: true # Open VSCode when the process is finished
  package-manager: npm # npm | yarn | pnpm
  dependencies:
    - '@nestjs/config'
    - '@nestjs/bull'
    - 'class-transformer'
    - 'class-validator'
    - 'nestjs-twilio'
  modules:
    - name: core
      resources:
        - module
      modules:
        - name: user
          resources:
            - module
            - controller
            - service
          options:
            - --no-spec
          modules:
            - name: subUsers
              resources:
                - module
                - controller
                - service
              options:
                - --no-spec
        - name: auth
          resources:
            - module
            - controller
            - service
            - interceptor
    - name: product
      resources:
        - module
        - controller
        - service
    - name: payment
      resources:
        - module
        - controller
        - service

Contributing

We welcome contributions! Here’s how you can help:

  1. Fork the repository and clone it locally.
  2. Create a new branch for your feature or bug fix:
    git checkout -b feature/your-feature-name
  3. Make your changes and ensure everything works as expected.
  4. Commit your changes with a clear message:
    git commit -m "Add feature: description of your changes"
  5. Push your branch to GitHub:
    git push origin feature/your-feature-name
  6. Open a pull request on GitHub.

Development Setup

  1. Install dependencies:
    npm install
  2. Test your changes locally:
    npm link
    nest-combo users -m -c -s

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

  • Built with ❤️ using NestJS and Chalk.
  • Inspired by the need for a faster and more efficient way to scaffold NestJS projects.

Feel free to customize this README.md further to match your project's specific details or add additional sections (e.g., FAQs, roadmap). Let me know if you need any modifications! 🚀

About

nest-combo is a CLI tool designed to supercharge your NestJS development workflow. Define your entire project structure in a project.yml file, create a new project and open automagically it on vscode, generate modules, controllers, services, and more with a single command.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published