Accounting
Accounting
A drop-in module for barakoCMS that adds a general-purpose, double-entry ledger: a chart of accounts, balanced journal entries, and reporting. It is chart-of-accounts agnostic — you define the accounts; the module enforces the accounting.
Enable it
dotnet add package BarakoCMS.Accounting
builder.Services.AddBarakoCMS(builder.Configuration);
var app = builder.Build();
app.UseBarakoCMS();
await app.RunBarakoModuleSeedersAsync(); // seeds the "Accountant" role
The package reference plus a restart is the install. AddBarakoCMS finds every module in the
application's dependency context, and BarakoCMS:Modules:Enabled decides which of them run
(BarakoCMS__Modules__Enabled=Accounting). Unset, every referenced module runs and the API logs
one warning saying so. To name it by hand instead, put
modules.Add(new BarakoCMS.Accounting.AccountingModule())
in the AddBarakoCMS callback; discovery skips a type the host already added. See MODULES.md in
the repository.
Enabled, the module wires itself in: it registers its services, its Marten document schema, its endpoints,
and a baseline Accountant role — no other setup.
What it guarantees
- Balanced by construction. A journal entry is rejected unless total debits equal total credits, and every referenced account exists. The rule is enforced in the backend, not the UI.
- Atomic. An entry's lines are embedded in one document, so debit and credit commit in a single transaction — they can never diverge.
- Immutable. Posted entries aren't edited; corrections are reversing entries, preserving an audit trail.
Endpoints
| Method & path | Purpose |
|---|---|
POST /api/accounting/journal-entries |
Post one balanced entry |
POST /api/accounting/accounts |
Create a chart-of-accounts entry |
GET /api/accounting/accounts |
List the chart of accounts |
GET /api/accounting/balances?asOf= |
Trial-balance-style balances |
GET /api/accounting/accounts/{code}/ledger |
One account's ledger with running balance |
All are gated on the Accountant (or Admin/SuperAdmin) role.
Model
Account (code, name, AccountType, optional ParentCode for sub-accounts) and JournalEntry
(embedded balanced JournalLines) are strongly-typed Marten documents — money is real decimal,
and balances aggregate in the database. LedgerService posts; ReportingService reports.
Sub-accounts are just accounts with a ParentCode, which is how you model, say, a receivable
per customer or member under a single control account.
Requires
barakoCMS and BarakoCMS.Abstractions, at the versions NuGet lists as this package's dependencies. Neither is older than 4.3.0, the release that added BarakoCMS.Abstractions. Targets .NET 10.
License
MIT © BaryoDev
If barakoCMS is useful to you, a star on the repository helps other people find it.