Back to Archive
Case StudyBackend Systems

Shakirin Mills Gold Refining Management System

A centralized operational and financial platform built to digitize the complete workflow of a gold grinding and refining business — from customers and grinding sessions to inventory, payroll, collections, accounting, and final profitability.

Role
Backend Architecture & Full-Stack Development
Timeline
Production
Industry
Gold Grinding & Refining Operations
Status
Production
shakirin-mills-gold-refining-system
Shakirin Mills Gold Refining Management System
01Overview

What this system is

Shakirin Mills is an operational, financial, and administrative system built for a gold grinding and refining business. It takes a workflow that normally lives across notebooks, spreadsheets, and memory, and binds it into one dependent cycle: a customer arrives, a grinding session is opened against a machine, bags are ground, gold is produced and refined, direct expenses and inventory consumption are absorbed into the session, payroll accrues against the month, the company collects from its own profit, and every one of those movements lands in a single financial ledger that the accounting reports read from. The result is a mill whose operational and financial state can be read at any moment from one source instead of reconciled after the fact.

02The Problem

What we needed to solve

Running a grinding mill means keeping bags, price per bag, gold output, refining fees, customer discounts, direct expenses, inventory consumption, payroll, maintenance, and company collections consistent with one another. Held in separate registers or manual calculations, those figures drift: expenses get counted twice, calculations differ between screens, historical reports change when a price is edited, and real profitability becomes very hard to establish.

03The Solution

How we shipped it

A centralized platform where every operation is bound to the rest of the system and every financial calculation resolves through one shared engine. Prices are captured as snapshots on the transaction, so historical records never move when settings change. Dashboards, the administrative report, the accountant workbook, and the financial ledger all read the same numbers, which makes the mill's operational and financial position provable rather than estimated.

04Architecture

How the system is wired

The system is organised as a Laravel REST backend with a lightweight browser client, and the business rules live in a domain layer rather than in controllers. The operational lifecycle below is the spine of the product: each stage writes into the same financial source, which is why a figure on the dashboard, the administrative report, the accountant workbook, and the ledger cannot disagree.

Data flow
01
Customer & Grinding

A customer record opens a grinding session against a specific machine, with the number of bags and the grinding account for that session.

02
Gold & Refining

Gold output is recorded in grams, the refining account is calculated from it, and any customer discount is applied to reach the customer's net.

03
Cost Absorption

Direct operational expenses, inventory consumption, and maintenance are charged against the session so its profit reflects real cost.

04
Payroll & Collections

Salaries accrue against the month and company remittances are drawn from validated available profit, both landing in the same ledger.

05
Accounting & Profit

The ledger, the accountant workbook, and the administrative report resolve to one final company net profit for the selected period.

05Tech Stack

Engineering choices

Frontend
HTML5CSS3Vanilla JavaScript
Backend
Laravel 12PHPMySQLREST APILaravel SanctumPoliciesForm RequestsAPI ResourcesServicesActionsAutomated Tests
Integrations
Sanctum session authenticationCSV exportArabic / English / French localization
Infrastructure
VPSNginxDedicated PHP-FPM socketDedicated MySQL databaseHTTPS / SSLGitHub Actions
06Gallery

In the wild

Main dashboard — grinding volume, service account, and company results for the selected period
Grinding cycle register — every session with its gold, accounts, discount, expenses, and net profit
Customer management — searchable customer register with per-customer statistics
Grinding machine register — availability, maintenance state, and stated deactivation reason
Administrative report — period selector, comprehensive financial movements, and CSV export
Unified financial ledger — every movement with its source, actor, role, and net effect
Accountant workbook — per-customer sheet with gold, refining, discount, microscope data, and notes
Payroll — monthly and daily salary, worked days, accrued value, and payment state
Financial settings — bag price, refining price, discount rules, and additional financial items
Maintenance log — independent maintenance costs classified by type
Inventory — catalogue with quantities, minimum thresholds, unit cost, and stock value
User management — accounts, roles, status, and last sign-in
Adding a user — role, status, and password policy enforced at creation
Settings — mill identity, theme, and the Laravel API / Sanctum session data source
Audit log — read-only record of system operations with actor, type, and address
01 / 15
08Backend Systems

Services and data

Unified Financial Engine

A centralized financial layer rather than calculations scattered through controllers and views. It resolves grinding revenue, refining value, services, discounts, customer net due, operational expenses, inventory cost, maintenance, payroll, manual adjustments, company collections, grinding profit, and final company net profit — so every dashboard and report is reading the same computation.

Grinding Operations

Session lifecycle covering customer, grinding machine, number of bags, gold quantity, grinding cost, refining cost, customer discount, operational expenses, inventory consumption, customer net, and session profit.

Payroll Service

Employees, monthly salary, employment start date, derived daily salary, worked days, accrued salary, and pending or paid state. Accrual is computed rather than entered by hand.

Company Collections

Remittances are checked against available company profit before they are written, and are stored with the acting user, timestamp, profit before, and profit after. They are kept distinct from operational expenses.

Inventory Service

Item catalogue, current quantities, minimum thresholds, and inventory movements. Consumption is costed into the session so profit reflects the materials actually used.

Maintenance

Independent maintenance costs classified by type — emergency, periodic, and repair — tracked separately from session expenses but landing in the same ledger.

Audit Logging

A read-only record of system operations — who acted, when, from which address, and on what entity. Entries such as accounting period creation, payroll changes, inventory updates, and authentication events cannot be edited or deleted.

Access Control

Role-based authorisation across General Manager, Manager, Accountant, Supervisor, and Assistant Supervisor, enforced with Laravel policies so each user reaches only the functions their role allows.

09APIs & Integrations

External surfaces

Integration
REST API surface

The browser client talks to the system exclusively over a versioned Laravel REST API, with API Resources shaping every response so the client never depends on the database schema.

Integration
Sanctum session authentication

Authentication runs on a Sanctum session cookie, with password policy enforced at account creation and session events recorded in the audit log.

Integration
Form Requests & Policies

Input validation lives in Form Requests and authorisation in Policies, so a controller cannot accidentally accept an invalid payload or serve a record the role is not entitled to.

Integration
CSV export

The administrative report and the accountant workbook export their period to CSV for archiving and for handover to external accounting.

10Dashboard Structure

What admins control

01
Customer

The registered customer the session belongs to, with their own history and statistics.

02
Grinding

A session opened against a machine, carrying the number of bags and the grinding account.

03
Gold

Gold output recorded in grams for the session, or no gold at all when the operation produced none.

04
Refining

The refining account calculated from the gold, then reduced by any applicable customer discount.

05
Expenses

Direct operational expenses attached to the session rather than pooled at the end of the month.

06
Inventory

Materials and spare parts consumed by the session, costed into it from the inventory ledger.

07
Payroll

Salaries accruing against the month from each employee's start date and worked days.

08
Collections

Company remittances drawn from available profit, validated before they are allowed to record.

09
Accounting

The financial ledger, the accountant workbook, and the administrative report over the chosen period.

10
Company Profit

The final net figure for the period, derived from the same engine every other screen reads.

11Challenges Solved

Hard problems, handled

Impact
Challenge 01

Editing a financial setting retroactively changed historical operations and every report built on them.

Resolution

Prices are snapshotted onto the transaction at creation time, so settings changes apply forward only and historical reports stay reproducible.

Impact
Challenge 02

The same figure was at risk of being computed differently on the dashboard, the report, and the ledger.

Resolution

All financial computation was moved behind one service layer that every consumer calls, removing the possibility of two screens disagreeing.

Impact
Challenge 03

Operational expenses and inventory consumption were easy to double-count between the session and the monthly report.

Resolution

Expenses and consumption are attached to the session that incurred them and flow upward into period reporting from there, so each cost is recognised exactly once.

Impact
Challenge 04

Company remittances could be taken against profit that did not exist.

Resolution

Collections calculate available profit first, reject a request larger than it, and store profit before and after alongside the acting user and timestamp.

12Performance

Built to stay fast

Financial aggregates resolved server-side so the client renders prepared figures instead of computing them.
Indexed lookups on the date, customer, and session columns the reports filter on.
Paginated and filterable registers rather than loading full history into the browser.
A dependency-free client that ships no framework runtime.
13UI / UX

Design and interaction

Enterprise interface in graphite and black with a single gold accent.
Dark and light modes, switchable from the top bar.
Arabic RTL alongside English and French LTR, with the choice persisted per user.
Data-dense tables with consistent filters, modals, and responsive forms.
Financial state carried by colour and label together — profit, loss, paid, pending — never colour alone.
14Production Readiness

Ready to ship and operate

Deployed to a VPS in an independent production directory, isolated from the other applications on the same host.
Dedicated MySQL database and a dedicated PHP-FPM socket for the application.
Nginx in front, with HTTPS / SSL terminated at the edge.
Automated deployment from GitHub via GitHub Actions.
Backups taken before sensitive operations, with backup integrity verified rather than assumed.
Production database guards protecting against accidental resets and preserving master data.
Automated tests covering the financial paths that reports depend on.
15System Features

What it does

Grinding Operations Management

Every session records its customer, machine, bags, gold quantity, grinding cost, refining cost, customer discount, operational expenses, inventory consumption, customer net, and its own profit — visible as a filterable register with per-session detail.

Accountant Workbook

A dedicated accountant surface listing each customer's grinding, gold weight, refining calculation, discount, total, microscope data, and notes for the day or month, with a period summary and CSV export.

Unified Financial Ledger

Every financial movement appears in one record with its source — grinding, expense, maintenance, payroll, financial adjustment, or company collection — its actor, role, income, expense, net effect, and reference, so any figure can be traced back to what produced it.

Administrative Reporting

Daily, monthly, yearly, and custom date ranges reporting customer net totals, operating expenses, session profits, payroll, maintenance, collections, and final company profit, with CSV export.

Payroll Management

Employees with monthly salary, employment start date, derived daily salary, worked days, accrued salary, and paid or pending status, summarised by total, paid, and outstanding.

Inventory Management

Item catalogue with supplier, category, unit, current quantity, minimum threshold, unit cost, and stock value, plus movement history and low or out-of-stock flags.

Grinding Machine Management

Machines are registered with a number and location, carry an availability state — available, under maintenance, or inactive with a stated reason — and each session is bound to the machine that performed it.

Dynamic Financial Configuration

Bag price, gold price per gram, refining price, customer discounts, and additional financial items are all editable by management without touching code. Items can be created, renamed, repriced, and deactivated.

Role-Based Access Control

General Manager, Manager, Accountant, Supervisor, and Assistant Supervisor each reach only the functions their role permits, managed from a user register showing role, status, and last sign-in.

Audit Logs

A read-only operations log recording who acted, when, from which address, and what changed — covering authentication, payroll, inventory, and accounting period activity.

Multilingual Interface

Arabic, English, and French, with RTL for Arabic and LTR for English and French. The selected language is stored against the user rather than reset on each visit.

Dark & Light Themes

An enterprise interface in graphite and black with a gold accent, in both dark and light modes, built on professional tables, cards, responsive forms, and consistent modals.

16Technical Decisions

Why we chose what we chose

Decision 01

Historical price snapshots on every transaction.

When a session is created at a given bag price, gold price, or refining price, those values are captured onto the transaction itself. If management changes a price later, the older operation does not move — and neither does any report built on it. Without this, editing a single financial setting would silently rewrite months of history.

Decision 02

One centralized financial engine instead of per-screen calculation.

Financial logic was deliberately kept out of controllers and out of the UI. Every consumer — dashboard, administrative report, accountant workbook, ledger — calls the same services, which is the only way two screens can be guaranteed to agree on a number.

Decision 03

Decimal-based money and gold arithmetic.

The system computes money against gold weights, where floating-point representation accumulates rounding error across a chain of multiplications and subtractions. Decimal-based backend calculation keeps totals stable across the grinding, refining, discount, and expense chain.

Decision 04

Payroll accrual derived, not entered.

Accrued salary is computed as monthly salary ÷ days in month × actual worked days, which handles months of different lengths and leap years without special cases. Once a salary is paid, the accrued value is frozen historically so a later month cannot alter a settled record.

Decision 05

Collections validated against available profit.

A company remittance is checked against calculated available profit before it can be recorded, and is stored with profit before and after. This prevents the company from collecting more than it actually earned, and keeps collections separate from operational expenses in every report.

Decision 06

Deactivate rather than delete financial items in use.

A financial item can only be deleted if it was never used historically. Anything referenced by an existing transaction is deactivated instead, so historical records keep resolving their line items and reports stay reproducible.

Decision 07

Operations that produce no gold are first-class.

Some sessions legitimately yield no gold. Rather than forcing a placeholder quantity to satisfy the schema, the system models the no-gold case directly, so reporting is never polluted with invented weights.

Decision 08

Vanilla JavaScript on the client, not a frontend framework.

The interface is a set of data-dense tables, forms, and modals driven by a REST API. HTML5, CSS3, and vanilla JavaScript keep it light and dependency-free; adding a frontend framework would have introduced a build pipeline and runtime weight this product did not need.

17Outcome

Results

Production
Status
Arabic · English · French
Interface languages
5
Access roles
Single unified engine
Financial source
Continue exploring

Other case studies

Building something similar?

Let's scope your platform — dashboard, mobile apps, APIs, the full stack.

WhatsApp