Command-line interface tool for initializing, developing, and maintaining NestJS applications
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Add external libraries to your NestJS project with automated setup, configuration, and integration. The add command streamlines the process of incorporating third-party packages and NestJS-specific libraries into your application.
Integrates external libraries with automated setup and configuration management.
# Add library to project
nest add <library> [options] [library-specific-options]
# Options:
-d, --dry-run # Report actions without writing results
-s, --skip-install # Skip package installation (default: false)
-p, --project [project] # Project in which to generate files
[library-specific-options] # Additional options passed to the library's schematicUsage Examples:
# Add Swagger/OpenAPI support
nest add @nestjs/swagger
# Add GraphQL support
nest add @nestjs/graphql
# Add database integration
nest add @nestjs/typeorm
nest add @nestjs/mongoose
# Add authentication
nest add @nestjs/passport
# Preview changes without installing
nest add @nestjs/swagger --dry-run
# Add to specific project in monorepo
nest add @nestjs/swagger --project api-gateway
# Skip automatic package installation
nest add @nestjs/swagger --skip-installOfficial NestJS packages with automated integration:
# Web Framework Enhancements
nest add @nestjs/swagger # OpenAPI/Swagger documentation
nest add @nestjs/graphql # GraphQL API development
nest add @nestjs/websockets # WebSocket support
nest add @nestjs/microservices # Microservices architecture
# Database Integration
nest add @nestjs/typeorm # TypeORM database integration
nest add @nestjs/mongoose # MongoDB with Mongoose
nest add @nestjs/sequelize # Sequelize ORM
nest add @nestjs/prisma # Prisma database toolkit
# Authentication & Security
nest add @nestjs/passport # Passport authentication
nest add @nestjs/jwt # JSON Web Token support
nest add @nestjs/throttler # Rate limiting
# Caching & Performance
nest add @nestjs/cache-manager # Caching solutions
nest add @nestjs/bull # Queue management
nest add @nestjs/schedule # Task scheduling
# Monitoring & Logging
nest add @nestjs/terminus # Health checks
nest add @nestjs/logger # Enhanced logging
# Configuration
nest add @nestjs/config # Configuration management
nest add @nestjs/serve-static # Static file servingMany popular Node.js libraries with NestJS schematics:
# State Management
nest add @ngrx/store # Redux-style state management
# Validation
nest add class-validator # Decorator-based validation
nest add joi # Schema validation
# Testing
nest add @nestjs/testing # Enhanced testing utilities
# Development Tools
nest add @nestjs/devtools-integration # NestJS DevToolsMany libraries accept additional configuration options during installation:
# Basic Swagger setup
nest add @nestjs/swagger
# With custom configuration
nest add @nestjs/swagger --project api --title "My API" --version "1.0"# Apollo GraphQL (default)
nest add @nestjs/graphql
# With schema-first approach
nest add @nestjs/graphql --schemaFirst
# With custom configuration
nest add @nestjs/graphql --playground --introspection# Basic TypeORM setup
nest add @nestjs/typeorm
# With specific database
nest add @nestjs/typeorm --database postgres
nest add @nestjs/typeorm --database mysql
nest add @nestjs/typeorm --database sqliteWhen adding a library, the CLI typically performs:
nest add @nestjs/swaggerGenerated Changes:
@nestjs/swagger and swagger-ui-expressmain.ts with Swagger configuration/apinest add @nestjs/typeormGenerated Changes:
@nestjs/typeorm, typeorm, and database driverormconfig.json or database configurationapp.module.ts with TypeORM moduleAdded libraries often create configuration files:
project-root/
├── ormconfig.json # TypeORM configuration
├── .env # Environment variables
├── swagger-config.json # Swagger configuration
└── src/
├── config/ # Configuration modules
├── entities/ # Database entities
└── modules/ # Feature modulesLibraries typically integrate into the module system:
// app.module.ts after adding libraries
@Module({
imports: [
ConfigModule.forRoot(),
TypeOrmModule.forRoot({
// Database configuration
}),
GraphQLModule.forRoot({
// GraphQL configuration
}),
// Other modules...
],
})
export class AppModule {}# Add to specific application
nest add @nestjs/swagger --project api-gateway
nest add @nestjs/typeorm --project user-service
# Add to shared library
nest add @nestjs/common --project shared-utilsSome libraries can be shared across monorepo projects:
# Add shared authentication library
nest add @nestjs/passport --project auth-lib
# Add project-specific database connection
nest add @nestjs/typeorm --project user-serviceSome libraries provide custom schematics for advanced setup:
# Run specific library schematics
nest add @my-org/custom-lib --schematic advanced-setup
nest add @nestjs/graphql --schematic federationPass configuration directly during installation:
# Complex configuration
nest add @nestjs/typeorm \
--database postgres \
--host localhost \
--port 5432 \
--synchronize false# See what would be changed
nest add @nestjs/swagger --dry-runDry Run Output:
# Skip automatic package installation
nest add @nestjs/swagger --skip-install
# Then manually install
npm install @nestjs/swagger swagger-ui-express# Complete API documentation setup
nest add @nestjs/swagger
nest add @nestjs/config # For environment-based configuration# Full backend setup
nest add @nestjs/typeorm
nest add @nestjs/passport
nest add @nestjs/jwt
nest add @nestjs/config# GraphQL with database
nest add @nestjs/graphql
nest add @nestjs/typeorm
nest add apollo-server-express# Unknown library
nest add unknown-library
# Error: Schematic "ng-add" not found in collection "unknown-library"The CLI detects and reports dependency conflicts:
If package installation fails, the CLI: