Skip to main content
Developer reference for the persistence model of the Hitaji 360 Accounting service. Every entity below is a real TypeORM class under hitaji-erp-api/src/accounting/entities/. Column names are the actual database column names (TypeORM name: where it differs from the camelCase property).
Read this first — the three scoping columns See multi-tenancy.md for how these are enforced.

Base classes

Most entities extend one of two base classes (src/common/entities/): A number of child-line entities define their own id (and sometimes a nullable tenant_id) instead of extending BaseEntity — they are reached only through their parent and cascade-delete with it. These are called out in the tables below.

Domain 1 — Chart of Accounts & General Ledger

Core ledger cluster (ER diagram)

JournalEntry/JournalLine vs AccountingLedgerEntry — A journal entry is the editable/approvable document. On post() the posting pipeline writes the immutable accounting_ledger_entries rows (the actual GL). Reports and balances read from accounting_ledger_entries; the journal_lines carry the sub-ledger (against_invoice_id/against_bill_id) and bank-rec clearance tags.

Domain 2 — Sales (Invoices, Quotations, Credit Notes)

Credit notes are Invoice rows with documentType = CREDIT_NOTE; debit notes are Bill rows with documentType = DEBIT_NOTE. Their allocations live in payment_allocations (see Money).

Domain 3 — Purchases (Bills, Expenses, Petty Cash)


Domain 4 — Money (Payments, Allocations, Loans, Bank Reconciliation, Debts)


Domain 5 — Masters (Contacts, Categories, Tax, Withholding, Payment Terms)


Domain 6 — Budgeting & Cost Centers


These are the plumbing that lets other products post into accounting idempotently and durably. They scope by tenant_id (+ business_id/book_id), not workspace_id.

Domain 8 — Sequences & lifecycle records


JournalSourceType — the product provenance enum

AccountingLedgerEntry.source_type / JournalEntry.source_type tags every GL row with the upstream module that produced it. The full enum (enums/journal-source-type.enum.ts) includes the native accounting sources (INVOICE, BILL, PAYMENT, RECEIPT, MANUAL, OPENING_BALANCE, ADJUSTMENT, CREDIT_NOTE, PETTY_CASH, BANK_LOAN) plus cross-product sources that bridge into accounting: payroll/HR (PAYROLL, SALARY_ADVANCE, EMPLOYEE_LOAN, SEPARATION_SETTLEMENT, GRATUITY_PROVISION, STATUTORY_REMITTANCE, REIMBURSEMENT, IMPREST), fixed-assets (ASSET_*, DEPRECIATION), retail (RETAIL_*), agriculture (AGRI360_*), SACCO (SACCO_*), and faith (FAITH360_GIVING).

Gaps / notes for reviewers

  • The child-line entity field lists (Domains 2–8) and the business_id annotations were extracted by reading each entity file; spot-verified Invoice, JournalLine, Account, AccountingBook, AccountingPeriod, JournalEntry directly. If you change a column, regenerate the relevant table.
  • Invoice, Bill, Quotation extend SubmittableEntity (docstatus lifecycle); Expense and Budget carry a docstatus column but extend BaseEntity.
  • Several entities referenced here have additional reporting/scheduling siblings not tabulated (e.g. AccountingReportPreset, AccountingReportSchedule, AccountingReportSnapshot, ChartImportBatch, AccountingChartSetup, PrintSettings, ReminderSettings, RecurringTransactionHistory). See docs/accounting-reports.md for the reporting cluster.