nestjs-npm-packager
v1.1.4
Published
Professional NestJS npm package starter kit with TypeScript support
Maintainers
Readme
NestJS NPM Packager
Professional NestJS npm package starter kit with TypeScript support. Create production-ready NestJS packages with a single command.
🚀 Features
- Multiple Templates: Basic, Advanced, and Microservice templates
- TypeScript Support: Full TypeScript configuration and type safety
- Feature Selection: Choose from Swagger, Validation, Database, Auth, Testing, Docker, Logging, and Monitoring
- Professional Structure: Best practices folder structure and configuration
- CLI Interface: Easy-to-use command-line interface
- Interactive Mode: Guided package creation process
📦 Installation
npm install -g nestjs-npm-packager🎯 Quick Start
Interactive Mode
nestjs-packager initCommand Line Mode
# Create basic package
nestjs-packager create my-package
# Create advanced package with features
nestjs-packager create my-package -t advanced -f swagger,validation,database
# Create microservice
nestjs-packager create my-service -t microservice -f auth,monitoring📋 Available Templates
Basic Template
- Essential NestJS setup
- Validation with class-validator
- Testing with Jest
- TypeScript configuration
Advanced Template
- Full-featured NestJS application
- Swagger/OpenAPI documentation
- Database integration (TypeORM)
- Authentication & Authorization
- Logging and Monitoring
- Comprehensive testing setup
Microservice Template
- Microservice architecture
- Communication protocols
- Service discovery
- Monitoring and logging
- Docker support
🔧 Available Features
| Feature | Description | Dependencies |
| ------------ | ------------------------------ | ---------------------------------------- |
| swagger | OpenAPI/Swagger documentation | @nestjs/swagger |
| validation | Request validation | class-validator, class-transformer |
| database | Database integration | @nestjs/typeorm, typeorm |
| auth | Authentication & Authorization | @nestjs/jwt, @nestjs/passport |
| testing | Testing setup | @nestjs/testing, jest |
| docker | Docker configuration | Docker files |
| logging | Structured logging | winston, nest-winston |
| monitoring | Application monitoring | prom-client, @willsoto/nestjs-prometheus |
📁 Generated Structure
my-package/
├── src/
│ ├── app.controller.ts
│ ├── app.module.ts
│ ├── app.service.ts
│ ├── main.ts
│ ├── common/
│ │ ├── decorators.ts
│ │ ├── filters.ts
│ │ └── interfaces.ts
│ ├── config/
│ │ ├── database.config.ts
│ │ └── logger.config.ts
│ ├── auth/ (if auth feature selected)
│ └── monitoring/ (if monitoring feature selected)
├── test/
│ └── app.e2e-spec.ts
├── package.json
├── tsconfig.json
├── jest.config.js
├── .eslintrc.js
├── .gitignore
├── Dockerfile (if docker feature selected)
├── docker-compose.yml (if docker feature selected)
└── README.md🛠️ Commands
Create Package
nestjs-packager create <name> [options]Options:
-t, --template <template>- Template type (basic, advanced, microservice)-f, --features <features>- Comma-separated list of features-d, --directory <directory>- Output directory--author <author>- Package author name--email <email>- Author email--description <description>- Package description--license <license>- Package license--repository <repository>- Repository URL--keywords <keywords>- Comma-separated keywords
List Templates
nestjs-packager listInteractive Mode
nestjs-packager init📝 Examples
Create a Basic API Package
nestjs-packager create my-api -t basic -f swagger,validationCreate a Microservice with Auth
nestjs-packager create user-service -t microservice -f auth,monitoring,docker🔄 Next Steps
After creating your package:
Navigate to the package directory:
cd my-packageInstall dependencies:
npm installStart development:
npm run start:devAccess Swagger documentation (if enabled):
http://localhost:3000/api
🧪 Testing
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov🐳 Docker Support
If you selected the docker feature:
# Build Docker image
npm run docker:build
# Run with Docker Compose
npm run docker:compose📊 Monitoring
If you selected the monitoring feature, metrics will be available at:
http://localhost:3000/metrics🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- NestJS - Progressive Node.js framework
- TypeScript - Typed JavaScript
- Commander.js - Command-line interfaces
- Inquirer.js - Interactive command line user interfaces
Made with ❤️ for the NestJS community
