Skip to main content

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 areaWhat the business gets
1Chart of accountsA governed tree of GL accounts (type, normal balance, parent/child, active) per environment - the bank's own accounting model, not a fixed table
2Activity mappingDeclarative rules binding a ledger product type + instruction type to its debit and credit GL accounts, so every movement books itself
3Journal projectionAn append-only, idempotent projection of committed ledger postings into double-entry journal entries and lines
4Trial balanceA per-period trial balance that must balance; an imbalance is surfaced as an event, never silently absorbed
5Financial statementsProfit & loss for a period; balance sheet as of a date
6Period closeClose a period, roll profit & loss into retained earnings, lock the period; reopening is an audited act
7FX catalogueEffective-dated rates per currency pair - the single rate source apps and services read
8RevaluationPeriod-end unrealized revaluation of foreign-currency positions, booked as ledger postings
9Admin consoleSDUI pages in the platform dashboard: chart of accounts, mapping, journal, trial balance, statements, periods, FX
10Domain eventsbank8:accounting:* family (account changes, period close, imbalance, revaluation)
11Health & opsHealth endpoint, metrics, audit journal

What the service does NOT own (business boundary):

Out of scopeOwned by
Money movement, balances, posting atomicityBank8:Ledger
Payment orchestration, schemes, cardsBank8:Payments
Regulatory return generation and submissionBank8:Reporting
Prudential measurement (capital, liquidity, ECL)Bank8:Risk
AML detectionBank8:Compliance
Tenant-authored hook executionSentin8:Func
Statement/document bytesSentin8:Storage
Schedule timingSentin8:Cron
Metric aggregationSentin8:Stat

3. Business Capabilities​

CapabilityBusiness rule
Chart of accountsA 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 mappingA 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 projectionEach committed ledger posting projects to exactly one journal entry per environment. Replay never double-counts: the projection is idempotent per ledger posting id.
Balance proofDebits equal credits per entry. A violation raises gl:imbalance and fails the trial balance loudly; the service never carries a silently unbalanced book.
StatementsTrial 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 closeClosing 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 ratesRates are effective-dated and append-only - a past rate is never rewritten, because historical statements must reproduce exactly.
RevaluationRevaluation posts through the ledger's public API like any other movement; Accounting never writes money directly. It is idempotent per (period, account, currency).
Tenant isolationEvery 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.

ConsequenceBusiness benefit
The GL can be rebuilt from genesis at any timeAudit and regulator questions are answered by reconstruction, not by trust
A GL defect is fixable by re-projectionNo migration window, no data-loss risk to the money path
Accounting downtime cannot block a paymentThe money path has no dependency on the book of account
Two independent proofs of the same numberLedger 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)​

EventFires when
bank8:accounting:glaccount:createdA GL account is created
bank8:accounting:glaccount:updatedA GL account is edited or deactivated
bank8:accounting:mappingrule:upsertedA product→GL mapping rule is written
bank8:accounting:journalentry:postedA posting projects into the journal
bank8:accounting:gl:imbalanceDebits and credits disagree - the book is not provably balanced
bank8:accounting:period:closedA period closes and locks
bank8:accounting:period:reopenedA closed period is reopened (audited)
bank8:accounting:fx:rate:upsertedA rate is added to the catalogue
bank8:accounting:revaluation:completedA period-end revaluation run finishes

5. Business Rules & Invariants​

  1. Journal projection is idempotent per ledger posting id - replay never double-counts.
  2. Debits equal credits per journal entry, always. An imbalance is an event and a failed trial balance, never a tolerated state.
  3. A closed period accepts no new entries; reopening is audited.
  4. FX rates are append-only and effective-dated; no historical rate is rewritten.
  5. 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.
  6. A GL account with posted lines cannot be deactivated.
  7. A product cannot be activated unless its required activity mappings resolve to active GL accounts.

6. Target-User Roles & Use Cases​

RoleUse case
Financial controllerReviews the trial balance, closes the month, signs off statements
Finance operationsMaps new products to GL accounts; investigates imbalances
TreasurerMaintains the FX catalogue; runs period-end revaluation
Auditor / regulatorReproduces any period's statements from the journal
Product ownerConfirms 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​

  1. A committed posting appears as a balanced journal entry exactly once, and a replayed posting does not appear twice.
  2. A deliberately broken mapping produces gl:imbalance and a failing trial balance rather than a wrong-but-quiet number.
  3. Profit & loss and balance sheet reproduce a hand-calculated example from a known posting set.
  4. Closing a period twice rolls retained earnings once.
  5. A reopened period is blocked to non-audited actors and produces an audit record.
  6. 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.