Enforcing Multi-Tenant Isolation Structurally, Not by Convention
Originally published at nazmulkhalid.com. TL;DR: Relying on every query to remember WHERE schoolId = ... doesn't survive a real codebase. Bicitra EMS injects the tenant scope automatically with a Prisma Client Extension, but a nested include still bypassed it and leaked one school's data through seven endpoints. The fix was structural: a central registry of tenant-scoped foreign keys, validated at write time, so new endpoints are protected by default. Bicitra EMS is a multi-tenant education man…