Skip to content

AlexanderC/nestjs-mtenant

Repository files navigation

Nest Logo

NestJS module for multi-tenancy with deep integration into Sequelize and TypeORM.

NPM Version Package License NPM Downloads

Features

  • 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 + TenantBaseRepository for reads
  • Pluggable storage (Sequelize, TypeORM) with optional caching (IoRedis)
  • Swagger integration via @MTApi() decorator
  • Per-operation, per-scope, and global tenancy control

Compatibility

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 -

Installation

npm install nestjs-mtenant nestjs-cls

# For Sequelize support:
npm install sequelize sequelize-typescript

# For TypeORM support:
npm install typeorm

Documentation

Full documentation is available on GitHub Pages.

Test Coverage

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 deploy

Contributing

License

MIT

About

NestJS module to enable deep multitenancy support.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages