🦅 NestJS Beginner

What is the NestJS CLI and how is it used?

Answer

The NestJS CLI is a command-line tool that helps scaffold and manage NestJS projects. Install globally: npm i -g @nestjs/cli. Create a new project: nest new my-app. Generate resources: nest generate module users (or nest g mo users), nest g controller users, nest g service users. The nest g resource users command generates a complete CRUD scaffold including module, controller, service, DTOs, and entities in one command. The CLI ensures consistent file naming, imports, and module registration. It also provides nest build (compile TypeScript), nest start --watch (development mode with hot reload), and nest info (show environment info).