Catalogue des Commandes 27/01/2026 14:00:00 angularforall.com

- NestJS CLI : commandes et framework Node.js

Nestjs Node-Js Typescript Framework-Backend Microservices Api-Rest Architecture Modules Decorateurs Dependency-Injection Guards Interceptors Graphql Scalabilite

Guide NestJS CLI complet : créez des architectures scalables avec ce framework TypeScript pour Node.js, idéal pour APIs et microservices en production.

npm i -g @nestjs/cli
Description :

Installe la CLI NestJS globalement

Options :
  • --force ⚠️
  • -f ⚠️
  • --save
  • -S
  • --save-dev
  • -D
  • --help
nest new
Description :

Crée un nouveau projet NestJS

Options :
  • --directory
  • --skip-git
  • --skip-install
  • --package-manager
  • --language
  • --strict
  • --help
nest generate
Description :

Génère des fichiers NestJS (composants, modules, etc.)

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g
Description :

Alias de nest generate

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest generate module
Description :

Génère un nouveau module

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g mo
Description :

Alias pour générer un module

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --dry-run ⚠️
  • -d
  • --help
nest generate controller
Description :

Génère un nouveau contrôleur

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g co
Description :

Alias pour générer un contrôleur

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate service
Description :

Génère un nouveau service

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g s
Description :

Alias pour générer un service

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate provider
Description :

Génère un nouveau provider

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g pr
Description :

Alias pour générer un provider

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate middleware
Description :

Génère un nouveau middleware

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g mi
Description :

Alias pour générer un middleware

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate exception
Description :

Génère une nouvelle exception filter

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g f
Description :

Alias pour générer un filter d'exception

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate pipe
Description :

Génère un nouveau pipe

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g pi
Description :

Alias pour générer un pipe

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate guard
Description :

Génère un nouveau guard

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g gu
Description :

Alias pour générer un guard

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate interceptor
Description :

Génère un nouvel interceptor

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g in
Description :

Alias pour générer un interceptor

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate decorator
Description :

Génère un nouveau décorateur personnalisé

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g d
Description :

Alias pour générer un décorateur

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --dry-run ⚠️
  • -d
  • --help
nest generate gateway
Description :

Génère une nouvelle gateway WebSocket

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g ga
Description :

Alias pour générer une gateway

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate resolver
Description :

Génère un nouveau resolver GraphQL

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g r
Description :

Alias pour générer un resolver GraphQL

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate class
Description :

Génère une nouvelle classe

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g cl
Description :

Alias pour générer une classe

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest generate interface
Description :

Génère une nouvelle interface

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g itf
Description :

Alias pour générer une interface

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --dry-run ⚠️
  • -d
  • --help
nest generate enum
Description :

Génère une nouvelle énumération

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g en
Description :

Alias pour générer une énumération

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --dry-run ⚠️
  • -d
  • --help
nest generate filter
Description :

Génère un nouveau filter (alias de exception)

Options :
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest generate library
Description :

Génère une nouvelle bibliothèque dans un monorepo

Options :
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g lib
Description :

Alias pour générer une bibliothèque

Options :
  • --dry-run ⚠️
  • -d
  • --help
nest generate application
Description :

Génère une nouvelle application dans un monorepo

Options :
  • --dry-run ⚠️
  • -d
  • --help
nest g app
Description :

Alias pour générer une application

Options :
  • --dry-run ⚠️
  • -d
  • --help
nest generate resource
Description :

Génère un ensemble complet de ressources (CRUD)

Options :
  • --crud
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --project
  • -p
  • --help
nest g res
Description :

Alias pour générer une ressource complète

Options :
  • --crud
  • --flat ⚠️
  • --no-flat ⚠️
  • --spec
  • --no-spec
  • --dry-run ⚠️
  • -d
  • --help
nest build
Description :

Compile l'application NestJS

Options :
  • --path
  • -p
  • --watch
  • -w
  • --webpack
  • --webpackPath
  • --tsc
  • --builder
  • --config
  • -c
  • --help
nest start
Description :

Lance l'application NestJS

Options :
  • --path
  • -p
  • --watch
  • -w
  • --preserveWatchOutput
  • --exec
  • -e
  • --debug
  • --config
  • -c
  • --help
nest start:dev
Description :

Lance l'application en mode développement (watch)

Options :
  • --preserveWatchOutput
  • --debug
  • --help
nest start:debug
Description :

Lance l'application en mode debug

Options :
  • --preserveWatchOutput
  • --help
nest start:prod
Description :

Lance l'application en mode production

Options :
  • --help
npm run start
Description :

Lance l'application (script package.json)

Options :
  • --
  • --watch
  • --debug
npm run start:dev
Description :

Lance l'application en mode watch

Options :
  • --
  • --preserveWatchOutput
npm run start:debug
Description :

Lance l'application en mode debug

npm run start:prod
Description :

Lance l'application compilée en production

nest test
Description :

Lance les tests unitaires avec Jest

Options :
  • --watch
  • -w
  • --watchAll
  • --coverage
  • --verbose
  • --testPathPattern
  • -t
  • --testNamePattern
  • --updateSnapshot
  • -u
  • --detectOpenHandles
  • --forceExit ⚠️
  • --runInBand ⚠️
  • --maxWorkers
  • --config
  • -c
  • --help
nest test:watch
Description :

Lance les tests en mode watch

Options :
  • --testPathPattern
  • -t
  • --testNamePattern
  • --help
nest test:cov
Description :

Lance les tests avec couverture de code

Options :
  • --watch
  • --testPathPattern
  • -t
  • --help
nest test:debug
Description :

Lance les tests en mode debug

Options :
  • --testPathPattern
  • -t
  • --help
nest test:e2e
Description :

Lance les tests end-to-end

Options :
  • --watch
  • --testPathPattern
  • -t
  • --config
  • -c
  • --help
npm run test
Description :

Lance les tests (script package.json)

Options :
  • --
  • --watch
  • --coverage
  • --verbose
npm run test:watch
Description :

Lance les tests en watch (script)

npm run test:cov
Description :

Lance les tests avec couverture (script)

npm run test:e2e
Description :

Lance les tests e2e (script)

nest info
Description :

Affiche les informations sur le projet NestJS

Options :
  • --help
nest update
Description :

Met à jour les dépendances NestJS

Options :
  • --force ⚠️
  • -f ⚠️
  • --tag
  • -t
  • --dry-run ⚠️
  • -d
  • --help
nest add
Description :

Ajoute une bibliothèque NestJS au projet

Options :
  • --project
  • -p
  • --dry-run ⚠️
  • -d
  • --skip-install
  • --help
npm install @nestjs/config
Description :

Installe le module de configuration NestJS

Options :
  • --save
  • -S
  • --help
npm install @nestjs/typeorm typeorm
Description :

Installe TypeORM pour NestJS

Options :
  • --save
  • -S
  • mysql2
  • pg
  • sqlite3
  • --help
npm install @nestjs/mongoose mongoose
Description :

Installe Mongoose pour MongoDB

Options :
  • --save
  • -S
  • --help
npm install @nestjs/graphql @nestjs/apollo graphql apollo-server-express
Description :

Installe GraphQL avec Apollo pour NestJS

Options :
  • --save
  • -S
  • --help
npm install @nestjs/microservices
Description :

Installe le module microservices NestJS

Options :
  • --save
  • -S
  • kafkajs
  • amqplib
  • nats
  • redis
  • --help
npm install @nestjs/swagger swagger-ui-express
Description :

Installe Swagger pour la documentation API

Options :
  • --save
  • -S
  • --help
npm install @nestjs/jwt @nestjs/passport passport passport-jwt
Description :

Installe JWT et Passport pour l'authentification

Options :
  • --save
  • -S
  • bcrypt
  • --help
npm install @nestjs/throttler
Description :

Installe le module de rate limiting

Options :
  • --save
  • -S
  • --help
npm install @nestjs/schedule
Description :

Installe le module de planification de tâches

Options :
  • --save
  • -S
  • --help
npm install @nestjs/event-emitter
Description :

Installe l'émetteur d'événements

Options :
  • --save
  • -S
  • --help
npm install @nestjs/cache-manager cache-manager
Description :

Installe le module de cache

Options :
  • --save
  • -S
  • cache-manager-redis-store ⚠️
  • --help
npm install @nestjs/serve-static
Description :

Installe le module pour servir des fichiers statiques

Options :
  • --save
  • -S
  • --help
npm install @nestjs/axios axios
Description :

Installe le module HTTP pour NestJS

Options :
  • --save
  • -S
  • --help
npm install @nestjs/websockets @nestjs/platform-socket.io
Description :

Installe WebSockets avec Socket.io

Options :
  • --save
  • -S
  • --help
npm install @nestjs/bull bull
Description :

Installe Bull pour les files d'attente

Options :
  • --save
  • -S
  • @types/bull
  • --help
npm install @nestjs/bullmq bullmq
Description :

Installe BullMQ pour les files d'attente

Options :
  • --save
  • -S
  • --help
npm install class-validator class-transformer
Description :

Installe les validateurs pour les DTO

Options :
  • --save
  • -S
  • --help
npm install helmet
Description :

Installe Helmet pour la sécurité HTTP

Options :
  • --save
  • -S
  • --help
npm install compression
Description :

Installe la compression pour les réponses HTTP

Options :
  • --save
  • -S
  • @types/compression
  • --help
npm install cookie-parser
Description :

Installe le parser de cookies

Options :
  • --save
  • -S
  • @types/cookie-parser
  • --help
npm install express-rate-limit
Description :

Installe le rate limiting pour Express

Options :
  • --save
  • -S
  • --help
npm install winston
Description :

Installe Winston pour le logging avancé

Options :
  • --save
  • -S
  • nest-winston
  • --help
npm install pino-http pino
Description :

Installe Pino pour le logging performant

Options :
  • --save
  • -S
  • nestjs-pino
  • --help
npm install prisma --save-dev
Description :

Installe Prisma comme ORM alternatif

Options :
  • --help
npx prisma init
Description :

Initialise Prisma dans le projet

Options :
  • --datasource-provider
  • --help
npx prisma generate
Description :

Génère le client Prisma

Options :
  • --schema
  • --watch
  • --help
npx prisma migrate dev
Description :

Crée et applique les migrations Prisma

Options :
  • --name
  • --create-only
  • --skip-seed
  • --help
npx prisma studio
Description :

Ouvre Prisma Studio pour visualiser les données

Options :
  • --port
  • --browser
  • --help
npx prisma db push
Description :

Pousse le schéma vers la base de données

Options :
  • --skip-generate
  • --accept-data-loss
  • --help
npx prisma db seed
Description :

Exécute les seeds Prisma

Options :
  • --help
npm install @nestjs/cli --save-dev
Description :

Installe la CLI NestJS localement

Options :
  • --help
npm install --save-dev @types/node
Description :

Installe les types Node.js

Options :
  • --help
npm install --save-dev @types/express
Description :

Installe les types Express

Options :
  • --help
npm install --save-dev @types/jest
Description :

Installe les types Jest

Options :
  • --help
npm install --save-dev @types/supertest
Description :

Installe les types Supertest pour tests e2e

Options :
  • --help
npm install --save-dev supertest
Description :

Installe Supertest pour tests HTTP

Options :
  • --help
npm install --save-dev ts-node
Description :

Installe ts-node pour exécuter TypeScript

Options :
  • --help
npm install --save-dev nodemon
Description :

Installe Nodemon pour le rechargement automatique

Options :
  • --help
npm install --save-dev tsconfig-paths
Description :

Installe le support des paths TypeScript

Options :
  • --help
npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint
Description :

Installe ESLint pour TypeScript

Options :
  • --help
npm install --save-dev prettier
Description :

Installe Prettier pour le formatage

Options :
  • --help
npm install --save-dev eslint-config-prettier eslint-plugin-prettier
Description :

Installe l'intégration ESLint + Prettier

Options :
  • --help
npm install --save-dev husky
Description :

Installe Husky pour les hooks Git

Options :
  • --help
npx husky init
Description :

Initialise Husky

Options :
  • --help
npm install --save-dev lint-staged
Description :

Installe lint-staged pour linter les fichiers stagés

Options :
  • --help
npm install --save-dev @commitlint/cli @commitlint/config-conventional
Description :

Installe commitlint pour valider les messages de commit

Options :
  • --help
npm run lint
Description :

Lance ESLint sur le projet

Options :
  • --
  • --fix ⚠️
  • --max-warnings
npm run format
Description :

Formate le code avec Prettier

Options :
  • --
  • --write
  • --check
npx typeorm
Description :

CLI TypeORM

Options :
  • schema:sync
  • schema:drop
  • schema:log
  • migration:create
  • migration:generate
  • migration:run
  • migration:revert
  • query
  • cache:clear
  • init
  • help
npx typeorm migration:create
Description :

Crée une migration TypeORM vide

Options :
  • --name
  • -n
  • --help
npx typeorm migration:generate
Description :

Génère une migration basée sur les changements

Options :
  • --dataSource
  • -d
  • --name
  • -n
  • --pretty
  • --help
npx typeorm migration:run
Description :

Exécute les migrations

Options :
  • --dataSource
  • -d
  • --transaction
  • --help
npx typeorm migration:revert
Description :

Annule la dernière migration

Options :
  • --dataSource
  • -d
  • --transaction
  • --help
npx typeorm schema:sync
Description :

Synchronise le schéma avec les entités

Options :
  • --dataSource
  • -d
  • --help
npx typeorm cache:clear
Description :

Vide le cache TypeORM

Options :
  • --dataSource
  • -d
  • --help
npx mikro-orm
Description :

CLI MikroORM

Options :
  • schema:create
  • schema:update
  • schema:drop
  • migration:create
  • migration:up
  • migration:down
  • cache:clear
  • debug
  • generate:entities
  • help
npx mikro-orm migration:create
Description :

Crée une migration MikroORM

Options :
  • --blank
  • --initial
  • --dump
  • --help
npx mikro-orm migration:up
Description :

Exécute les migrations MikroORM

Options :
  • --from ⚠️
  • --to
  • --only
  • --dry-run ⚠️
  • --help
npx mikro-orm schema:update
Description :

Met à jour le schéma MikroORM

Options :
  • --dump
  • --dry-run ⚠️
  • --safe
  • --help
npx sequelize-cli init
Description :

Initialise Sequelize

Options :
  • --help
npx sequelize-cli model:generate
Description :

Génère un modèle Sequelize

Options :
  • --name
  • --attributes
  • --help
npx sequelize-cli db:migrate
Description :

Exécute les migrations Sequelize

Options :
  • --to
  • --from ⚠️
  • --help
npx sequelize-cli db:seed:all
Description :

Exécute tous les seeds Sequelize

Options :
  • --help
docker build -t nest-app .
Description :

Construit l'image Docker pour NestJS

Options :
  • --build-arg
  • --tag
  • -t
  • --file ⚠️
  • -f ⚠️
  • --help
docker run -p 3000:3000 nest-app
Description :

Lance le conteneur Docker NestJS

Options :
  • --env
  • -e
  • --env-file ⚠️
  • --name
  • --rm ⚠️
  • -d
  • --help
docker-compose up
Description :

Lance Docker Compose pour NestJS

Options :
  • --build
  • -d
  • --detach
  • --help
docker-compose down
Description :

Arrête les conteneurs Docker Compose

Options :
  • -v
  • --volumes
  • --help
npm run build
Description :

Compile le projet TypeScript

Options :
  • --
  • --watch
npx nestia sdk
Description :

Génère un SDK client avec Nestia

Options :
  • --input
  • --output
  • --project
  • --help
npx nestia swagger
Description :

Génère la documentation Swagger avec Nestia

Options :
  • --input
  • --output
  • --help
npx @compodoc/compodoc -p tsconfig.json -s
Description :

Génère et sert la documentation Compodoc

Options :
  • -p
  • --tsconfig
  • -s
  • --serve
  • -w
  • --watch
  • --output
  • --port
  • --help
npx @compodoc/compodoc -p tsconfig.json
Description :

Génère la documentation Compodoc

Options :
  • --output
  • --theme
  • --name
  • --hideGenerator
  • --help
npm run doc
Description :

Génère la documentation (script personnalisé)

npm run prebuild
Description :

Nettoie le dossier dist avant le build

npm run postbuild
Description :

Copie les fichiers non-TypeScript après build

npx rimraf dist
Description :

Supprime le dossier dist

npx copyfiles -u 1 "src/**/*.hbs" dist/
Description :

Copie les templates Handlebars après build

Options :
  • -u
  • --up
  • -e
  • --exclude
  • --help
npx copyfiles -u 1 "src/**/*.graphql" dist/
Description :

Copie les fichiers GraphQL après build

Options :
  • -u
  • --up
  • --help
npx cross-env NODE_ENV=production node dist/main
Description :

Lance l'application avec variable d'environnement

npx env-cmd -f .env.production node dist/main
Description :

Lance avec fichier .env spécifique

Options :
  • -f ⚠️
  • --file ⚠️
  • --help
npx pm2 start dist/main.js --name nest-api
Description :

Lance NestJS avec PM2

Options :
  • --name
  • -i
  • --instances
  • --env
  • --log
  • --output
  • --error
  • --help
npx pm2 restart nest-api
Description :

Redémarre l'application PM2

Options :
  • --update-env
  • --help
npx pm2 stop nest-api
Description :

Arrête l'application PM2

Options :
  • --help
npx pm2 logs nest-api
Description :

Affiche les logs PM2

Options :
  • --lines
  • --raw ⚠️
  • --help
npx pm2 delete nest-api
Description :

Supprime l'application PM2

Options :
  • --help
npx pm2 save
Description :

Sauvegarde la configuration PM2

Options :
  • --help
npx pm2 startup
Description :

Configure le démarrage automatique PM2

Options :
  • --help
npx pm2 monit
Description :

Surveille les applications PM2

Options :
  • --help

Partager