What is @nestjs/cli?
The @nestjs/cli package is a command-line interface tool for NestJS, a framework for building efficient, reliable and scalable server-side applications. This CLI tool helps developers to initialize, develop, and maintain their NestJS applications with ease by providing a set of commands to generate, run, and manage various parts of the application.
What are @nestjs/cli's main functionalities?
Project Initialization
This command creates a new NestJS project with all the necessary configuration and dependencies to get started.
nest new project-name
Generate Resources
Generates a new controller named 'users' within the project. The CLI supports generating various resources like modules, services, and guards.
nest generate controller users
Run Development Server
Starts the application in watch mode. Any changes in the source code will automatically restart the server, facilitating a smooth development process.
nest start --watch
Build Project
Compiles the application into JavaScript, preparing it for production deployment.
nest build
Other packages similar to @nestjs/cli
express-generator
Similar to @nestjs/cli, express-generator is a CLI tool for Express.js, another Node.js framework. It helps in scaffolding new Express applications quickly but lacks the comprehensive set of features for managing the entire lifecycle of the application as @nestjs/cli does.
angular-cli
Although angular-cli is for Angular, a front-end framework, it shares a similar purpose with @nestjs/cli in terms of initializing projects, generating components, and managing build tasks. Both provide a robust set of tools to streamline development within their respective ecosystems.
create-react-app
create-react-app is a CLI tool for setting up new React applications. It abstracts away the build configuration into a single command, similar to how @nestjs/cli simplifies the setup and development of NestJS applications. However, it's focused on front-end React projects.
A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
Description
In order to help people manage their projects, the CLI tool has been created. It helps on many grounds at once, from scaffolding the project to build well-structured applications. The Nest CLI is based on the @angular-devkit package. Also, there're special schematics that are dedicated to the Nest development @nestjs/schematics.
Installation
NPM:
$ npm install -g @nestjs/cli
Docker:
$ docker pull nestjs/cli[:version]
$ docker run -it --rm -p 3000:3000 -v $(pwd)/workspace nestjs/cli[:version]
GIT:
$ git clone https://github.com/nestjs/nest-cli.git <project>
$ cd <project>
With your Node runtime:
$ npm install
$ npm link
With Docker:
$ docker build -t nestjs/cli .
Usage
Learn more in the official documentation.
Stay in touch