Command-line interface tool for initializing, developing, and maintaining NestJS applications
npx @tessl/cli install tessl/npm-nestjs--cli@11.0.00
# NestJS CLI
1
2
The NestJS CLI is a command-line interface tool that helps you initialize, develop, and maintain NestJS applications. It assists in multiple ways, including scaffolding the project, serving it in development mode, and building and bundling the application for production distribution. It embodies best-practice architectural patterns to encourage well-structured apps.
3
4
## Package Information
5
6
- **Package Name**: @nestjs/cli
7
- **Package Type**: npm
8
- **Language**: TypeScript
9
- **Installation**: `npm install -g @nestjs/cli`
10
11
## Core Usage
12
13
```bash
14
nest <command> [options]
15
```
16
17
The CLI works with schematics and provides built-in support from the schematics collection at @nestjs/schematics.
18
19
## Basic Usage
20
21
```bash
22
# Create a new NestJS application
23
nest new my-app
24
25
# Generate a controller
26
nest generate controller users
27
28
# Build the application
29
nest build
30
31
# Start in development mode
32
nest start --watch
33
34
# Display project information
35
nest info
36
```
37
38
## Architecture
39
40
The NestJS CLI is built around several key components:
41
42
- **Command System**: Modular command structure using Commander.js for argument parsing
43
- **Schematics Integration**: Built-in support for Angular DevKit schematics and @nestjs/schematics
44
- **Build System**: Multi-builder support (TypeScript compiler, Webpack, SWC) for different compilation needs
45
- **Package Manager Integration**: Automatic detection and support for npm, yarn, and pnpm
46
- **Configuration Management**: Project-level configuration through nest-cli.json files
47
48
## Capabilities
49
50
### Project Creation
51
52
Create new NestJS applications with customizable options including language selection, package manager, and project structure.
53
54
```bash { .api }
55
nest new [name] [options]
56
nest n [name] [options]
57
```
58
59
[Project Creation](./project-creation.md)
60
61
### Code Generation
62
63
Generate NestJS components, services, controllers, and other elements using schematics.
64
65
```bash { .api }
66
nest generate <schematic> [name] [path] [options]
67
nest g <schematic> [name] [path] [options]
68
```
69
70
[Code Generation](./code-generation.md)
71
72
### Application Building
73
74
Build applications for production with support for multiple build systems and watch mode.
75
76
```bash { .api }
77
nest build [apps...] [options]
78
```
79
80
[Application Building](./application-building.md)
81
82
### Development Server
83
84
Start applications in development mode with hot reloading, debugging, and asset watching.
85
86
```bash { .api }
87
nest start [app] [options]
88
```
89
90
[Development Server](./development-server.md)
91
92
### Library Integration
93
94
Add external libraries to your project with automated setup and configuration.
95
96
```bash { .api }
97
nest add <library> [options]
98
```
99
100
[Library Integration](./library-integration.md)
101
102
### Project Information
103
104
Display comprehensive information about your NestJS project including dependencies, versions, and configuration.
105
106
```bash { .api }
107
nest info [options]
108
nest i [options]
109
```
110
111
[Project Information](./project-information.md)
112
113
## Global Options
114
115
All commands support the following help options:
116
117
```bash { .api }
118
-h, --help # Output usage information
119
-v, --version # Output the current version
120
```
121
122
## Configuration
123
124
The CLI uses a `nest-cli.json` configuration file in your project root to define build settings, project structure, and default options.
125
126
## Environment Requirements
127
128
- **Node.js**: >= 20.11
129
- **Package Managers**: npm, yarn, or pnpm
130
- **Optional Dependencies**: @swc/cli and @swc/core for SWC compilation support