All domain models (e.g., Building, LedgerEntry, Unit) are defined in shared/models/.
Always import types from shared/models in all backend, frontend, and lambda code.
Update or refactor model definitions only in this folder.
When adding new models, create a new file in shared/models and export from shared/models/index.ts.
All models must include an ownerId field for SaaS multi-tenancy. This is assigned at master account creation and used as the subdomain name.
All API, DynamoDB, and business logic must scope data by ownerId.
On signup, only master accounts are created, requiring a max 40 character valid word for the subdomain. Sub-users can only be invited by the administrator via the users screen.
Use Clerk.com organization feature for member management and invitations.
Lambda@Edge must augment all API claims with the ownerId from the subdomain.
This ensures consistency, easy refactoring, and version control of all domain types and multi-tenant logic.