Skip to main content

Ledgiventa - Shared Models

This folder contains all shared domain models and types used across the Ledgiventa platform (backend, frontend, and lambdas). All models are defined in TypeScript and include an ownerId field for SaaS multi-tenancy. Models are versioned and refactored only in this folder for consistency.

Purpose

  • Centralizes domain model definitions for consistency and type safety
  • Ensures all business logic, API, and data storage use the same models
  • Supports SaaS multi-tenancy by requiring an ownerId field in every model

Structure

shared/
├── src/ # Model and type definitions
├── test/ # Shared model tests
├── package.json # Shared dependencies
├── tsconfig.json # TypeScript config
└── README.md # This file

Key Principles

  • All models must include an ownerId field (used as the subdomain for master accounts)
  • Only master accounts are created on signup; sub-users are invited by the admin
  • All API, DynamoDB, and business logic must scope data by ownerId
  • Use Clerk.com organizations for member management and invitations
  • Lambda@Edge augments API claims with ownerId from the subdomain
  • All model changes are documented in /docs/architecture/README.md and versioned for traceability.

Usage

  • Always import types from shared/models in backend, frontend, and lambda code
  • Update or refactor model definitions only in this folder
  • When adding new models, create a new file in src/ and export from src/index.ts

Documentation

See ../docs/architecture/README.md for details on domain modeling and multi-tenancy. See ../docs/guides/development.md for development setup.