β€οΈβπ₯ Comprehensive collection of modules, decorators, and utilities for building powerful NestJS applications β€οΈβπ₯
π Production Ready: Battle-tested modules used in production environments
π TypeScript: Full TypeScript support with strict type checking
β‘ Fast: Optimized for performance with minimal overhead
π§ Modular: Use only what you need, tree-shakeable packages
π¦ Well Documented: Comprehensive documentation and examples
π― Focused: Essential functionality without bloat
| Package | Version | Size | Description |
|---|---|---|---|
| @nestlib/access-logger | HTTP request logging middleware for NestJS | ||
| @nestlib/auth | Authentication helpers with OTP support | ||
| @nestlib/cache | Caching decorators and utilities | ||
| @nestlib/config | Configuration management module | ||
| @nestlib/crypto | Cryptographic operations (bcrypt, hashing) | ||
| @nestlib/decorators | Custom parameter decorators and transformers | ||
| @nestlib/interceptors | Response and error interceptors | ||
| @nestlib/lsk | LSK module wrapper for NestJS | ||
| @nestlib/mikro-orm | MikroORM logger factory integration | ||
| @nestlib/mutex | Distributed locking and mutex utilities | ||
| @nestlib/notify | Notification sender (Telegram, Slack, Email) | ||
| @nestlib/rabbitmq | RabbitMQ integration with RPC support | ||
| @nestlib/redis | Redis client and service wrapper | ||
| @nestlib/upload | File upload service for AWS S3 | ||
| @nestlib/utils | Common utilities and helpers |
npm install @nestlib/access-loggerimport { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
import { AccessLoggerMiddleware } from '@nestlib/access-logger';
@Module({})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(AccessLoggerMiddleware)
.forRoutes('*');
}
}npm install @nestlib/authimport { AuthModule } from '@nestlib/auth';
@Module({
imports: [AuthModule.forRoot({ ... })],
})
export class AppModule {}npm install @nestlib/cacheimport { Cache } from '@nestlib/cache';
@Controller('users')
export class UsersController {
@Cache({ ttl: 60 })
@Get(':id')
async getUser(@Param('id') id: string) {
return this.usersService.findOne(id);
}
}npm install @nestlib/configimport { ConfigModule } from '@nestlib/config';
@Module({
imports: [ConfigModule.forRoot()],
})
export class AppModule {}npm install @nestlib/cryptoimport { CryptoService } from '@nestlib/crypto';
@Injectable()
export class AuthService {
constructor(private cryptoService: CryptoService) {}
async hashPassword(password: string) {
return this.cryptoService.hash(password);
}
}npm install @nestlib/decoratorsimport { Query, Data } from '@nestlib/decorators';
@Controller('search')
export class SearchController {
@Get()
async search(@Query('q') query: string, @Data() data: any) {
// ...
}
}npm install @nestlib/interceptorsimport { ResponseInterceptor, ErrorInterceptor } from '@nestlib/interceptors';
@UseInterceptors(ResponseInterceptor, ErrorInterceptor)
@Controller('api')
export class ApiController {}npm install @nestlib/redisimport { RedisModule } from '@nestlib/redis';
@Module({
imports: [RedisModule.forRoot({ ... })],
})
export class AppModule {}npm install @nestlib/rabbitmqimport { RmqModule } from '@nestlib/rabbitmq';
@Module({
imports: [RmqModule.forRoot({ ... })],
})
export class AppModule {}- Request ID Generation: Unique request IDs for tracing
- Smart Log Levels: Automatic log level based on status codes and response time
- Comprehensive Logging: Method, URL, IP, user agent, status, duration, and more
- WebSocket Support: Special handling for WebSocket connections
- IP Detection: Automatic client IP extraction from headers
- OTP Support: One-time password generation and validation
- Session Management: Express session integration with MongoDB storage
- Password Reset: Complete password reset flow with email support
- User Models: Ready-to-use user and OTP models for MikroORM
- Guards & Decorators:
@Auth()decorator andAuthGuardfor route protection
- Decorator-based:
@Cache()and@LruCache()decorators - LRU Cache: In-memory LRU cache support
- Cache Manager Integration: Works with NestJS Cache Manager
- Cache Invalidation:
@IgnoreCache()decorator for selective invalidation
- Environment Variables: Automatic
.envfile loading - Type-safe Configuration: Full TypeScript support
- Module Integration: Seamless NestJS Config module integration
- Validation: Configuration validation with error handling
- Password Hashing: bcrypt and bcryptjs support
- Secure Operations: Cryptographic utilities for hashing and comparison
- Async Operations: Promise-based API
- Parameter Decorators:
@Query(),@Data(),@FindParams(),@QueryOrBody() - Transformers:
@Trim(),@ToLowerCase()for data transformation - Validation: Integrated with class-validator
- Response Interceptor: Standardized API response format
- Error Interceptor: Comprehensive error handling and formatting
- Pretty Errors: Human-readable error messages in development
- Request Context: Request ID and metadata tracking
- Distributed Locking: Redis-based distributed locks
- In-memory Locks: Async lock support for single-instance applications
- Decorator Support:
@Lock()decorator for automatic locking - Timeout Handling: Configurable lock timeouts
- Multi-channel: Telegram, Slack, and Email support
- Service Integration: Injectable
NotifyServicefor easy use - Error Notifications: Automatic error reporting
- RPC Support:
@RmqRPC()decorator for RPC handlers - Message Publishing: Easy message publishing with
RmqService - Error Handling: Automatic error callbacks and retries
- Interceptor: Request/response logging and error handling
- Service Wrapper: Simplified Redis client interface
- Connection Management: Automatic connection handling
- Type Safety: Full TypeScript support
- AWS S3 Integration: Direct S3 upload support
- Presigned URLs: Generate presigned URLs for secure uploads
- File Management: Upload, delete, and manage files in S3
- Exception Filter:
AnyExceptionFilterfor global error handling - Validation Pipe:
AnyValidationPipefor request validation - Logger Factory:
createNestLoggerfor consistent logging - Time Decorator:
@Time()decorator for performance measurement
# Install dependencies
pnpm install
# Build all packages
pnpm run build
# Run tests
pnpm run test
# Release packages
pnpm run releaseContributions are welcome! Please feel free to submit a Pull Request.
- Fork it (https://github.com/lskjs/nestlib/fork)
- Create your feature branch (
git checkout -b features/fooBar) - Commit your changes (
git commit -am 'feat: Add some fooBar') - Push to the branch (
git push origin feature/fooBar) - Create a new Pull Request
MIT Β© Igor Suvorov
@nestlib β Comprehensive modules and decorators for NestJS π―
