Double-entry bookkeeping, explained for software teams
Every money feature you build ends up needing it. A plain-language walk through debits, credits and journal entries, with a real-looking Dhaka invoice and the database tables behind it.

Most of us in software meet accounting sideways. A client wants a wallet, or refunds, or "just a simple report of who paid what", and a few weeks later we are staring at a payments table whose totals do not match the bank statement. We have been there more than once. The fix, almost every time, is a five-hundred-year-old idea: double-entry bookkeeping.
This post is the explanation we wish someone had given us early on. It is written for developers and for founders of small software firms in Bangladesh, but the idea works the same everywhere.
The one rule
Every transaction touches at least two accounts, and the amounts on the two sides are equal. Money never appears or disappears; it moves from somewhere to somewhere. If you write it down that way every time, your books carry their own error check: the debits and the credits must always add up to the same number.
Behind the rule sits the accounting equation:
Assets = Liabilities + Equity + (Income − Expenses)
Each entry keeps both sides of that equation balanced. Edwin at Balanced describes double-entry as a design pattern rather than an accounting chore, and that is the most useful way for a programmer to look at it.
Debit and credit are not plus and minus
This is where most developers get stuck. A debit is simply the left column, a credit the right. Whether a debit makes an account go up or down depends on the kind of account:
| Account type | Goes up with | Examples in a software company |
|---|---|---|
| Asset | Debit | Bank, bKash merchant wallet, money clients owe you |
| Expense | Debit | Salaries, cloud hosting, software licences |
| Liability | Credit | Advances from clients, VAT you must pay, loans |
| Equity | Credit | Owners' capital, retained profit |
| Income | Credit | Project revenue, support and maintenance fees |
Do not try to memorise it as "debit means money in". Memorise the table, and the rest follows.
A worked example from a normal month
Say your company finishes a website and invoices the client ৳1,00,000. Nothing has hit the bank yet, but the client now owes you. Two lines:
| Account | Debit | Credit |
|---|---|---|
| Accounts receivable (asset) | 1,00,000 | |
| Project revenue (income) | 1,00,000 |
A week later the client pays by bank transfer, but only ৳99,850 arrives: their bank took ৳150 in charges. This is exactly the kind of thing a single paid column hides. In double-entry, the gap has to go somewhere, so you have to name it:
| Account | Debit | Credit |
|---|---|---|
| Bank (asset) | 99,850 | |
| Bank charges (expense) | 150 | |
| Accounts receivable (asset) | 1,00,000 |
The receivable is now zero, the bank shows what really arrived, and the ৳150 is visible as a cost instead of a mystery. Do this for a year and you can answer questions like "how much do bank charges cost us?" in one query.
How it looks in a database
You do not need a special product to start. Two tables are enough:
- journal_entry: one row per event (date, description, who recorded it, a link to the invoice or payment).
- journal_line: two or more rows per entry, each with an account, a debit and a credit.
Then a handful of habits keep it honest:
- Store money as whole poisha (integers), never floating point. ৳99,850 is
9985000. - Check, in code and if you can in the database, that every entry's debits equal its credits before it is saved.
- Never edit or delete a posted entry. If something was wrong, post a reversing entry and then the right one. The history is the audit trail.
- Balances are sums of lines. You may cache them, but the lines are the truth.
This is how the office app we use at MHD Soft keeps its own books: every transaction is a balanced journal entry, mistakes are voided rather than deleted, and reports are just sums over the lines.
Where to go next
Once the rule clicks, the next questions are which accounts to have (your chart of accounts) and when income actually counts as earned. We cover both in the next posts in this series. If you build anything that touches money, an afternoon spent here will save you weeks of reconciling later.
Tricky cases, and what we would do
A client pays twice: once by bKash, once by bank
Do not delete either payment. Record both; the receivable goes into credit (the client has paid ৳1,00,000 more than they owe). Then either refund it (debit receivable, credit bank) or keep it as an advance for the next invoice, and write down which one the client agreed to.
Someone booked an expense to the wrong account last month
The month is closed, so do not edit it. Post a correcting entry this month: credit the wrong account, debit the right one, with a note pointing to the original entry. Both months stay honest and the trail shows what happened.
An invoice in US dollars
Record the invoice in taka at the day’s rate, and keep the dollar amount on the line for reference. When the money arrives at a different rate, the difference is an exchange gain or loss, a separate line, never squeezed into revenue.
Building a finance system? Talk to us
At MHD Soft we build finance and accounting software with two kinds of people in the room: developers, and people who have done the accounts themselves, in agencies, factories, NGOs and shops. Their field experience decides how a screen should work; their feedback goes back into every release. That is how we keep systems correct (double-entry underneath, VAT and AIT handled, bKash and bank payments matched) while keeping the price within reach of a growing Bangladeshi business.
If you have a case that does not fit your current software, tell us about it. Odd cases are where we learn the most.


