Skip to content

Data Definition Document: Finance Ledger

Domain: Finance (Ledger, Budget, AP, AR) Logical Sub-Domain: Ledger (Core Accounting) Physical Packages: @sd/mod-finance/ledger, @sd/mod-finance/budget Related Documents: Process Blueprint Context: This document defines the Data Structures for the GL and Budget. Source: packages/modules/finance/src/{ledger,budget}/schema.ts

0. Entity Relationship Diagram (ERD)

erDiagram
    ACCOUNT ||--o{ LEDGER_ENTRY : "sums_to"
    JOURNAL_ENTRY ||--o{ LEDGER_ENTRY : "contains"
    BUDGET ||--o{ BUDGET_LINE_ITEM : "defines"
    ACCOUNT ||--o{ BUDGET_LINE_ITEM : "targeted_by"

    ACCOUNT {
        string id PK
        string code
        enum type "asset, liability, equity, revenue, expense"
        float balance
    }

    JOURNAL_ENTRY {
        string id PK
        date date
        enum status "posted, void"
    }

    LEDGER_ENTRY {
        string accountId FK
        float debit
        float credit
        string entityId "Sub-Ledger Link"
    }

1. Primary Entities

Entity: JournalEntry

The atomic unit of financial truth.

Field Type Required Description
id string Yes Unique ID.
date Timestamp Yes Occurrence date.
entries LedgerEntry[] Yes List of Dr/Cr lines (Must balance).
status string Yes posted, void.
referenceId string No Link to Bill/Invoice.

Entity: Account

A node in the Chart of Accounts.

Field Type Required Description
code string Yes e.g. "1000".
name string Yes "Petty Cash".
type string Yes asset
balance number Yes Cached current value.

Entity: Budget

An annual financial plan.

Field Type Required Description
fiscalYear number Yes e.g. 2026.
status string Yes draft, approved.
lineItems object[] Yes Revenue/Expense targets.

4. Changelog

Date Author Description Reference
2026-01-24 Antigravity Initial creation Implementation Plan