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.
- Stability
- Stable
- Scope
- Tenant-scoped
- Boundary
- packages/iam/tenant
tenantpackages/iam/tenant
Tenant-isolated
Policy decisionpass
- Actor verified16 ms
- Tenant scope7 ms
- tenant authorized25 ms
- Audit logged7 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
typescripttenant.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});