Bank8:Accounting - Business Requirements & Functionality
Audience: product owners, business analysts, controllers, and anyone
evaluating what Bank8:Accounting does for the business. For
architecture read README.md; for wire-level detail read DESIGN.md.
1. Business Purpose
- The bank has a book of account, not just a ledger. The ledger
records money positions per account; the general ledger records what
those positions mean financially - assets, liabilities, equity,
income, expense - and proves it balances.
- Finance closes on evidence, not on reconciliation spreadsheets.
Every journal entry is a deterministic projection of a committed
ledger posting, so the trial balance can be rebuilt from the journal
at any time and reconciled to the penny.
- Statements are a product, not an exercise. Profit & loss, balance
sheet, and trial balance are first-class API reads with a period
close that rolls retained earnings - the numbers a controller,
auditor, or regulator asks for first.
- Multi-currency is a first-class fact. An institution operating in
several denominations holds a rate catalogue and books period-end
revaluation as real postings, not as an offline adjustment.
2. Business Scope (What the Service Provides)
| # | Capability area | What the business gets |
|---|
| 1 | Chart of accounts | A governed tree of GL accounts (type, normal balance, parent/child, active) per environment - the bank's own accounting model, not a fixed table |
| 2 | Activity mapping | Declarative rules binding a ledger product type + instruction type to its debit and credit GL accounts, so every movement books itself |
| 3 | Journal projection | An append-only, idempotent projection of committed ledger postings into double-entry journal entries and lines |
| 4 | Trial balance | A per-period trial balance that must balance; an imbalance is surfaced as an event, never silently absorbed |
| 5 | Financial statements | Profit & loss for a period; balance sheet as of a date |
| 6 | Period close | Close a period, roll profit & loss into retained earnings, lock the period; reopening is an audited act |
| 7 | FX catalogue | Effective-dated rates per currency pair - the single rate source apps and services read |
| 8 | Revaluation | Period-end unrealized revaluation of foreign-currency positions, booked as ledger postings |
| 9 | Admin console | SDUI pages in the platform dashboard: chart of accounts, mapping, journal, trial balance, statements, periods, FX |
| 10 | Domain events | bank8:accounting:* family (account changes, period close, imbalance, revaluation) |
| 11 | Health & ops | Health endpoint, metrics, audit journal |
What the service does NOT own (business boundary):
| Out of scope | Owned by |
|---|
| Money movement, balances, posting atomicity | Bank8:Ledger |
| Payment orchestration, schemes, cards | Bank8:Payments |
| Regulatory return generation and submission | Bank8:Reporting |
| Prudential measurement (capital, liquidity, ECL) | Bank8:Risk |
| AML detection | Bank8:Compliance |
| Tenant-authored hook execution | Sentin8:Func |
| Statement/document bytes | Sentin8:Storage |
| Schedule timing | Sentin8:Cron |
| Metric aggregation | Sentin8:Stat |
3. Business Capabilities
| Capability | Business rule |
|---|
| Chart of accounts | A GL account is typed (asset / liability / equity / income / expense) and declares its normal balance. An account with posted journal lines cannot be deactivated - history stays interpretable. |
| Activity mapping | A mapping rule binds (product_type, instruction_type) to a debit GL and a credit GL. A product cannot be activated unless every mapping it needs resolves to an active GL account - misconfiguration is caught at activation, not at the customer's first posting. |
| Journal projection | Each committed ledger posting projects to exactly one journal entry per environment. Replay never double-counts: the projection is idempotent per ledger posting id. |
| Balance proof | Debits equal credits per entry. A violation raises gl:imbalance and fails the trial balance loudly; the service never carries a silently unbalanced book. |
| Statements | Trial balance sums to zero per period. Profit & loss derives from income/expense activity in the period; balance sheet derives from asset/liability/equity plus the accumulated result as of the date. |
| Period close | Closing is idempotent per period: a re-run of the same close does not double-roll retained earnings. A closed period accepts no further postings; reopening requires an audited actor. |
| FX rates | Rates are effective-dated and append-only - a past rate is never rewritten, because historical statements must reproduce exactly. |
| Revaluation | Revaluation posts through the ledger's public API like any other movement; Accounting never writes money directly. It is idempotent per (period, account, currency). |
| Tenant isolation | Every row is environment-scoped and row-level-security enforced; one tenant's book is invisible to another at the database, not the application. |
3.1 Why Accounting is a projection, not a co-writer
The ledger already owns atomicity: a posting batch either commits
whole - balances, transactions, journal, audit, outbox - or writes
nothing. Accounting therefore does not participate in that
transaction. It derives the book of account from the ledger's
committed, replayable journal.
| Consequence | Business benefit |
|---|
| The GL can be rebuilt from genesis at any time | Audit and regulator questions are answered by reconstruction, not by trust |
| A GL defect is fixable by re-projection | No migration window, no data-loss risk to the money path |
| Accounting downtime cannot block a payment | The money path has no dependency on the book of account |
| Two independent proofs of the same number | Ledger positions and GL balances reconcile - a mismatch is detectable rather than invisible |
3.2 Ready-made chart of accounts (a starting point, not a ceiling)
Seeding provides a conventional retail template - customer deposits,
loans and advances, accrued interest receivable/payable, fee income,
interest income/expense, cash and settlement accounts, retained
earnings, and equity. Every account and mapping is editable; a bank
with a different model (Islamic finance, agency banking, a
multi-entity structure) shapes its own tree without a code change.
4. Business Events (Outbound)
| Event | Fires when |
|---|
bank8:accounting:glaccount:created | A GL account is created |
bank8:accounting:glaccount:updated | A GL account is edited or deactivated |
bank8:accounting:mappingrule:upserted | A product→GL mapping rule is written |
bank8:accounting:journalentry:posted | A posting projects into the journal |
bank8:accounting:gl:imbalance | Debits and credits disagree - the book is not provably balanced |
bank8:accounting:period:closed | A period closes and locks |
bank8:accounting:period:reopened | A closed period is reopened (audited) |
bank8:accounting:fx:rate:upserted | A rate is added to the catalogue |
bank8:accounting:revaluation:completed | A period-end revaluation run finishes |
5. Business Rules & Invariants
- Journal projection is idempotent per ledger posting id - replay never
double-counts.
- Debits equal credits per journal entry, always. An imbalance is an
event and a failed trial balance, never a tolerated state.
- A closed period accepts no new entries; reopening is audited.
- FX rates are append-only and effective-dated; no historical rate is
rewritten.
- Accounting never writes another service's tables. It reads the
ledger's journal through the public API and reacts to posting events;
it posts revaluation through the ledger's public posting API.
- A GL account with posted lines cannot be deactivated.
- A product cannot be activated unless its required activity mappings
resolve to active GL accounts.
6. Target-User Roles & Use Cases
| Role | Use case |
|---|
| Financial controller | Reviews the trial balance, closes the month, signs off statements |
| Finance operations | Maps new products to GL accounts; investigates imbalances |
| Treasurer | Maintains the FX catalogue; runs period-end revaluation |
| Auditor / regulator | Reproduces any period's statements from the journal |
| Product owner | Confirms a new product books to the intended accounts before launch |
7. KPIs / Success Criteria
- Trial balance balances for every period, with zero manual adjustments.
- GL balances reconcile to ledger positions at period close, to the
penny.
- Journal projection lag from posting commit to journal entry ≤ seconds.
- Zero double-counted entries across replays and re-projections.
- Period close completes without a spreadsheet.
8. Dependencies & Reliance on Other Services
- Bank8:Ledger - the journal it projects; the posting API it uses
for revaluation. Read-only except for those postings.
- Sentin8:Bus - posting events in, accounting events out.
- Sentin8:Cron - schedule timing for period close reminders and
revaluation runs.
- Bank8:Compliance - a consumer of
gl:imbalance.
- Bank8:Reporting - a consumer of statement and period data.
9. Acceptance Criteria
- A committed posting appears as a balanced journal entry exactly once,
and a replayed posting does not appear twice.
- A deliberately broken mapping produces
gl:imbalance and a failing
trial balance rather than a wrong-but-quiet number.
- Profit & loss and balance sheet reproduce a hand-calculated example
from a known posting set.
- Closing a period twice rolls retained earnings once.
- A reopened period is blocked to non-audited actors and produces an
audit record.
- A foreign-currency position revalues at period end through a ledger
posting, idempotently.
10. Open Business Questions
- Multi-entity books (one environment, several legal entities) - one
tree with entity segments, or an entity per environment?
- Whether statutory reporting formats (XBRL taxonomies) are produced
here or stay exclusively with Reporting.
- Consolidation across entities: an out-of-scope capability for now.
Architecture & Design: bank8:accounting and its underlying concepts were designed by Hamid Jahanzad.