Finance — technical documentation index

Technical-layer documentation for the Ethica Capital finance module. Each page describes one feature in engineering depth: models (fields, types, indexes), services, endpoints, validation rules, file paths, design rationale, alternatives considered, edge cases, and test coverage.

Audience: engineers, future agents implementing or modifying the finance module.

Documentation rule. Every task in the finance module implementation plan ships with three docs: technical (here), architecture, and business. Do not duplicate content — cross-link.

Phase 0 — Foundation fixes (complete)

DocCovers
SourceModule enumExtension of SourceModule across API + ERP types
AAOIFI COA seedAAOIFI baseline COA seed + per-fund control auto-provisioning
Reversal APIReversal journal entry service, controller, and UI
Hash chain verifierServer-side hash recompute, nightly cron, run log

Phase 1 — Critical infrastructure

DocCovers
SubledgersClient, fund, custodian, broker subledgers (Block 1.A)
ReconciliationDaily subledger-vs-GL reconciliation engine + UI (Block 1.A)
Posting engineDiscriminated-union posting requests, validation engine, atomic transaction wrap (Block 1.B)
Shariah rulesAsset screening + transaction-gate Shariah rules engine + frontend (Block 1.B)
NAV engineSecurity master, price + FX sources, 12-step NAV calculator with snapshots (Block 1.C)
NAV-fund flowsSubscription / redemption / equity-trade / sukuk-trade handlers + lifecycles (Block 1.D — parallel product)

Phase 1 is complete; subsequent docs will land with Phase 2 (purification, zakat, FX revaluation, month-end close) and Phase 3 (regulatory reports).

Conventions

  • File paths reference ethica-api/ and ethica-erp/ relative to the operations workspace root.
  • When a doc references a line number, it reflects the state at write time; if you find the line has drifted, update both the doc and the citation.
  • Money math: always NUMERIC(20,4) in the DB + decimal.js in code. Never number for money.