Skip to content

Keshless HubAccounting System Documentation

Production-Ready Double-Entry Bookkeeping for Fintech

What is the Keshless Accounting System?

A complete double-entry bookkeeping system built for the Keshless fintech application. Every financial transaction creates balanced journal entries with immutable audit trails, ensuring regulatory compliance and accurate financial records.

Key Features

  • 🎯 Double-Entry Bookkeeping - Debits always equal credits
  • 🔒 Immutability - Posted entries cannot be modified, only reversed
  • ⚡ Immediate Posting - Transactions POSTED instantly (industry standard)
  • 🔄 Automated Reconciliation - Daily balance verification
  • 💾 Performance Optimized - Account balance caching with reconciliation
  • 📈 Financial Reporting - Trial balance, statements, P&L ready

Quick Example

typescript
// 1. Initialize the system
import { initializeAccountingSystem } from './utils/initializeAccounting';
await initializeAccountingSystem();

// 2. Create a P2P transfer
import { ledgerService, transactionTemplatesService } from './services/accounting';

const template = transactionTemplatesService.getUserTransferTemplate(
  senderId,     // User sending money
  recipientId,  // User receiving money
  100,          // Amount (E100)
  'REF-12345'   // Optional reference
);

// 3. Create journal entry (ACID transaction - POSTED immediately by default)
const { journal, ledgerEntries } = await ledgerService.createJournalEntry(template, {
  walletTransactionId: walletTxn._id,
  actorId: senderId,
  // autoPost defaults to true (industry standard)
  // Users receive money instantly, ledger entry is POSTED immediately
});

console.log(`✅ Journal ${journal.journalId} created with ${ledgerEntries.length} entries`);

System Architecture

The system consists of:

  • 6 Core Models - ChartOfAccounts, JournalEntry, LedgerEntry, AccountBalance, Reconciliation, AuditLog
  • 7 Services - Ledger, Templates, Posting, Reconciliation, Trial Balance, Statements, Chart of Accounts
  • 1 Automated Job - Daily reconciliation at 2 AM
  • 25+ Standard Accounts - Pre-configured chart of accounts

Currency

All amounts are in E (Emalageni) - the system is locked to this currency only.

Getting Started

New to the system? Start with the Getting Started Guide to learn how to initialize and use the accounting system.

Integrating with wallet operations? Check out the Integration Guide for step-by-step instructions.

Need API reference? Browse the API Documentation for detailed service methods and parameters.


Internal Documentation - Keshless Accounting System

Built with VitePress | Production Ready | Currency: E (Emalageni)

Internal use only - Keshless Payment Platform