rauhan.sheikh
← Back to Work Directory
PERSONAL[BOS]2024–2026

BusinessOS

Commercial-grade financial operating system for SMEs with ledger-first accounting, immutable transaction journals, integer minor-unit money calculations, and multi-tenant audit logs.

Integer Minor-Units
Ledger
Zero floating-point rounding errors via BigInt
100% Immutable
Integrity
Corrections require explicit reversal journal entries
Multi-Tenant
Tenancy
Row-level tenant isolation across all ledger queries

Engineered With

Next.jsTypeScriptPostgreSQLPrismaRedisTailwind CSSNode.js

The Problem & Context

Standard invoicing and accounting tools for SMEs frequently use floating-point math for calculations or mutate transaction rows directly in the database. When a refund or correction occurs, past audit trails are overwritten. Reconciling discrepancies at month-end becomes an impossible forensic nightmare.

The Messy Part (Behind the Build)

Handling multi-currency transactions and fractional cent tax distributions without floating-point drift. Every monetary value is stored as an integer representing the smallest currency unit (cents/paise) with BigInt in Prisma. Rounding remainders must be deterministically allocated to balancing line items rather than swallowed.

Architecture & Design Decisions

Dual-entry ledger pattern where every transaction consists of at least two balancing entries. Balances are derived from snapshot aggregates and immutable event streams. Redis is used for idempotent request locking to prevent double-submitting invoices or chargebacks.

Why Another Business Tool?

Most accounting software for small businesses treats accounting like an editable spreadsheet. If an invoice amount was recorded incorrectly, an admin clicks "Edit" and updates the number.

In real financial systems, this is catastrophic. It breaks audit trails, obscures forensic timelines, and creates unaccountable balances.

BusinessOS was architected with one non-negotiable rule:

Money does not update. Money only moves.

Core Architectural Pillars

  1. Integer Minor-Unit Math: Every balance and line item is stored in minor currency units (e.g. ₹100.50 is stored as 10050 BigInt). No JavaScript float rounding quirks.
  2. Double-Entry Journal: Debits must always equal Credits. Every transaction is a balanced compound entry.
  3. Idempotent Webhooks: Payment gateways emit retries. BusinessOS locks incoming transaction tokens in Redis with an atomic TTL to prevent duplicate ledger postings.
  4. Tenant Isolation: Clean multi-tenancy enforced at the database layer with cryptographic workspace segregation.

What I'd Do Differently Today

I would incorporate event sourcing with an append-only log earlier in the design instead of relying partly on relational table triggers for audit trails.