1.2.15 • Published 4 months ago

nestjs-clean-arch-cli v1.2.15

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

NestJS Clean Architecture CLI

A CLI tool for generating NestJS projects following the Clean Architecture principles.

Features

  • Generate a new NestJS project with a predefined folder structure adhering to Clean Architecture.
  • Easy selection of package manager (npm, yarn, pnpm) via command line flags or interactive prompts.
  • Automated removal of unnecessary files and directories from the standard NestJS project structure.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js (v12 or later)
  • npm, yarn, or pnpm

Installation

Install the CLI globally by running:

$ npm install -g nestjs-clean-arch-cli

Or if you prefer using yarn:

$ yarn global add nestjs-clean-arch-cli

Or if you don't want to install globally:

$ npx nca <command>

Usage

To start a new NestJS project, run:

$ nestjs-clean-arch-cli init <project-name>

or

$ nca init <project_name>

You can specify the package manager directly:

nca init <project_name> -m npm

You can specify which ORM to use:

nca init <project_name> -o prisma

Or you can let the CLI prompt you to choose the package manager interactively.

Commands and Options

  • init <project-name>: Generates a new NestJS project.
    • -m, --package-manager <manager>: (Optional) Choose the package manager to use (npm, yarn, pnpm)
    • -o, --orm <orm>: (Optional) Choose the ORM to use (prisma, typeorm)

Project Structure

The generated project will have two different structures:

Prisma

<project-name>
├── src
│   ├── app.module.ts
│   ├── core
│   │   ├── application
│   │   │   ├── interfaces
│   │   │   │   └── repositories
│   │   │   └── use-cases
│   │   └── domain
│   │       ├── entities
│   │       ├── exceptions
│   │       └── types
│   ├── infra
│   │   ├── database
│   │   │   ├── database.module.ts
│   │   │   └── prisma
│   │   │       └── repositories
│   │   ├── http
│   │   │   ├── controllers
│   │   │   ├── dtos
│   │   │   ├── interceptors
│   │   │   ├── mappers
│   │   │   └── middlewares
│   │   ├── lib
│   │   │   └─ prisma
│   │   │       ├── prisma.module.ts
│   │   │       └── prisma.service.ts
│   │   └── util
│   └── main.ts
└── ...

TypeORM

<project-name>
├── src
│   ├── app.module.ts
│   ├── core
│   │   ├── application
│   │   │   ├── interfaces
│   │   │   │   └── repositories
│   │   │   └── use-cases
│   │   └── domain
│   │       ├── entities
│   │       ├── exceptions
│   │       └── types
│   ├── infra
│   │   ├── database
│   │   │   ├── database.module.ts
│   │   │   └── typeorm
│   │   │       ├── database.providers.ts
│   │   │       ├── entities
│   │   │       └── repositories
│   │   ├── http
│   │   │   ├── controllers
│   │   │   ├── dtos
│   │   │   ├── interceptors
│   │   │   ├── mappers
│   │   │   └── middlewares
│   │   ├── lib
│   │   └── util
│   └── main.ts
└── ...

Contributing

Github

Contributions to the NestJS Clean Architecture CLI are welcome! Please follow the standard process:

  1. Fork the repository.
  2. Create a new branch for each feature or improvement.
  3. Send a pull request from each feature branch to the main branch.

For more information, please contact Matheus Mota (devmatheusmota@gmail.com)

1.2.9

4 months ago

1.2.12

4 months ago

1.2.13

4 months ago

1.2.10

4 months ago

1.2.11

4 months ago

1.2.14

4 months ago

1.2.15

4 months ago

1.2.8

4 months ago

1.2.7

4 months ago

1.2.6

4 months ago

1.2.5

4 months ago

1.2.4

4 months ago

1.2.3

4 months ago

1.2.2

4 months ago

1.2.1

4 months ago

1.1.2

4 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago