Ahmed AlsaidyProduct & Systems Engineer
← All projects
Studio, Project, Finance & Zakat System
Client System

Hesabaty

A financial and operations system for studios and agencies: client directory, project milestones, invoicing and payment allocation, 50/50 partner expense settlements and an automated 2.5% Zakat calculator

Role
Full-stack engineering & UI design
Timeline
2026
Platforms
Web · Windows · Server
عملاء ومشاريع
clients & project milestones
فواتير وخزينة
invoicing & account ledgers
2.5%
automated Zakat calculator
50 / 50
partner expense settlement
Hesabaty daily operations dashboard: collected revenue, receivables, active tasks and cashflow forecast
Hesabaty daily operations dashboard: collected revenue, receivables, active tasks and cashflow forecast Click to expand ⤢

Overview

Business problem & context

Creative studios and service agencies struggle to reconcile project milestones, multi-invoice client payments, unallocated customer advances, 50/50 partner expense splits and accurate annual Zakat calculations

System Architecture

System layers & components

An Arabic-first financial and studio operating system built with Next.js 16, React 19, TypeScript and SQLite/Drizzle ORM, featuring an integer minor-unit (piastre) accounting engine verified across 26/26 automated acceptance checks

L1

Arabic-First Studio UI · Next.js 16 + React 19

Dashboard, clients, projects, treasury & Zakat views

  • Daily Action Dashboard (S01)
  • Clients, Agreements & Milestones
  • Treasury, Invoices & Allocations
  • Zakat Calculator & PDF/CSV Export
L2

Accounting & Allocation Engine · TypeScript

Minor-unit money engine, multi-invoice allocation & partner split

  • Integer Piastre Money Engine
  • Multi-Invoice Payment Allocation
  • Unallocated Customer Credit Ledger
  • 50/50 Partner Split Settlement
L3

Persistence & Security · Drizzle ORM + SQLite

Transactional SQLite storage, scrypt auth & audit trail

  • Drizzle ORM Relational Schema
  • Frozen Agreement Snapshots
  • scrypt Password Hashing + Sessions
  • 26/26 Automated Acceptance Checks
Tech Stack — Technologies used:
  • Next.js
  • React
  • TypeScript
  • Tailwind CSS
  • SQLite / Drizzle
  • Playwright E2E

Data Model

Database schema & core tables

Financial schema ensuring zero rounding drift: every payment either allocates across one or more invoices or rests in unallocated customer credit (`unallocated_credit`) deducted from the Zakat base

Table Role in the system
clients / agreements / projects Clients, frozen commercial agreement snapshots, projects & tasks
invoices / payments / payment_allocations Invoices, receipts and many-to-many payment-to-invoice allocations
accounts / expenses / partner_settlements Cash/bank accounts, studio expenses and 50/50 partner split settlements
zakat_assessments / audit_logs Saved annual Zakat assessment snapshots and mandatory audit logs

Implementation

Key technical decisions

01

Integer minor-unit (piastre) money representation

All monetary values are stored and computed in integer minor units (piastres), completely eliminating floating-point rounding errors across partial allocations and percentage splits

02

Multi-invoice payment allocation with unallocated credit tracking

A single customer receipt can settle multiple open invoices while automatically parking any overpayment as an unallocated customer credit liability

03

Live-ledger 2.5% Zakat calculator with snapshot archiving

Computes the 2.5% Zakat base directly from live cash balances, collectible receivables and partner balances minus customer advances and liabilities, saving an immutable snapshot

Security

Security & access control

  • Hardened `scrypt` password hashing with HTTP-only session cookies and server-side route protection
  • Frozen agreement snapshots ensure historical contracts and invoices never mutate when service catalog prices change
  • End-to-end automated verification script (`scripts/verify.ts`) asserting all 26 acceptance criteria (`AC02–AC14`)

Code Highlight

Net Zakat base calculation in integer minor units

studio-manager/src/lib/zakat.ts · TS
export function calculateZakatBase(input: ZakatLedgerInput): ZakatResult {
  const grossAssetsMinor =
    input.cashBalancesMinor +
    input.collectibleReceivablesMinor +
    input.inventoryGoodsMinor +
    input.partnerReceivableMinor;
  const deductibleLiabilitiesMinor =
    input.unallocatedCustomerCreditsMinor +
    input.partnerPayableMinor +
    input.manualDebtsMinor +
    input.doubtfulReceivablesMinor;
  const netBaseMinor = Math.max(0, grossAssetsMinor - deductibleLiabilitiesMinor);
  const zakatDueMinor = Math.round(netBaseMinor * 0.025); // 2.5% (ربع العشر)
  return { netBaseMinor, zakatDueMinor };
}

Summary

Outcome & status

Complete studio and financial operating system passing 26/26 automated acceptance checks from client onboarding to Zakat assessment

Next project Nexus Class → Subscription platform for teachers & centers

Technical Evaluation · GCC / Remote / Egypt

Building an operational system, rescuing an AI cloud stack, or hiring a Product Engineer on retainer?

Complete the 30-second scope qualifier so our first conversation goes directly into system architecture, milestones, and budget fit.