Pular para o conteΓΊdo principal

Code Scaffolding & Generation

Generate boilerplate code for new modules, entities, and services.

NestJS CLI​

# Generate a new module
npx nest generate module my-feature

# Generate a controller
npx nest generate controller my-feature

# Generate a service
npx nest generate service my-feature

# Generate a full CRUD resource
npx nest generate resource my-feature

NX Generators​

# Generate a new library
npx nx generate @nx/nest:library my-lib

# Generate a new Angular component
npx nx generate @nx/angular:component my-component --project=gauzy

Manual Module Template​

For a standard Gauzy module, create these files:

packages/core/src/lib/my-feature/
β”œβ”€β”€ my-feature.module.ts
β”œβ”€β”€ my-feature.controller.ts
β”œβ”€β”€ my-feature.service.ts
β”œβ”€β”€ my-feature.entity.ts
β”œβ”€β”€ dto/
β”‚ β”œβ”€β”€ create-my-feature.dto.ts
β”‚ └── update-my-feature.dto.ts
β”œβ”€β”€ commands/
β”‚ β”œβ”€β”€ my-feature.create.command.ts
β”‚ └── handlers/
β”‚ └── my-feature.create.handler.ts
└── repository/
β”œβ”€β”€ type-orm-my-feature.repository.ts
└── mikro-orm-my-feature.repository.ts