Kế toán
Multi-company accounting on one schema, out of a pile of Excel files.
- Year
- 2026
- Client
- Private group
- Role
- Solo engineer
- Duration
- 2 months
Case study
The brief
A small group of companies keeping their books in Excel, with the same partner, item and account lists copied into every file. The goal was one system holding several companies at once, where a number entered in one place appears everywhere it should — and nowhere it shouldn't.
The approach
A Next.js app on Postgres with a 31-model Prisma schema covering a real accounting domain rather than a simplified one: companies and members, partners, chart of accounts, invoices and lines, payments with allocations, warehouses and inventory snapshots, BOMs, fixed assets with depreciation entries, departments, headcount and payroll — with an audit log across it.
Multi-company is enforced at the data layer, not in the UI. Every query is scoped by company, so "which company am I looking at" is never a rendering decision.
The harder parts
Payment allocation. Money rarely arrives as one payment for one invoice — it arrives as a round number covering parts of several, sometimes across months. Modelling allocations as their own records instead of a field on the payment is what makes partial settlement, and the debt report built on it, actually correct.
Import mattered too: ledgers and BOMs come in as spreadsheets, so import scripts are part of the product rather than a one-off migration.
Stack
- Next.js
- TypeScript
- Prisma
- PostgreSQL
- TanStack Table
- ExcelJS
- Tailwind CSS
- Docker