wts-nest-cli
v1.0.6
Published
NestJS module generator CLI
Downloads
18
Readme
🚀 WTS Nest CLI
A simple and powerful CLI tool to generate NestJS modules quickly with all the required files (controller, service, repository, model, resolver, DTO, entity/schema) using interactive prompts.
📦 Installation
You can install globally using npm or yarn:
# Using npm
npm install -g wts-nest-cli
# Using yarn
yarn global add wts-nest-cli🛠 Usage
Run the following command to generate a new NestJS module:
wts g moduleThe CLI will ask you:
- Module name (e.g., user, blog, category)
- Database type (
TypeORMorMongoose)
Example:
$ wts g module
? Module name (e.g., user, blog, category): user
? Select database type: (Use arrow keys)
❯ TypeORM
Mongoose📂 Generated Files
For example, if you enter user and choose TypeORM, the following files will be created in:
src/modules/user/
user.module.ts
user.service.ts
user.controller.ts
user.resolver.ts
user.repository.ts
user.model.ts
user.dto.ts
user.entity.tsIf you choose Mongoose, the user.entity.ts will be replaced with:
user.schema.ts📋 Example Command Output
$ wts g module
? Module name (e.g., user, blog, category): product
? Select database type: TypeORM
✅ Generating NestJS module: product
✅ Created: src/modules/product/product.module.ts
✅ Created: src/modules/product/product.service.ts
✅ Created: src/modules/product/product.controller.ts
✅ Created: src/modules/product/product.resolver.ts
✅ Created: src/modules/product/product.repository.ts
✅ Created: src/modules/product/product.model.ts
✅ Created: src/modules/product/product.dto.ts
✅ Created: src/modules/product/product.entity.ts
🎉 Module 'product' generated successfully!⚡ Features
- ✨ Interactive prompts for module name and database type
- 🗄️ Supports TypeORM and Mongoose
- 📁 Generates all common NestJS files in the correct folder structure
- 📦 Works with npm and yarn
- 🚀 Fast and lightweight - no unnecessary dependencies
- 💻 Cross-platform support (Windows, macOS, Linux)
- 🎯 Zero configuration - works out of the box
🏗️ Generated File Structure
src/
└── modules/
└── {module-name}/
├── {module-name}.module.ts # Module definition
├── {module-name}.service.ts # Business logic
├── {module-name}.controller.ts # HTTP endpoints
├── {module-name}.resolver.ts # GraphQL resolver
├── {module-name}.repository.ts # Data access layer
├── {module-name}.model.ts # Data model interface
├── {module-name}.dto.ts # Data transfer objects
└── {module-name}.entity.ts # TypeORM entity
└── {module-name}.schema.ts # Mongoose schema (if selected)🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
MIT License © 2025 WTS Team
📞 Support
If you encounter any issues or have questions, please open an issue on GitHub.
Made with ❤️ by the WTS Team
