When developers think about tracking loans to friends, they usually start with a deceptively simple mental model:
"If I lend Rahul Rs. 5,000, that is an expense of Rs. 5,000. When Rahul pays me back, that is income of Rs. 5,000."
This mental model is fundamentally broken.
If you record lending money as an ordinary living expense, your monthly budget shows a massive, artificial spending spike. You didn't spend Rs. 5,000 on goods or services; you simply converted liquid cash into a loan receivable asset.
Even worse, when your friend pays you back three months later, recording their repayment as income distorts your tax calculations and savings rate, making it look as though you earned new salary or business revenue.
When I designed the debt-tracking subsystem in FinLedger (LendingRepository.kt), I realized that modeling personal debt requires full lifecycle tracking: principal disbursement, linked bank accounts, partial settlements, asset reclassification, and two-way ledger synchronization.
Here is how FinLedger models personal lending and borrowing without corrupting accounting truth.
The Flawed Approach: Debt as Income and Expense
Treating loans as revenue and spending destroys personal budgeting analytics:
flowchart TD
subgraph FlawedModel["The Naive Expense/Income Model"]
Lend["Lend Rs. 5,000 to Friend"] --> Exp["Recorded as 'Expense':
Monthly living expenses artificially inflated!"]
Repay["Friend Repays Rs. 5,000"] --> Inc["Recorded as 'Income':
Monthly operational revenue artificially inflated!"]
Exp --> Corrupted["Net Result:
1. Savings rate calculations broken.
2. Monthly budget progress bars turn red.
3. Real cash burn rate becomes invisible."]
Inc --> Corrupted
end
In double-entry financial accounting:
- Lending money is an asset exchange: Cash decreases ($\text{Cash} \downarrow$), but Loan Receivable increases ($\text{Receivable} \uparrow$). Your net worth does not change by a single rupee.
- Receiving a loan repayment is another asset exchange: Loan Receivable decreases ($\text{Receivable} \downarrow$), and Cash increases ($\text{Cash} \uparrow$). No new income was created.
If your financial application cannot model this distinction, it cannot provide an honest picture of your wealth.
The FinLedger Domain Model (LendingRecord.kt)
To model debt accurately, FinLedger separates operational expenses from debt instruments. Every lending interaction is represented by a formal lifecycle entity:
flowchart TD
subgraph LendingArchitecture["FinLedger Lending Architecture"]
Person["Person Entity:
Rahul Patil"] --> Loans["Lending Records:
1. Loan #1: Rs. 950 (Outstanding)
2. Loan #2: Rs. 500 (Partially Paid)"]
Loans --> Repayments["Repayments Collection:
- Repayment A: Rs. 200 (Linked to Bank A)
- Repayment B: Rs. 300 (Linked to Bank B)"]
Repayments --> Summary["LendingPersonSummary:
Calculates: Total Lent, Total Repaid,
Net Outstanding, and Settlement Status"]
Summary --> BalanceSync["Two-Way Ledger Sync:
Credits liquid bank account atomically
without inflating operational income"]
end
The Key Properties of a Debt Record
- Principal (Original Amount): The exact amount disbursed on day zero. This number is immutable; repayments must never alter the original loan agreement.
-
Direction (LendingType):
LENT(an asset: money owed to you) vsBORROWED(a liability: money you owe to others). - Repayment History: A sub-collection of partial repayments, each tracking the exact timestamp, payment method, linked bank account, and optional note.
-
Computed Status (
LendingStatus):OUTSTANDING,PARTIALLY_PAID, orSETTLED. Status is never manually toggled; it is derived deterministically from the difference between the principal and the sum of repayments.
Multi-Loan Aggregation Per Person
In real life, financial relationships are rarely one-and-done transactions. You might lend a colleague Rs. 1,000 for dinner on Monday, and another Rs. 500 for a shared taxi on Wednesday.
In early prototypes, apps often force you to overwrite the previous loan or create duplicate person records.
FinLedger structures debts under a unified Person Summary (LendingPersonSummary.fromRecords):
- A single contact can hold multiple open loan records simultaneously.
- The domain engine computes total original debt, aggregate repayments across all records, and the net outstanding balance.
- Repayments can be targeted to a specific loan or applied sequentially across the oldest outstanding debts.
Key Takeaway
Tracking loans to friends is not simple arithmetic, and it is certainly not ordinary income and expense tracking.
By treating loans as balance sheet assets and liabilities rather than revenue and spending, FinLedger ensures that lending money never artificially inflates your living expenses or distorts your monthly savings rate.
FinLedger is a privacy-first, offline-first personal finance application for Android that models bank accounts, credit cards, and cash without double-counting.
Explore FinLedger on Google Play: https://play.google.com/store/apps/details?id=com.devanshufinance.app

Top comments (0)