1.5.1 • Published 3 years ago

clean-scaffold v1.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Clean Architecture Scaffold

This CLI creates the structure of a NodeJs and TypeScript project based on clean architecture to build REST full APIs, it comes with the initial configuration of an Express application as a NodeJs framework and this is located in the application layer.

Implementation of the plugin

We install the plugin globally in our computer, to be able to access the commands that generate the tasks. the tasks.

    npm i -g clean-scaffold

Tasks

Project Generation

  1. We generate the project structure with the command scaffold init, which receives one parameter --name.
   scaffold init --name=[project name]

Plugin generated structure:

npm.io

Database Generation

  1. We generate the adapter with the initial database configuration for database managers like MongoDB, MySQL or Postgres with the command scaffold create:database, receives a parameter --database, this is required.

    • --database = Database manager name mongo, mysql, postgres.
   scaffold create:database --database=[manager name]

Plugin generated structure:

npm.io

Model Generation

  1. The scaffold create:entity command will generate a model and an interface in the domain layer [models], this task has --name as parameter and this is required. The name must have a middle hyphen in case it is compound.

    Example: --name=user, --name=user-detail, --name=post-comments-user.

   scaffold create:entity --name=[model name]

Task generating structure:

npm.io

Interface Generation

  1. The scaffold create:interface command generates an interface, the location of the file is according to the component where it is required. where it is required. The name must have a hyphen in case it is a compound name.

Example: --name=user, --name=user-detail, --name=post-comments-user.

   scaffold create:interface --name=user-detail --path=model
   scaffold create:interface --name=user-detail --path=service
   scaffold create:interface --name=user-detail --path=infra

Service Generation

  1. The scaffold create:service command will generate the interface and the service that implements it in the domain layer [use-cases]. domain layer [use-cases], this task has --name as parameter and this is required. The name must have a hyphen in case it is a compound name.

    Example: --name=user, --name=user-detail, --name=post-comments-user.

   scaffold create:service --name=[service name]

Structure that generates the task:

npm.io

This configuration must be done manually.

npm.io

Adapter Generation

  1. The scaffold create:adapter command will generate an adapter in the infrastructure layer, this task has --name and --database as parameters this is required. The name of the --database parameter corresponds to the database manager. After the adapter is generated, the provider must be included in the app.ts file and then the name of the provider in the corresponding service must be passed through the constructor.

    Example: --name=user --database=mongo

   scaffold create:adapter --name=[adapter name] --database=[database manager]

Structure that generates the task:

npm.io

  1. This command generates two files, the class that communicates with the service through the gateway and the provider resolves the dependencies of this communication.

This configuration must be done manually.

Service configuration.

npm.io

app.ts configuration.

npm.io

Controller Generation

  1. The scaffold create:controller command will generate a controller in the infrastructure layer, this task has --name as parameter and this is required. The name must have a hyphen in case it is a compound name.

    Example: --name=user, --name=user-detail, --name=post-comments-user.

   scaffold create:controller --name=[controller name]

Structure that generates the task:

npm.io

This configuration must be done manually.

app.ts configuration.

npm.io

  1. The naming convention must be applied between the service and the controller to generate the Dependency Injection in the controller and an endpoint to enter the application.

npm.io

1.5.1

3 years ago

1.4.2

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago