Nestjs Saas Tenant Boilerplate

screenshot of Nestjs Saas Tenant Boilerplate

NestJS boilerplate for SaaS applications with single-database multi-tenancy, with JWT auth, CASL authorization, MIKRO-ORM Tenant implementation and more.

Overview

The NestJS SaaS Tenant Boilerplate is an impressive starting point for developers looking to build secure and scalable single-tenant applications. This boilerplate not only streamlines the development process but also incorporates essential features such as authentication, authorization, and tenant isolation, making it a robust solution for creating multi-tenant applications without complexity. With the modern technologies and architecture employed, it's designed to handle the demands of contemporary web applications effectively.

Built on NestJS, this boilerplate leverages powerful tools like MikroORM for database management and Passport.js for user authentication, ensuring that applications can run efficiently while maintaining high standards of security. The well-structured project facilitates easy navigation and quick integration into your development workflow, allowing you to focus on building exceptional features instead of worrying about the underlying setup.

Features

  • Single-DB-Tenant Architecture: Ensures complete tenant isolation by utilizing database filtering, allowing you to easily manage tenant-specific data.
  • Authentication: Implements JWT-based authentication with Passport.js, providing a secure way to handle user credentials and sessions.
  • Authorization with CASL: Utilizes Role-based Access Control (RBAC) through CASL, simplifying permission management across applications.
  • Database with MikroORM: Integrates with MariaDB, offering a powerful ORM solution for managing your database entities effectively.
  • Migrations & Seeding: Comes with built-in support for database migrations and seeding, making it simple to set up your database schema and initial data.
  • Rate Limiting: Incorporates API rate limiting using the @nestjs/throttler package, helping to prevent abuse and maintain API responsiveness.
  • Structured Logging with Pino: Enables efficient logging using Pino, facilitating easier tracking and debugging of application behavior.
  • Comprehensive JSDoc Documentation: Offers detailed documentation for all controllers and services, helping developers understand the functionalities and usage quickly.
eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.