06SystemsPrototype
Tallyx: a double-entry accounting and GST engine
A clean-room double-entry and GST engine in TypeScript with exact money, an immutable journal and voucher numbers that cannot have gaps.
Systems engineering · implemented prototype · 2026
- tests in the suite
- 571
- money as a 64-bit integer
- 4 dp
- contiguous under 8 parallel writers
- 1..400
- gaps in voucher numbering
- 0
Problem
Accounting software is where floating-point bugs become legal liabilities. A ledger that drifts by a fraction of a paisa per entry is untraceable after a few thousand postings.
A voucher sequence with a gap is a statutory problem, not a cosmetic one, and database sequences leave gaps whenever a transaction rolls back.
Approach
01
Money is an integer
Amounts are signed 64-bit integers at four decimal places, never floats, which reaches about ±922 trillion currency units. The debit or credit side is stored separately from the magnitude.
02
The journal is immutable
Editing a posted voucher writes a reversal plus a correction, both linked to the original, so the audit trail never sits on mutable rows.
03
Numbering is gap-free by construction
Voucher numbers come from a locked counter inside the posting transaction, not from a database sequence.
04
Exact at the boundary too
Money crosses the HTTP boundary as decimal strings, never JSON numbers, so the exact money layer is not undone in transit.
05
A core that needs no database to test
The domain layer imports nothing, reports import only the domain, and nothing imports the UI.
Results
Numbering was verified with 8 parallel processes posting 50 vouchers each: the result was a contiguous 1 to 400 with zero gaps.
01
8 processes
Posting in parallel
02
50 posts each
To the same voucher series
03
1..400
Contiguous, zero gaps
| Area | Scope |
|---|---|
| Accounting | Double-entry journal, trial balance, profit and loss, balance sheet, account statements |
| GST | Date-effective rates, CGST/SGST versus IGST, cess, GSTR-1 partitions, ledger reconciliation |
| Inventory | FIFO, LIFO and weighted-average valuation across warehouses |
| Bills | Bill-by-bill allocation, aging buckets, over-settlement prevention |
| Tests | 571 across 19 files, including numbering under concurrency |
Limits
What this work did not show.
- There is no hosted demo: the previous deployment is offline. The full stack runs locally against SQLite.
- Not built: multi-user Postgres deployment, e-invoicing integration, payroll and bank feeds.
- Behaviour was derived from observing TallyPrime Edit Log 7.2 and reimplemented independently. The project is not affiliated with Tally Solutions.
- The source is public and the licence is proprietary.
Stack
- TypeScript
- Node.js
- React
- SQLite
- Terraform
- Docker