@venturekit-pro/tenancy
Installation
Section titled “Installation”npm install @venturekit-pro/tenancy@devWhat It Provides
Section titled “What It Provides”Tenant Context
Section titled “Tenant Context”import { TenantContext, createTenantContext, getCurrentTenant, resolveTenant } from '@venturekit-pro/tenancy';
const tenant = getCurrentTenant(ctx);// { id: 'acme', slug: 'acme', metadata: { ... } }Middleware
Section titled “Middleware”import { createTenantMiddleware, createQuotaMiddleware } from '@venturekit-pro/tenancy';
// Add to handler middlewaremiddleware: [ createTenantMiddleware({ strategy: 'subdomain' }), createQuotaMiddleware(),]Error Types
Section titled “Error Types”import { TenantNotFoundError, TenantSuspendedError, TenantInactiveError, QuotaExceededError } from '@venturekit-pro/tenancy';Quota Checking
Section titled “Quota Checking”import { checkQuotas } from '@venturekit-pro/tenancy';
await checkQuotas(tenantId, { apiRequests: { limit: 10000, period: 'month' },});Resolution Strategies
Section titled “Resolution Strategies”| Strategy | Source |
|---|---|
subdomain | acme.app.example.com |
custom-domain | app.acme.com (domain lookup) |
path | /t/acme/api/tasks |
header | X-Tenant-ID: acme |
jwt | tenant_id claim |
Dependencies
Section titled “Dependencies”@venturekit/core— required
Related
Section titled “Related”- Multi-Tenancy Guide — setup walkthrough
- Middleware — composing with other middleware
- WebSockets — tenant-scoped messaging
- API Reference — full type documentation