Tenant-Aware Services and Models
Planned page
This is the second NestJS framework-track page. The detailed walkthrough will be added with its brief. The runnable checkpoint currently implements the Overview & Runtime Boundary only.
Purpose
Turn the execution-bound service into a tenant-aware Workspace API. Resolving identity at ingress and resolving tenant infrastructure are separate responsibilities.
Planned scope
- Define tenant validation, authorization boundaries, and explicit HTTP error behavior without a fallback tenant.
- Add
core/db.tsandcore/tenancy.tsfor reusable database infrastructure. - Connect
MultiTenantManagerto a context-awareUserModel. - Use the model through
UsersServicewithout passing NestJS request objects or routine tenant arguments into model calls. - Verify isolated persistence for multiple tenants.
Target checkpoint
text
NestJS Request → Ambiten Interceptor → AmbitenContext
↓
UsersController
↓
UsersService
↓
UserModel
↓
Tenant Infrastructure
↓
Tenant DatabaseTransactions remain out of scope until actual tenant-specific reads and writes work.
Previous: NestJS Overview & Runtime Boundary.
Next: Transaction Continuity Across Services, also planned.
