NestJS module for multi-tenancy with deep integration into Sequelize and TypeORM.
- Automatic tenant injection into all Sequelize and TypeORM operations
- Header and query parameter based tenant extraction
- Transparent Sequelize hooks (8 hooks covering all CRUD operations)
- TypeORM subscriber for writes +
TenantBaseRepositoryfor reads - Pluggable storage (Sequelize, TypeORM) with optional caching (IoRedis)
- Swagger integration via
@MTApi()decorator - Per-operation, per-scope, and global tenancy control
| nestjs-mtenant | NestJS | Node.js | Sequelize | TypeORM |
|---|---|---|---|---|
| 1.x | 11.x | >= 20 | 6.x | 0.3.x |
| 0.x | 9.x - 10.x | >= 14 | 6.x | - |
npm install nestjs-mtenant nestjs-cls
# For Sequelize support:
npm install sequelize sequelize-typescript
# For TypeORM support:
npm install typeormFull documentation is available on GitHub Pages.
- Getting Started
- Configuration
- Sequelize Integration
- TypeORM Integration
- Storage & Caching
- Swagger Integration
- Advanced Usage
- Migration Guide (v0.x to v1.0)
Statements : 92.89% (471/507)
Branches : 97.02% (196/202)
Functions : 98.27% (114/116)
Lines : 92.84% (467/503)
# Run tests
npm test
# Build
npm run build
# Release
npm run format
npm run release # or: npm run patch | minor | major
npm run deployMIT