The challenge
Record financial entries with integrity, reconcile bank statements against the ledger and keep data from different organizations isolated in one application.
The solution
Double-entry ledger in PostgreSQL, CSV and OFX statement import with preview and deduplication, rule-based reconciliation with criteria explained on screen, reports and export.
Main features
- Double-entry postings with idempotency keys, single reversal and trigger-enforced immutability.
- Statement import and rule-based bank reconciliation, with manual and batch confirmation.
- Reports, CSV export, append-only audit log and role-based permissions.
- Data isolation between organizations.
Architecture
Java 21 and Spring Boot MVC monolith with Thymeleaf, PostgreSQL and Flyway. A persistent queue inside PostgreSQL processes imports and batch confirmations.
- Browser
- Spring MVC + Thymeleaf
- Services (ledger, reconciliation, import)
- PostgreSQL + job queue
Decisions and lessons learned
- NUMERIC(19,2) amounts and triggers enforce integrity in the database, not only in the application.
- The reconciliation score is a similarity heuristic, not a probability.
- Versioned Flyway migrations and tests against a real PostgreSQL.
Scope and limitations
The public demo uses sample data, which is restarted periodically. The first visit after an idle period can take longer. The sample data does not represent real commercial records.
Availability
- Source code
- Public
- Demo
- Available
- Case study
- Unavailable
- Status
- Online demo
Context and problem
Small organizations need to check the bank statement against the ledger. LedgerFlow addresses that with double-entry entries, statement import and rule-based reconciliation, with data isolation between organizations.
How it works
- Chart of accounts
- Double-entry posting
- Statement import (CSV/OFX)
- Rule-based reconciliation
- Discrepancies
- Reports and export
Business rules
- NUMERIC(19,2) amounts, idempotency keys, single reversal and trigger-enforced immutability.
- ORG_ADMIN, ANALYST and AUDITOR roles per organization; non-members get 404 and insufficient roles get 403.
- Append-only audit log and CSV with formula neutralization.
Technical challenges and solutions
- Challenge: Isolating data between organizations. Solution: Organization-scoped queries and a 404 response for non-members.
- Challenge: Reconciling without promising certainty. Solution: Similarity heuristic with criteria explained on screen and manual confirmation.
- Challenge: Processing large imports without freezing the UI. Solution: Persistent PostgreSQL queue using FOR UPDATE SKIP LOCKED and an internal worker.
Security and privacy
- Strict CSP, no CDN or external fonts.
- Sessions ended on password change and an immutable audit log.
- Synthetic data, no real money.
Tests and evidence
- Automated tests against a real PostgreSQL (including concurrency and the queue), continuous integration with GitHub Actions and Docker Compose verification on a disposable runner.
Lessons learned
- Financial integrity works better when the database also enforces the rules.
- Documenting limitations honestly avoids promising more than the system does.
Current status
Public demo with sample data, restarted periodically. The first visit after an idle period can take longer.
Documented evidence
- Public demo on Azure, with the access account published in the README
- Automated tests with real PostgreSQL and continuous integration on GitHub Actions
- Real captures and technical documentation in the repository