Skip to content
All features
identity and trustpackages/iam/tenant

tenant package

Request-scoped tenant context via AsyncLocalStorage, with Prisma RLS bridge. One tenantId resolves through middleware and propagates the whole stack.

Open docs
Stability
Stable
Scope
Tenant-scoped
Boundary
packages/iam/tenant
tenantpackages/iam/tenant
Tenant-isolated
Policy decisionpass
  • Actor verified
    16 ms
  • Tenant scope
    7 ms
  • tenant authorized
    25 ms
  • Audit logged
    7 ms
Active session
actor_vcstark_5103
servicemfa
Expires in 39m

Active sessions

597

+2%

Audit entries / day

16,065

Policy checks / s

171

+2%
packages/iam/tenantIdentity and trust · single boundary
Usagetenant.ts
typescript
tenant.ts
1import { withTenant, getCurrentTenant } from "@nebutra/tenant";
2
3// AsyncLocalStorage scope — propagates across all awaits.
4await withTenant({ tenantId: org.id, plan: org.plan }, async () => {
5  const tenant = getCurrentTenant();
6  const posts = await prisma.post.findMany({
7    where: { tenantId: tenant.tenantId },
8  });
9});