Skip to content
All work

Case study 01Business management application

Commission Management System.

A multi-shop web application that records customer orders, calculates employee commission and bonuses automatically, and gives the owner payouts, debt tracking and financial reports that reconcile.

Role
Sole developer — full stack
Timeline
October 2026 – present
Status
DeployedFirst release running on a private server; acceptance and release checks are ongoing.
Platform
Installable web app (PWA) for phone and desktop
Languages
Arabic, Sorani Kurdish and English (RTL and LTR)
Source code
Private repository
Owner dashboard with summary cards for orders, sales, employee compensation, expenses and income
The owner dashboard on a phone, with a bottom navigation bar and a central New order button
Fig. 01Owner dashboard: orders, sales, employee compensation, expenses and income for the selected week or month, plus the items waiting for review.

01

Overview

The Commission Management System is a full-stack web application I designed and built for a retail business with several shops. Employees record orders from their phones; the system turns confirmed orders into commission, weekly and monthly bonuses, payouts and reports — with every figure traceable to the records behind it.

It runs as an installable web app on phones and desktops, in Arabic, Sorani Kurdish and English, with right-to-left layouts for Arabic and Kurdish.

The problem

The business pays employees commission and bonuses based on the orders they handle, but the calculation was done by hand. Cancellations, returns and corrections made totals hard to keep right, employees had no clear view of what they had earned, and the owner needed figures that could be trusted when paying staff.

The solution

A single system of record. Orders are entered in a few taps and confirmed orders earn commission automatically. Weekly and monthly periods close on schedule after a grace period, which fixes the bonuses. The owner reviews exceptions, approves payouts and records the cash actually paid. Every change is audited, and money is kept in append-only records so totals always reconcile.

02

Key features

  • Fast order entry

    Employees record an order from their phone — source, customer, amount and piece count — and move it through preparing, ready, shipped, delivered and completed. Search covers phone numbers, order numbers and customer names.

  • Automatic commission

    Confirmed orders earn commission from their piece count, using versioned rate tables per shop. Assigning an order is never enough on its own: credit follows explicit employee attribution.

  • Weekly and monthly periods

    Saturday-to-Friday weeks and calendar months close independently after a three-day grace period. Once a period closes, its bonuses are fixed and never change.

  • Owner review queues

    Cancellation requests, orders that cross a bonus threshold and other exceptions collect in review queues, so nothing holds up a period close unnoticed.

  • Payouts and debt tracking

    The system prepares payouts; the owner approves them and records the cash actually paid. What the business owes an employee and what an employee owes are kept as two separate balances.

  • Shops, staff and permissions

    Several shops, each with its own staff, orders, periods and ledgers. Employees join shops through memberships with per-shop permission toggles, and nothing is ever hard-deleted.

  • Reports that reconcile

    Monthly profit and cash views where every figure opens the records behind it, with CSV export and a printable layout.

  • Complete audit trail

    Every change is recorded with who made it and the values before and after.

  • Three languages, two directions

    Arabic, Sorani Kurdish and English with right-to-left layouts. It installs on Android as a web app, with push reminders when reviews are waiting for the owner.

03

Interface

Orders screen with a search field, status and period filters, and an order card
Fig. 02Orders: search by phone number, order number or customer name, and filter by status and period.
List of weekly commission periods with their status, eligible orders and bonuses
Fig. 03Commission periods: weekly and monthly periods close automatically after a three-day grace period.
Employees screen with shop members and a form of permission checkboxes for order actions and workflow stages
Fig. 04Employees: per-shop memberships with granular permission toggles for order actions and workflow stages.
Monthly report with profit and cash columns, period selectors, CSV export and print buttons
Fig. 05Monthly report: profit and cash views side by side, with CSV export and a printable layout.
Audit log entries showing actions such as period closed and profile updated, with timestamps
Fig. 06Audit log: every change is recorded with who made it and the values before and after.
Account screen with sign-in details, a password change form and active two-step verification
Fig. 07Account security: password changes and two-step verification with an authenticator app and recovery codes.
The owner dashboard on a phone, with a bottom navigation bar and a central New order button
Fig. 08Mobile: the same dashboard adapted for phones, with a bottom navigation bar and a quick “New order” action.
The More menu on a phone listing the secondary sections and a sign-out button
Fig. 09Mobile navigation: secondary sections live under “More”, so the bottom bar stays focused.

Screens are shown in the Sorani Kurdish (right-to-left) interface. Business and personal names, the sign-in username and internal record IDs are masked for privacy.

04

Technical highlights

  1. 01

    Money is never a floating‑point number

    Amounts are whole Iraqi dinars computed in PostgreSQL bigint and sent as integer strings, so JavaScript numbers never touch authoritative money. parseFloat is banned by the lint rules.

  2. 02

    Append‑only financial history

    27 ledger and history tables are guarded by database triggers that reject updates and deletes. Mistakes are fixed with explicit reversals, so every total can be recomputed from its records.

  3. 03

    Shop isolation, enforced twice

    Every check runs on the server, and PostgreSQL row-level security with composite foreign keys enforces the shop boundary again in the database. The API connects as a role that cannot bypass it or delete rows — and refuses to start with a more privileged one.

  4. 04

    One contract for client and server

    Request and response schemas live in a shared Zod package used by both the API and the web client. Strict schemas reject any field a role is not allowed to send.

  5. 05

    Tested against the real database

    89 API test files run against PostgreSQL 18, each on its own clone of a migrated template database, alongside property-based tests with fast-check and Playwright browser tests at phone and desktop widths.

  6. 06

    Repeatable delivery

    GitHub Actions runs linting, type checks, tests, builds and end-to-end tests, then builds Docker images. One image serves the API and the web client behind Caddy, with encrypted backups and rehearsed restores.

  7. 07

    Layered security

    Argon2 password hashing, two-step verification with recovery codes, CSRF protection, rate limiting, a strict Content Security Policy, and re-authentication before sensitive actions.

05

Technology

Frontend
  • React
  • TypeScript
  • Vite
  • Tailwind CSS
  • Radix UI
  • i18next
Backend
  • Node.js
  • Fastify
  • Zod
Database
  • PostgreSQL
  • Kysely
Security
  • Argon2
  • TOTP two‑step verification
Testing
  • Vitest
  • fast-check
  • Playwright
  • Testing Library
  • ESLint
Delivery
  • Docker
  • GitHub Actions
  • Caddy
  • AWS Lightsail

06

My contribution

Sole developer — full stack

  • Worked with the business owner to turn the requirements into a written system plan: business rules, worked financial examples and a decision register.
  • Designed the PostgreSQL data model and wrote 34 forward-only SQL migrations, including row-level security policies and append-only triggers.
  • Built the Fastify API: authentication, orders, compensation, payouts, debts, reports and the scheduled period-close jobs.
  • Designed and built the React interface for owners and employees — mobile-first, right-to-left aware and available in three languages.
  • Wrote the automated test suites and set up continuous integration.
  • Prepared the Docker-based deployment, backups and the operations runbooks.

07

Challenges and decisions

  • Closed periods stay closed

    Bonuses are fixed once a period closes. Instead of reopening history, later corrections are posted as visible adjustments in the current period, so past results never change silently.

  • Sensitive rules ship switched off

    Rules for recovering debts from wages are implemented and tested, but sit behind feature flags that are off by default. Production refuses to enable them without a recorded legal review.

  • Decisions are written down

    Every business rule and open question lives in a decision register with an explicit status, so the owner approves behaviour before it ships instead of discovering it later.

Interested in working together?

I'm open to new opportunities. Tell me about your project or team — I'll get back to you.