LinuxCommandLibrary

nest

CLI for NestJS, a progressive Node

TLDR

Create new project

$ nest new [project-name]
copy
Generate controller
$ nest generate controller [name]
copy
Generate service
$ nest generate service [name]
copy
Generate module
$ nest generate module [name]
copy
Generate resource (full CRUD)
$ nest generate resource [name]
copy
Start development server
$ nest start --watch
copy
Build for production
$ nest build
copy
Show help
$ nest --help
copy

SYNOPSIS

nest [new] [generate] [start] [build] [options] [args]

DESCRIPTION

nest is the CLI for NestJS, a progressive Node.js framework for building server-side applications. It generates projects and components following NestJS conventions.
New projects include TypeScript configuration, testing setup, and the NestJS module structure. The generator creates controllers, services, modules, and other components.
The resource generator creates complete CRUD functionality including controller, service, DTOs, and entities. It can generate REST, GraphQL, or WebSocket resources.
Development server includes hot reload. Code changes trigger automatic restart. Production builds optimize for deployment.
The modular architecture separates concerns into modules, each containing related controllers, services, and providers. The CLI maintains this structure.
NestJS supports Express or Fastify as underlying HTTP servers, with decorators providing routing and dependency injection.

PARAMETERS

new NAME

Create new project.
generate, g TYPE NAME
Generate component.
start
Start application.
build
Build application.
info
Display project info.
add LIBRARY
Add NestJS library.
--watch, -w
Watch mode for development.
--prod
Build for production.
--flat
Don't create directory for generated file.
--spec
Generate spec file (default true).
--no-spec
Skip spec file generation.
--dry-run, -d
Report actions without writing.
--skip-git
Skip git initialization.

CAVEATS

Requires Node.js 16+. Generated code uses TypeScript. Some features need additional packages. Learning curve for decorators and dependency injection.

HISTORY

NestJS was created by Kamil Myƛliwiec in 2017, inspired by Angular's architecture. It brought Angular-style dependency injection and decorators to Node.js backend development. The CLI provides Rails-like code generation.

SEE ALSO

node(1), npm(1), express(1), typescript(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community