Case study · Sales & operations
King Bell Fire
The bilingual sales and operations system King Bell Fire, a fire-safety equipment supplier, runs on: leads, quotations with tiered price approvals, warehouse-confirmed sales orders, field attendance, and verifiable documents. Built with the owner and in daily use since August 2026. Screens here use sample data; the interactive demo is a white-labelled copy anyone can try.
- Role
- Full-Stack Software Engineer
- Timeline
- 06/2026 — 08/2026
- Outcome
- 800+ quotations in its first five weeks live
- Live
- Interactive demo ↗
Overview
The problem
Quotes lived in spreadsheets, price approvals happened over WhatsApp, and the warehouse learned about orders from paper invoices. Nobody could see which quotes were waiting, who had discounted what, or whether stock had actually left.
My role
Sole engineer from discovery to production: domain modelling and the PostgreSQL schema, the NestJS API, the Arabic-first Next.js app, document generation, and deployment, working directly with the owner and the sales, warehouse, and field teams.
Constraints
- 01
Arabic-first with full English parity: every screen, PDF, and notification works right-to-left and left-to-right.
- 02
Pricing authority is real money: discounts route to the right approver, and nothing below list price leaves without the owner’s sign-off.
- 03
Stock, revenue, and the won deal change exactly once, when the warehouse confirms, even if two people press Confirm at the same moment.
Decisions
- 01
One shared package holds the quotation state machine, pricing math, and approval tiers; the API enforces them and the UI imports the same functions.
- 02
Permission-based access with role presets and branch scope, applied in the queries themselves, so a rep never receives another rep’s records.
- 03
Row locks on warehouse confirmation, proven with deterministic concurrency tests, plus an append-only audit log of every change.
- 04
Quotations render server-side on each company’s letterhead, with a QR code that checks the printed totals against the record.
Impact
- 01
800+ quotations created by 11 people in the first five weeks live, replacing spreadsheets and WhatsApp threads.
- 02
57% of quotations approve themselves on submit; the rest are reviewed in a median 34 minutes, and 98% of those are approved.
- 03
The warehouse confirms orders in a median 1.1 hours, and a quote becomes a sales order in a median 41 hours.
- 04
876 field check-ins from 34 people, 36% of them outside the office, each recorded with location and reason.
Stack
- TypeScript
- Next.js
- React
- Tailwind CSS
- shadcn/ui
- NestJS
- Drizzle
- PostgreSQL
- Better Auth
- Socket.IO
- Headless Chromium PDFs
- Leaflet
- next-intl · Arabic RTL + English
- Turborepo
Lessons
- 01
Encoding the business’s rules once, in a shared package, kept the API, the UI, and the documents from drifting as the rules evolved.
- 02
In an operations tool the edge cases are the product: returns, late check-ins, re-reviews after an accepted quote is edited.