druvu-acc
A modular Java library for reading and processing accounting data with a clean API for double-entry bookkeeping.
Overview
druvu-acc provides a clean API for working with double-entry bookkeeping data including accounts, transactions, commodities, and prices. It uses a pluggable architecture allowing multiple accounting file formats through ServiceLoader.
Currently supports GnuCash XML files (both plain and gzip-compressed).
Quick Example
// Load a GnuCash file (auto-discovers implementation via ServiceLoader)
AccStore store = AccStoreFactory.load(Path.of("/path/to/book.gnucash"));
// Iterate over accounts
for (Account account : store.accounts()) {
System.out.println(account.name() + " [" + account.type() + "]");
}
// Get transactions
for (Transaction tx : store.transactions()) {
System.out.println(tx.description() + " - " + tx.datePosted());
for (Split split : tx.splits()) {
System.out.println(" " + split.accountId() + ": " + split.value());
}
}
Core Entities
| Entity | Description |
|---|---|
| Account | Name, type, code, description, commodity |
| Transaction | Date, description, containing splits |
| Split | Value, quantity, reconciliation state |
| CommodityId | Identifies currencies and securities |
| Price | Historical price data for commodities |
Account types: ASSET, LIABILITY, INCOME, EXPENSE, EQUITY, BANK, CASH, STOCK, etc.
Module Structure
druvu-acc-parent/
├── druvu-acc-api # Core interfaces and entities
├── druvu-acc-gnucash-xml # GnuCash XML format implementation
└── druvu-acc-tests # Integration tests and examples
Full JPMS (Java Platform Module System) support with clean module boundaries.
Requirements
- Java 25+
- Maven 3.9+
License
Apache License 2.0