tenancy
PostgreSQL RLS + Prisma multi-tenancy. Row-level isolation out of the box.
v0.8.0
Multi-tenancy, audit logs, feature flags, and more — built on Prisma & PostgreSQL
Every multi-tenant SaaS backend needs the same six features. Building them from scratch takes weeks and introduces subtle bugs. nestarc solves them once, correctly.
// Scattered across 50+ services, easy to forget, hard to audit
async updateUser(id: string, dto: UpdateUserDto) {
const before = await this.prisma.user.findUnique({ where: { id } });
await this.prisma.$executeRaw`SELECT set_config('app.current_tenant', ${tenantId}, true)`;
const after = await this.prisma.user.update({ where: { id, deletedAt: null }, data: dto });
await this.auditService.log({ action: 'user.update', before, after });
return { success: true, data: after, timestamp: new Date() };
}// Tenant isolation, audit logging, soft-delete filtering, and response wrapping
// are all handled automatically by Prisma extensions and NestJS interceptors.
async updateUser(id: string, dto: UpdateUserDto) {
return this.prisma.user.update({ where: { id }, data: dto });
}