Work / Mizan
Mizan · ميزان
Live at mizan.arzlabs.cloudAn Arabic-first web app that prices gold, silver and cash conversions at your actual dealer's margins, tracks the resulting ledger by karat, and tells you where you stand — built on an exact-integer money engine with a 201-test correctness contract.
201
Tests, money-math contract
0
Floats in storage — bigint everywhere
12
Routes, RTL throughout
5
Alert kinds on a 30-min price loop

The problem
Screen prices are not the prices you get. International spot quotes fine metal per troy ounce; a real trade is a physical weight at a real karat, priced by a dealer who adds his own absolute margin, quoted in whatever unit you asked in. Every step moves the number — and none of them are visible in a generic portfolio tracker.
What it does
Price a swap first
Bidirectional gold / silver / cash quotes at a chosen dealer's margins, with break-even and round-trip cost stated plainly. Public — no login.
Record the real deal
Swaps freeze the spot prices and margins actually applied; deposits and withdrawals are separate movements. The ledger stays reconstructable forever.
See where you stand
Holdings bucketed by metal and karat, valued by liquidating through the dealer — contributions subtracted, so added money never shows as profit.
Dealer commission cards
A dealer quotes by the unit you ask in — so each carries two metals × three units × buy/sell, with cheaper-category detection and per-deal overrides.
Ratio charts & alerts
The gold/silver ratio plotted from the app's own price history with your trades marked; five alert kinds delivered by email.
Arabic-native, RTL
Written in Arabic, not translated — صائغ, عيار, العالمي زائد/ناقص, ليرة ذهب as a first-class unit. Arabic-Indic digits accepted as input.
Engineering notes
Nothing is stored as a float
Metal is bigint milligrams, cash is bigint cents, margins are integer cents per ounce. Rounding never manufactures value: conversions floor in the direction that cannot invent metal or cash.
A dated, documented correction
The purity model was corrected mid-project: face weight stays physical, purity scales the price. The earlier model overvalued 875 jewelry by 12.5% — the bug, the reasoning and the migration are all recorded in the repo.
Append-and-void ledger
Transactions are never edited or deleted — a void is a timestamp, and holdings are always a fold over the ledger. Idempotency keys make a double-submit unable to insert a second row.
An advisor that refuses to advise
The advisory layer states facts — where today's ratio sits, what the round trip costs — and deliberately emits no direction and no confidence. Below 300 samples over 14 days, it says so instead of guessing.
Stack
- Framework
- Next.js 16 App Router · React 19 · TypeScript strict
- Data
- PostgreSQL · Drizzle ORM · versioned migrations
- Money math
- decimal.js-light in a pure, framework-free domain layer
- Prices
- metals.dev → gold-api.com → Swissquote fallback chain
- Hosting
- Self-hosted Docker on VPS · Caddy edge · PWA installable
Status: live and early — weeks old, solo-built, no usage metrics claimed. Its value is rigor per line, and we say that plainly.