multi-tenant-api-route

Community

Secure multi-tenant API routes with isolation

Authordoorscomputers
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Securely implement multi-tenant API routes that enforce authentication, authorization, and business data isolation across all /src/app/api endpoints.

Core Features & Use Cases

  • Enforced multi-tenant isolation via mandatory businessId filtering on all queries.
  • Authentication using NextAuth session with structured user object including permissions and roles.
  • Role-based access control with configurable PERMISSIONS checks.
  • Ownership verification for GET/PUT/DELETE operations to prevent cross-tenant access.
  • Soft delete support and consistent error handling for API routes.

Quick Start

Review existing /src/app/api routes and apply the standard multi-tenant pattern to new endpoints. Implement authentication with getServerSession(authOptions), extract businessId from session.user, and enforce permission checks using PERMISSIONS. Ensure every Prisma query includes businessId: parseInt(user.businessId) and implement soft deletes where applicable.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: multi-tenant-api-route
Download link: https://github.com/doorscomputers/nextjspos/archive/main.zip#multi-tenant-api-route

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.