When developers build their first expense tracker, the data model almost always starts the same way.
You create a transaction record with an amount, a category, a timestamp, and a type: income or expense. It feels intuitive, covers 90% of basic use cases, and works well enough when someone pays with cash or a standard debit card.
Then you introduce credit cards, and the arithmetic immediately starts falling apart.
If you treat a credit card bill payment as a routine expense, your ledger will quietly lie to your users every single month.
The Double-Counting Trap
To understand why this happens, consider a straightforward financial scenario.
Imagine you go to a grocery store on the tenth day of the month and spend 5,000 rupees using your credit card. You open your finance app and log an expense of 5,000 rupees under the Groceries category. At this moment, your total monthly spend increases by 5,000 rupees.…